Permalink
Browse files

Added a "RANDOM" duplicate scoring strategy. (#688)

  • Loading branch information...
1 parent c8202f2 commit 0e17e07eb8f3432764e480f55077bdc36151cee4 @tfenne tfenne committed on GitHub Aug 19, 2016
Showing with 9 additions and 1 deletion.
  1. +9 −1 src/main/java/htsjdk/samtools/DuplicateScoringStrategy.java
@@ -24,6 +24,8 @@
package htsjdk.samtools;
+import htsjdk.samtools.util.Murmur3;
+
/**
* This class helps us compute and compare duplicate scores, which are used for selecting the non-duplicate
* during duplicate marking (see MarkDuplicates).
@@ -33,9 +35,13 @@
public enum ScoringStrategy {
SUM_OF_BASE_QUALITIES,
- TOTAL_MAPPED_REFERENCE_LENGTH
+ TOTAL_MAPPED_REFERENCE_LENGTH,
+ RANDOM,
}
+ /** Hash used for the RANDOM scoring strategy. */
+ private static final Murmur3 hasher = new Murmur3(1);
+
/** An enum to use for storing temporary attributes on SAMRecords. */
private static enum Attr { DuplicateScore }
@@ -80,6 +86,8 @@ public static short computeDuplicateScore(final SAMRecord record, final ScoringS
score += SAMUtils.getMateCigar(record).getReferenceLength();
}
break;
+ case RANDOM:
+ score += (short) (hasher.hashUnencodedChars(record.getReadName()) >> 16);
}
storedScore = score;

0 comments on commit 0e17e07

Please sign in to comment.