Does samtools view only show reads that completely span the region?
1
1
Entering edit mode
6.1 years ago

I've got a bam file of paired-end illumina sequences mapped to a reference sequence and I was wondering if when I call the samtools view command if the results represent only reads that completely span over the region of interest or if it also included reads that intersect it by one or two base pairs.

If not are there any existing tools out there to only read thats completely span over the region of interest?

with this visual example of what I mean I would want to only include sequences like case_2 and exclude case_1:

                                  [===================Region-of-Interest=====================]

                 [---------------------------------------------------------------------------------------------------------] case_1
                               [-------------------------------------------------------------------------------------------------------------------] case_2

Thanks!

samtools alignment assembly next-gen • 2.7k views
ADD COMMENT
3
Entering edit mode
6.1 years ago
h.mon 35k

bedtools intersect with -f 1.0 or -F 1.0 should do what you want. Something like:

bedtools intersect -F 1.0 -a intervarls.bed -b file.bam

I am not an expert on bedtools, though, so you may have to tweak / correct this command.

ADD COMMENT
1
Entering edit mode

Hey h.mon,

bedtools is definitely the way to go, I ended up using

   bedtools coverage -f 1.0 -a intervals.bed -b file.bam -counts -e

Thanks for the help!

ADD REPLY
0
Entering edit mode

Checkmark this as the accepted answer if they helped you :)

ADD REPLY

Login before adding your answer.

Traffic: 2323 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6