Skip to content

Commit

Permalink
Update edit dist with STAR's nM tag.
Browse files Browse the repository at this point in the history
  • Loading branch information
lmose committed Sep 15, 2017
1 parent 6207cd5 commit 430f26e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main/java/abra/ReAligner.java
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,13 @@ private void remapRead(ReadEvaluator readEvaluator, SAMRecord read, int origEdit
// Original edit distance
read.setAttribute("YX", origEditDist);

String distTag = "NM";
if (orig.getAttribute("NM") == null && orig.getAttribute("nM") != null) {
distTag = "nM";
}

// Updated edit distance
read.setAttribute("NM", SAMRecordUtils.getEditDistance(read, c2r, false));
read.setAttribute(distTag, SAMRecordUtils.getEditDistance(read, c2r, false));

//TODO: Compute mapq intelligently???
read.setMappingQuality(Math.min(read.getMappingQuality()+10, this.maxMapq));
Expand All @@ -648,7 +653,7 @@ private void remapRead(ReadEvaluator readEvaluator, SAMRecord read, int origEdit
read.setAttribute("YO", null);
read.setAttribute("YM", null);
read.setAttribute("YX", null);
read.setAttribute("NM", orig.getAttribute("NM"));
read.setAttribute(distTag, orig.getAttribute(distTag));
read.setMappingQuality(orig.getMappingQuality());
read.setReadUnmappedFlag(orig.getReadUnmappedFlag());
}
Expand Down

0 comments on commit 430f26e

Please sign in to comment.