Question: Mark duplicates fails using samtools view to remove unmapped reads
1
gravatar for jsgounot
3.1 years ago by
jsgounot130
European Union
jsgounot130 wrote:

Hi,

I've got an error using Picard MarkDuplicates function. It worked fine on my data before I add an other step in my pipeline, where I use samtools view -F4 -h to remove unmapped reads in the alignement. If I do this, an error occured during Picard treatment :

Exception in thread "main" htsjdk.samtools.SAMFormatException: SAM validation error: ERROR: Record 6, Read name FCC63KDACXX:3:1115:14357:43781#GCGGAACT_TCTTTCCC, Mate unmapped flag should not be set for unpaired read.

Do you have any ideas of how to fix that ? I understand the error but I don't know how to make it works. Previously I 'manually' removed unmapped reads (reads for which an * appears in the 3rd column in the sam files) but I read that's not the good way to do that and that the best way is to use samtools with the command line above.

Thanks.

tool picard alignment • 1.4k views
ADD COMMENTlink modified 3.1 years ago by Michael Dondrup46k • written 3.1 years ago by jsgounot130
2
gravatar for John
3.1 years ago by
John12k
Germany
John12k wrote:

Doing -F 4 will result in reads that were not mapped being removed from the file - but if their mate was mapped, the mate will be left in there as a singleton. Picard expects these singletons to look like singletons - not to look like half a pair, with the other half just mysteriously gone.

I imagine that running FixMateInformation will sort this out, otherwise you can use -F 12 instead of -F 4 when filtering the BAM. I can't remember if samtools does AND or OR when using bitflags, so that will either remove both reads in a pair if the read AND the mate is unmapped, or both reads in a pair if the read OR the mate is unmapped (what you probably want).

ADD COMMENTlink modified 3.1 years ago • written 3.1 years ago by John12k
1

Thanks ! It works perfectly now !

ADD REPLYlink written 3.1 years ago by jsgounot130
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: 827 users visited in the last hour