This is a test version of Biostars. For the public version, visit https://www.biostars.org.
error in query a BAM file

I'm the beginner of using samtools. I downloaded: efetch -db=nuccore -format=gb -id=AF086833 > AF086833.gb

and then try to query a bam file: samtools view -c bwa.bam AF086833:470-2689

it showed: [main_samview] region "AF086833:470-2689" specifies an unknown reference name. Continue anyway.

Any suggestions why this error occur? Thanks in advance.

software error samtools

1 answer

what's the point of fetching a genbank file ?

efetch -db=nuccore -format=gb -id=AF086833 > AF086833.gb

there is no contig named AF086833 the bam file. That's why you get an error with

samtools view -c bwa.bam AF086833:470-2689

to see the contigs in the bam use

 samtools view -H bwa.bam | grep "@SQ"

Log in to answer this question.