jvarkit icon indicating copy to clipboard operation
jvarkit copied to clipboard

MAPQ should be 0

Open apelin20 opened this issue 9 years ago • 1 comments

Finally got bamstats04 to work, but at one point I get this error:

htsjdk.samtools.SAMFormatException: SAM validation error: ERROR: Record 9505, Read name HWI-D00104:87:D1GYYACXX:5:1112:13918:71031, MAPQ should be 0 for unmapped read. at htsjdk.samtools.SAMUtils.processValidationErrors(SAMUtils.java:452) at htsjdk.samtools.BAMFileReader$BAMFileIterator.advance(BAMFileReader.java:643) at htsjdk.samtools.BAMFileReader$BAMFileIterator.next(BAMFileReader.java:628) at htsjdk.samtools.BAMFileReader$BAMFileIterator.next(BAMFileReader.java:598) at htsjdk.samtools.BAMFileReader$BAMQueryFilteringIterator.advance(BAMFileReader.java:831) at htsjdk.samtools.BAMFileReader$BAMQueryFilteringIterator.next(BAMFileReader.java:821) at htsjdk.samtools.BAMFileReader$BAMQueryFilteringIterator.next(BAMFileReader.java:787) at htsjdk.samtools.SamReader$AssertingIterator.next(SamReader.java:514) at htsjdk.samtools.SamReader$AssertingIterator.next(SamReader.java:488) at com.github.lindenb.jvarkit.tools.bamstats04.BamStats04.doWork(BamStats04.java:96) at com.github.lindenb.jvarkit.util.picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:178) at com.github.lindenb.jvarkit.tools.bamstats04.BamStats04.main(BamStats04.java:192)

This is a samtools issue, for some reason it produces reads without MAPQ 0 when unmapped. I used bwa to align and samtools to convert to bam and sort it. Is there a way to make bamstat ignore this error?

apelin20 avatar Jul 29 '14 21:07 apelin20

ah, yes, it's undocumented. BamStats04 uses the (old) picard API. All those softwares uses a parameter VALIDATION_STRINGENCY . see Standard Options/ VALIDATION_STRINGENCY in http://picard.sourceforge.net/command-line-overview.shtml

adding VALIDATION_STRINGENCY=SILENT to the command line should fix the problem.

lindenb avatar Jul 29 '14 21:07 lindenb