Question: samtools view region vs. bamtools filter region
1
gravatar for Lídia
6.6 years ago by
Lídia80
Spain
Lídia80 wrote:

When extracting reads aligned to a certain region, what is the difference between using samtools view and bamtools filter region?

Here is the code and the counts of the number of reads recovered. I don't understand why the number of reads recovered are so different between the two approaches. Any help??

 

samtools index IV75_realigned_reads.bam
samtools view -hb IV75_realigned_reads.bam 3R:15,000,000-15,100,000 > Control_region.bam
bamtools count -in Control_region.bam 
# 28034
bamtools filter -region 3R:15,000,000-15,100,000 -in IV75_realigned_reads.bam -out test.bam
bamtools count -in test.bam
# 7523775

 

bamtools samtools bam ngs • 5.2k views
ADD COMMENTlink modified 6.6 years ago by Pierre Lindenbaum134k • written 6.6 years ago by Lídia80

it is not clear what is more maddening  1. that bamtools uses a different character to indicate the range or 2. that it still produces a count when you provide the incorrect one

ADD REPLYlink written 6.6 years ago by Istvan Albert ♦♦ 86k

The addition of both terms + the interaction... ;-) 

ADD REPLYlink written 6.6 years ago by Lídia80
2
gravatar for Pierre Lindenbaum
6.6 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum134k wrote:

as far as I can read in the manual of bamtools, region are defined with two dots and not using a hyphen. You should try (and don't play with fire, remove the commas):

3R:15000000..15100000

 

 

REGION string format: A proper REGION string can be formatted like any of the following
examples (where 'chr1' is the name of a reference (not its ID)and '' is any valid integer position
within that reference.) :
-region chr1
only alignments on (entire) reference 'chr1'
-region chr1:500
only alignments overlapping the region starting at chr1:500 and continuing to the end of chr1
-region chr1:500..1000
only alignments overlapping the region starting at chr1:500 and continuing to chr1:1000
-region chr1:500..chr3:750
only alignments overlapping the region starting at chr1:500 and continuing to chr3:750. T

 

ADD COMMENTlink modified 6.6 years ago • written 6.6 years ago by Pierre Lindenbaum134k

Sorry for such a silly mistake... You were completely right! 

filter -region 3R:15000000..15100000 -in IV75_realigned_reads.bam -out test.bam
bamtools count -in test.bam 
#28034

 

Thank you very much for your answer 

ADD REPLYlink written 6.6 years ago by Lídia80
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1649 users visited in the last hour
_