Skip to content

Commit

Permalink
Update htsjdk (#1482)
Browse files Browse the repository at this point in the history
* update htsjdk 2.21.2 -> 2.21.3
* update code that changed because of clipping improvements
  • Loading branch information
lbergelson authored Mar 10, 2020
1 parent 81bef8d commit 5e73783
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def ensureBuildPrerequisites(rbuildPrerequisitesMessage) {

ensureBuildPrerequisites(buildPrerequisitesMessage)

final htsjdkVersion = System.getProperty('htsjdk.version', '2.21.2')
final htsjdkVersion = System.getProperty('htsjdk.version', '2.21.3')
final googleNio = 'com.google.cloud:google-cloud-nio:0.107.0-alpha:shaded'

// Get the jdk files we need to run javaDoc. We need to use these during compile, testCompile,
Expand Down
14 changes: 0 additions & 14 deletions src/main/java/picard/sam/AbstractAlignmentMerger.java
Original file line number Diff line number Diff line change
Expand Up @@ -773,14 +773,12 @@ protected static void clipForOverlappingReads(final SAMRecord read1, final SAMRe
final int clipped = lengthOfSoftClipping(elems.iterator());
final int clipFrom = pos.getReadLength() - posDiff - clipped + 1;
CigarUtil.softClip3PrimeEndOfRead(pos, Math.min(pos.getReadLength(), clipFrom));
removeNmMdAndUqTags(pos); // these tags are now invalid!
}

if (negDiff > 0) {
final int clipped = lengthOfSoftClipping(neg.getCigar().getCigarElements().iterator());
final int clipFrom = neg.getReadLength() - negDiff - clipped + 1;
CigarUtil.softClip3PrimeEndOfRead(neg, Math.min(neg.getReadLength(), clipFrom));
removeNmMdAndUqTags(neg); // these tags are now invalid!
}
}
}
Expand Down Expand Up @@ -925,7 +923,6 @@ protected void updateCigarForTrimmedOrClippedBases(final SAMRecord rec, final SA
// If the adapter sequence is marked and clipAdapter is true, clip it
if (this.clipAdapters && rec.getAttribute(ReservedTagConstants.XT) != null) {
CigarUtil.softClip3PrimeEndOfRead(rec, rec.getIntegerAttribute(ReservedTagConstants.XT));
removeNmMdAndUqTags(rec); // these tags are now invalid!
}
}

Expand Down Expand Up @@ -989,15 +986,4 @@ public void setIncludeSecondaryAlignments(final boolean includeSecondaryAlignmen
public void close() {
CloserUtil.close(this.refSeq);
}


/** Removes the NM, MD, and UQ tags. This is useful if we modify the read and are not able to recompute these tags,
* for example when no reference is available.
* @param rec the record to modify.
*/
private static void removeNmMdAndUqTags(final SAMRecord rec) {
rec.setAttribute(SAMTag.NM.name(), null);
rec.setAttribute(SAMTag.MD.name(), null);
rec.setAttribute(SAMTag.UQ.name(), null);
}
}
4 changes: 2 additions & 2 deletions src/test/java/picard/sam/AbstractAlignmentMergerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ public class AbstractAlignmentMergerTest extends CommandLineProgramTest {
final SAMRecord r2 = recs.get(1);
AbstractAlignmentMerger.clipForOverlappingReads(r1, r2);
Assert.assertEquals(r1.getAlignmentStart(), 100);
Assert.assertEquals(r1.getCigarString(), "100M20S"); // Should ideally be 100M20S5H
Assert.assertEquals(r1.getCigarString(), "100M20S5H");
Assert.assertEquals(r2.getAlignmentStart(), 100);
Assert.assertEquals(r2.getCigarString(), "20S100M"); // Should ideally be 5H20S100M
Assert.assertEquals(r2.getCigarString(), "5H20S100M");
}


Expand Down

0 comments on commit 5e73783

Please sign in to comment.