This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Extract aligned reads from a bam file for only selected coordinates

Hi, I want to extract only the reads aligned to a given positions of a reference genome from an aligned bam file. E.g. chr1:1000-2000

samtools view chr1:1000-2000

gives me all the reads that align to the region and beyond. However I want to clip off the alignments at 1000 to 2000 positions of the genome. I do not want to grab the regions in aligned reads before 1000 and after 2000 positions of the genome. How can I do this?

bam samtools alignment pacbio

0 answers

No answers yet.

Log in to answer this question.