From b947fd586f03a2a4f2fa8270d87108293a1e3b5f Mon Sep 17 00:00:00 2001 From: aaron Date: Wed, 17 Jun 2009 20:19:47 +0000 Subject: [PATCH] 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 --- java/src/org/broadinstitute/sting/utils/GenomeLoc.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/java/src/org/broadinstitute/sting/utils/GenomeLoc.java b/java/src/org/broadinstitute/sting/utils/GenomeLoc.java index 323b16ec6..c90599a07 100644 --- a/java/src/org/broadinstitute/sting/utils/GenomeLoc.java +++ b/java/src/org/broadinstitute/sting/utils/GenomeLoc.java @@ -26,7 +26,7 @@ import java.util.regex.Pattern; public class GenomeLoc implements Comparable, Cloneable { private static Logger logger = Logger.getLogger(GenomeLoc.class); - private Integer contigIndex; + private int contigIndex; private long start; private long stop; @@ -475,7 +475,7 @@ public class GenomeLoc implements Comparable, Cloneable { return false; if(other instanceof GenomeLoc) { GenomeLoc otherGenomeLoc = (GenomeLoc)other; - return this.contigIndex.equals(otherGenomeLoc.contigIndex) && + return this.contigIndex == otherGenomeLoc.contigIndex && this.start == otherGenomeLoc.start && this.stop == otherGenomeLoc.stop; } @@ -546,7 +546,11 @@ public class GenomeLoc implements Comparable, Cloneable { } 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 ) {