Extract target region sequence with samtools but the output contains suquence exceeding the bed region
Hi, guys. I'm using "samtools view" to look at a sorted.bam. I tired setting a region
- Using a bed file
- Input the region in samtools command manually
(1)using a bed file
$ cat Gene.bed
chr19 11089362 11133830
$ samtools view -L Gene.bed [sorted.bam] | head
(2)input the region manually
$ samtools view [sorted.bam] "chr19:11089362-11133830" | head
Both methods gave me the sequence starts before "11089362"
b758e43b-3975-4d6e-a112-4e457161770a 0 chr19 **11089173** 60 5S43M1D181M2D9M6D185M3D49M3D13M1I2M3 ....
I'm confused. Could any one help me with this? Thank you very much!
• 2,494 views
•
link
1 answer
When you ask samtools to output reads from a region, it outputs all reads that overlap that region. The read you show starts before 11,089,362, but finishes after it, thus the read overlaps with the region you specified.
• 0 views
•
link
Log in to answer this question.
Please show the output of
headEdited for formatting
"5S43M1D181M2D9M6D185M3D49M3D13M1I2M3" ~ 500bp By the way, you should notice that bed file is 0-based half-open but region argument for samtools should be 1-based inclusive.