Get the regions mapped by the same reads
0
0
Entering edit mode
5.7 years ago
Corentin ▴ 600

Dear all,

I have a bam file and a bed file (with a thousand regions).

I would like, for each region in the bed, to get all the reads that mapped to this region (relatively straightforward) but I also want to get, if any, other regions mapped by these same reads.

I could not find something useful in this regard in the sam documentation.

bedtools bamtobed also seems promising but I think it output only the unique alignments (from the documentation: "There is not yet a standard method for reporting multiple alignments using BAM.").

I mapped Illumina reads with bwa, so I have access to the XA tags. But it will take a long time to parse the bam to get the XA tag for each region of the bed.

Does anyone tried to do something similar ?

bam sam bed reads multiple alignments • 1.2k views
ADD COMMENT
0
Entering edit mode

Is bedtools multicov what you are looking for ?

ADD REPLY
0
Entering edit mode

No, I only have one bam file, and I am looking for reads that map to multiple regions in this one bam.

ADD REPLY
1
Entering edit mode

Have you tried samtools view -F 0x04 filename.bam?

ADD REPLY
1
Entering edit mode

You can take the not primary alignments with samtools

samtools view -f 256 in.bam
ADD REPLY
0
Entering edit mode

I think I will use these commands to get the multiple mapped reads and then get the other regions from the XA flag, thanks !

ADD REPLY

Login before adding your answer.

Traffic: 1569 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