FIxed a nasty bug in GenomeLoc compareContigs; we were using '==' to compare Integer contig ID's. The surprising thing is that it actually works for Integers > -127 and < 128 (they're cached by the JVM, so it's actually comparing the underlying ints). Switched over GenomeLoc contigs to int based.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1033 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
ed7fac1c90
commit
b947fd586f
|
|
@ -26,7 +26,7 @@ import java.util.regex.Pattern;
|
||||||
public class GenomeLoc implements Comparable<GenomeLoc>, Cloneable {
|
public class GenomeLoc implements Comparable<GenomeLoc>, Cloneable {
|
||||||
private static Logger logger = Logger.getLogger(GenomeLoc.class);
|
private static Logger logger = Logger.getLogger(GenomeLoc.class);
|
||||||
|
|
||||||
private Integer contigIndex;
|
private int contigIndex;
|
||||||
private long start;
|
private long start;
|
||||||
private long stop;
|
private long stop;
|
||||||
|
|
||||||
|
|
@ -475,7 +475,7 @@ public class GenomeLoc implements Comparable<GenomeLoc>, Cloneable {
|
||||||
return false;
|
return false;
|
||||||
if(other instanceof GenomeLoc) {
|
if(other instanceof GenomeLoc) {
|
||||||
GenomeLoc otherGenomeLoc = (GenomeLoc)other;
|
GenomeLoc otherGenomeLoc = (GenomeLoc)other;
|
||||||
return this.contigIndex.equals(otherGenomeLoc.contigIndex) &&
|
return this.contigIndex == otherGenomeLoc.contigIndex &&
|
||||||
this.start == otherGenomeLoc.start &&
|
this.start == otherGenomeLoc.start &&
|
||||||
this.stop == otherGenomeLoc.stop;
|
this.stop == otherGenomeLoc.stop;
|
||||||
}
|
}
|
||||||
|
|
@ -546,7 +546,11 @@ public class GenomeLoc implements Comparable<GenomeLoc>, Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public final int compareContigs( GenomeLoc that ) {
|
public final int compareContigs( GenomeLoc that ) {
|
||||||
return (this.contigIndex == that.contigIndex)?0:((this.contigIndex < that.contigIndex)?-1:1);
|
if (this.contigIndex == that.contigIndex)
|
||||||
|
return 0;
|
||||||
|
else if (this.contigIndex > that.contigIndex)
|
||||||
|
return 1;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int compareTo( GenomeLoc that ) {
|
public int compareTo( GenomeLoc that ) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue