This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Does samtools view only show reads that completely span the region?

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

1 answer

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.

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!

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

Log in to answer this question.