Skip to content

Commit

Permalink
1.4.2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
d-cameron committed Aug 18, 2017
1 parent ba06bf9 commit fb54db8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>au.edu.wehi</groupId>
<artifactId>gridss</artifactId>
<packaging>jar</packaging>
<version>1.4.2-SNAPSHOT</version>
<version>1.4.2</version>
<name>gridss</name>
<url>https://github.com/PapenfussLab/gridss</url>
<properties>
Expand Down
17 changes: 14 additions & 3 deletions src/main/java/au/edu/wehi/idsv/debruijn/PackedSequence.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class PackedSequence {
private final int baseCount;
public PackedSequence(byte[] bases, boolean reverse, boolean complement) {
packed = new long[IntMath.divide(bases.length, BASES_PER_WORD, RoundingMode.CEILING)];
baseCount = bases.length;
int revMultiplier = 1;
int revOffset = 0;
if (reverse) {
Expand Down Expand Up @@ -99,12 +100,12 @@ public String toString() {
return new String(getBytes(0, packed.length * BASES_PER_WORD));
}
private static final long MATCH_MASK = 0x5555555555555555L;
public static int overlap(PackedSequence s1, PackedSequence s2, int start2RelativeToStart1, int matchScore, int mismatchScore) {
public static int overlapMatches(PackedSequence s1, PackedSequence s2, int start2RelativeToStart1) {
if (start2RelativeToStart1 < 0) {
return overlap(s2, s1, -start2RelativeToStart1, matchScore, mismatchScore);
return overlapMatches(s2, s1, -start2RelativeToStart1);
}
int matches = 0;
int overlapLength = Math.min(s1.baseCount, s1.baseCount - start2RelativeToStart1);
int overlapLength = overlapLength(s1, s2, start2RelativeToStart1);
if (overlapLength <= 0) {
return 0;
}
Expand All @@ -122,6 +123,13 @@ public static int overlap(PackedSequence s1, PackedSequence s2, int start2Relati
}
return matches;
}
public static int overlapLength(PackedSequence s1, PackedSequence s2, int start2RelativeToStart1) {
if (start2RelativeToStart1 < 0) {
return overlapLength(s2, s1, -start2RelativeToStart1);
}
int overlapLength = Math.min(s1.baseCount, s2.baseCount - start2RelativeToStart1);
return overlapLength;
}
/**
* Returns the 32 bases starting with the base at the given offset
* @param start 0-based offset of sequence to extract
Expand All @@ -140,4 +148,7 @@ private long get2BitBases(int start) {
// TODO: zero out bases after length?
return result;
}
public int length() {
return baseCount;
}
}
2 changes: 1 addition & 1 deletion src/test/java/gridss/analysis/CollectMapqMetricsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void metrics_should_correspond_to_read_counts() throws IOException {
Histogram<Integer> histo = loadHistogram(cmm.OUTPUT);
assertEquals(50, histo.values().size());
for (Bin<Integer> bin : histo.values()) {
assertEquals((int)bin.getId(), (int)bin.getValue());
assertEquals((int)bin.getId(), 50 - (int)bin.getValue());
}
}
}

0 comments on commit fb54db8

Please sign in to comment.