Question: Identifying discordantly mapped reads
gravatar for Linda
5.2 years ago by
Linda150 wrote:

How can I use samtools to identify discordantly paired reads or is it even possible? I can use awk to simply output reads which are mapped on different chromosomes, and also reads where the distance between the pairs is significantly larger than expected but is there a way to do this via samtools?

samtools bam paired-end • 4.7k views
ADD COMMENTlink modified 2.8 years ago by Pierre Lindenbaum133k • written 5.2 years ago by Linda150

just filter out flags 3854 ( ) ? (

read mapped in proper pair
read unmapped
mate unmapped
not primary alignment
read fails platform/vendor quality checks
read is PCR or optical duplicate
supplementary alignment


ADD REPLYlink modified 14 months ago by _r_am32k • written 5.2 years ago by Pierre Lindenbaum133k
gravatar for iraun
5.2 years ago by
iraun3.8k wrote:

There are different options:

- You can use samtools and give as argument the following flag '-F 1294'. In this way you'll discard all reads having which are: read mapped in proper pair, read unmapped,mate unmapped,not primary alignment,read is PCR or optical duplicate.
- As you've mentioned, you can use awk to extract mates mapped on different chr. You should convert your bam to sam, and then awk '($3!=$7 && $7!="=")' .

I would vote for the first approach, because it includes the distance between pairs issue.

ADD COMMENTlink written 5.2 years ago by iraun3.8k
gravatar for Pierre Lindenbaum
2.8 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum133k wrote:

using samjdk:

$ java -jar dist/samjdk.jar -e 'return record.getReadPairedFlag() && !record.getReadUnmappedFlag() && !record.getMateUnmappedFlag() && !record.getReferenceName().equals(record.getMateReferenceName());'  in.bam
ADD COMMENTlink written 2.8 years ago by Pierre Lindenbaum133k
Please log in to add an answer.


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