Merge pull request #20 from broadinstitute/aw_reduceread_perf_1_GSA-761

Aw reduceread perf 1 gsa 761
This commit is contained in:
depristo 2013-02-07 12:11:05 -08:00
commit cd4aec177a
3 changed files with 6 additions and 11 deletions

View File

@ -60,10 +60,7 @@ public class BaseAndQualsCounts extends BaseCounts {
super(); super();
this.sumInsertionQuals = new long[BaseIndex.values().length]; this.sumInsertionQuals = new long[BaseIndex.values().length];
this.sumDeletionQuals = new long[BaseIndex.values().length]; this.sumDeletionQuals = new long[BaseIndex.values().length];
for (final BaseIndex i : BaseIndex.values()) { // Java primitive arrays comes zero-filled, so no need to do it explicitly.
sumInsertionQuals[i.index] = 0L;
sumDeletionQuals[i.index] = 0L;
}
} }
public void incr(final byte base, final byte baseQual, final byte insQual, final byte delQual) { public void incr(final byte base, final byte baseQual, final byte insQual, final byte delQual) {

View File

@ -69,10 +69,7 @@ import com.google.java.contract.Requires;
public BaseCounts() { public BaseCounts() {
counts = new int[BaseIndex.values().length]; counts = new int[BaseIndex.values().length];
sumQuals = new long[BaseIndex.values().length]; sumQuals = new long[BaseIndex.values().length];
for (final BaseIndex i : BaseIndex.values()) { // Java primitive arrays comes zero-filled, so no need to do it explicitly.
counts[i.index] = 0;
sumQuals[i.index] = 0L;
}
} }
public static BaseCounts createWithCounts(int[] countsACGT) { public static BaseCounts createWithCounts(int[] countsACGT) {

View File

@ -627,9 +627,10 @@ public class ReduceReads extends ReadWalker<LinkedList<GATKSAMRecord>, ReduceRea
private void compressReadName(GATKSAMRecord read) { private void compressReadName(GATKSAMRecord read) {
String name = read.getReadName(); String name = read.getReadName();
String compressedName = read.isReducedRead() ? "C" : ""; String compressedName = read.isReducedRead() ? "C" : "";
if (readNameHash.containsKey(name)) final Long readNumber = readNameHash.get(name);
compressedName += readNameHash.get(name).toString(); if (readNumber != null) {
else { compressedName += readNumber.toString();
} else {
readNameHash.put(name, nextReadNumber); readNameHash.put(name, nextReadNumber);
compressedName += nextReadNumber.toString(); compressedName += nextReadNumber.toString();
nextReadNumber++; nextReadNumber++;