This is a test version of Biostars. For the public version, visit https://www.biostars.org.
extracting reads from bam file

Hello all,

I am trying to extract the reads falling into the particular region from a bam file. I am using the following command:

samtools view -b out.bam "chr10:regionstart-regionend" > region.bam

When I run this command I only get one read into the output. However, I can see many reads mapping in that particular region when I visualize the alignment in IGV.

Could someone help me identify what am I doing wrong?

Thank you in advance

bam fasta samtools

what is the version of samtools, did you try to re-index the bam ?

Program: samtools (Tools for alignments in the SAM format) Version: 0.1.19-44428cd

No I did not re-index it.

try to re-index; Use a newer version of samtools (I'm not sure 0.1.19 is able to handle supplementary alignments)

As pciifen said, region format is chr:start-stop, like "chr3:1000-2000"

1 answer

Are you really using a colon ":" between your regionstart and regionend numbers instead of a dash "-"?

Sorry, its '-'

I made a typo there in thepost. I will correct it.

Log in to answer this question.