-
Notifications
You must be signed in to change notification settings - Fork 243
Open
Description
Description of the issue:
Validation of specifications-compliant unmapped records raises validation failures.
The SAM specifications state:
• Bit 0x4 is the only reliable place to tell whether the read is unmapped. If 0x4 is set, no assumptionscan be made about RNAME, POS, CIGAR, MAPQ, and bits 0x2, 0x100, and 0x800."
Your environment:
htsjdk 2.23.0
Steps to reproduce
@Test
public void htsjdk_mapq_unmapped_validation_violates_sam_specifications() {
SAMRecord r = new SAMRecord(null);
r.setReferenceName("chr");
r.setAlignmentStart(1);
r.setMappingQuality(1);
r.setCigarString("1M");
r.setReadUnmappedFlag(true);
r.setSupplementaryAlignmentFlag(true);
r.setSecondaryAlignment(true);
r.setProperPairFlag(true);
List<SAMValidationError> errors = r.isValid();
assertEquals(0, errors.size());
}
Expected behaviour
Test case should pass. Maybe a warning is more appropriate?
Actual behaviour
4 unnecessary validation failures are raised:
0 = {SAMValidationError@1269} "ERROR::INVALID_FLAG_PROPER_PAIR:Proper pair flag should not be set for unpaired read."
1 = {SAMValidationError@1270} "ERROR::INVALID_FLAG_NOT_PRIM_ALIGNMENT:Secondary alignment flag should not be set for unmapped read."
2 = {SAMValidationError@1271} "ERROR::INVALID_FLAG_SUPPLEMENTARY_ALIGNMENT:Supplementary alignment flag should not be set for unmapped read."
3 = {SAMValidationError@1272} "ERROR::INVALID_MAPPING_QUALITY:MAPQ should be 0 for unmapped read."
Metadata
Metadata
Assignees
Labels
No labels