checking for cram to bam conversion syntax using samtools
1
1
Entering edit mode
3.9 years ago
ricfoz ▴ 80

Hello everyone,

I am trying to retreive some genic regions from a .cram file, i know the workflow starting with .bam files, so i want to convert some whole low coverage genomes from cram to bam

I have been reading the manual and some how-to blogs, but i haven't come with a correct syntax to make the tool run and make the bams i need.

I know the syntax must have the reference genome in order to make the cram file readable, so i tried the next syntax:

samtools view -b <file.cram> <refgenome.fa> -o <file.bam>

it outputs the next error flag:

[main_samview] region "refgenome.fa" specifies an unknown reference name. Continue anyway.

and it does not build a usable .bam file, the flag is really straightforward, but i am sure that the reference genome i am using is correct, i think it is something about the syntax, i am using the -b flag at the beginning given the fact that i want an output file in bam format.

Any suggestions?, any help would be much appreciated!

cram to bam samtools syntax correct • 11k views
6
Entering edit mode
3.9 years ago
samtools view -b  -T <refgenome.fa> -o <file.bam> <file.cram>

0
Entering edit mode

alright, the flag -T is used in order to build an index for the fasta file right?, just, in order to get the grip on the syntax, you write first the .bam file, and the .cram file next, since i am trying to convert cram to bam, wouldn't it have to be the other way around?

1
Entering edit mode

CRAM doesn't store all the base in the file, you need a reference fasta file to retrieve the bases.