From adea7d11a0be78fd96193a9b5271e14a6fcfa702 Mon Sep 17 00:00:00 2001 From: Nils Homer Date: Wed, 5 Jun 2019 08:20:05 -0700 Subject: [PATCH] =?UTF-8?q?Remove=20requirement=20that=20zero=20length=20r?= =?UTF-8?q?eads=20need=20color=20space=20or=20flow=20si=E2=80=A6=20(#1360)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove requirement that zero length reads need color space or flow signal data. --- src/main/java/htsjdk/samtools/SAMRecord.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/htsjdk/samtools/SAMRecord.java b/src/main/java/htsjdk/samtools/SAMRecord.java index b8e2185756..4dc50b7bfd 100644 --- a/src/main/java/htsjdk/samtools/SAMRecord.java +++ b/src/main/java/htsjdk/samtools/SAMRecord.java @@ -2044,7 +2044,16 @@ public List isValid(final boolean firstOnly) { ret.addAll(errors); if (firstOnly) return ret; } - // TODO(mccowan): Is this asking "is this the primary alignment"? + + /* + The SAM specification allows both empty bases and qualities. However, for data generated with color space + information (ex. SOLiD sequencing) or flow signal information (ex. Ion Torrent sequencing), we have enforced + that certain auxiliary tags are present: CS and CQ for color space data, and FZ for flow signal data. See section + 1.6 ("Technology-specific data") in the SAM specification (dated Jan 30 2019). We have relaxed this constraint + to follow the SAM specification and a requested need to represent data in such a spec-compliant way. For more + information, see: + 1. https://github.com/samtools/htsjdk/issues/1174 + 2. https://github.com/samtools/htsjdk/pull/1360 if (this.getReadLength() == 0 && !this.isSecondaryAlignment()) { final Object fz = getAttribute(SAMTag.FZ.getBinaryTag()); if (fz == null) { @@ -2073,6 +2082,8 @@ public List isValid(final boolean firstOnly) { } } } + */ + if (this.getReadLength() != getBaseQualities().length && !Arrays.equals(getBaseQualities(), NULL_QUALS)) { if (ret == null) ret = new ArrayList<>(); ret.add(new SAMValidationError(SAMValidationError.Type.MISMATCH_READ_LENGTH_AND_QUALS_LENGTH,