This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Identify similarly mapped reads in BAM/SAM?

I have a BAM (or SAM) file of reads mapped to a reference genome.

I would like to identify which reads are mapped similarly/to approximately the same location, which reads might be "orthologs".

For example, when visualizing the BAM file in IGV, the two reads circled in the orange are similar.

enter image description here

How can I parse this information from a BAM or SAM file? Using Python or R?

bam igv sam python r

1 answer

 bedtools bamtobed -i in.bam | datamash -g 1,2,3  collapse 4

Thank you! This is a great and straightforward solution.

Log in to answer this question.