Question: Get the regions mapped by the same reads
0
gravatar for Corentin
9 months ago by
Corentin260
Corentin260 wrote:

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 ?

ADD COMMENTlink written 9 months ago by Corentin260

Is bedtools multicov what you are looking for ?

ADD REPLYlink written 9 months ago by Bastien Hervé4.2k

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

ADD REPLYlink written 9 months ago by Corentin260
1

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

ADD REPLYlink written 9 months ago by genomax67k
1

You can take the not primary alignments with samtools

samtools view -f 256 in.bam
ADD REPLYlink written 9 months ago by Bastien Hervé4.2k

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 REPLYlink written 9 months ago by Corentin260
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1068 users visited in the last hour