From 3ad97e4ab4fb8097155bbcaa54bbfef4801b0ecd Mon Sep 17 00:00:00 2001 From: depristo Date: Sat, 12 Sep 2009 19:10:35 +0000 Subject: [PATCH] Easier to print GenomeLoc compareTo() git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1597 348d0f76-0448-11de-a6fe-93d51630548a --- .../broadinstitute/sting/utils/GenomeLoc.java | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/java/src/org/broadinstitute/sting/utils/GenomeLoc.java b/java/src/org/broadinstitute/sting/utils/GenomeLoc.java index d2fff00af..69c11ba83 100644 --- a/java/src/org/broadinstitute/sting/utils/GenomeLoc.java +++ b/java/src/org/broadinstitute/sting/utils/GenomeLoc.java @@ -256,19 +256,27 @@ public class GenomeLoc implements Comparable, Cloneable { } public int compareTo( GenomeLoc that ) { - if ( this == that ) return 0; + int result = 0; + if ( this == that ) { + result = 0; + } else { + final int cmpContig = compareContigs(that); - final int cmpContig = compareContigs(that); + if ( cmpContig != 0 ) { + result = cmpContig; + } else { + if ( this.getStart() < that.getStart() ) result = -1; + if ( this.getStart() > that.getStart() ) result = 1; + } - if ( cmpContig != 0 ) return cmpContig; - if ( this.getStart() < that.getStart() ) return -1; - if ( this.getStart() > that.getStart() ) return 1; + // TODO: and error is being thrown because we are treating reads with the same start positions + // but different stop as out of order + //if ( this.getStop() < that.getStop() ) return -1; + //if ( this.getStop() > that.getStop() ) return 1; + } - // TODO: and error is being thrown because we are treating reads with the same start positions - // but different stop as out of order - //if ( this.getStop() < that.getStop() ) return -1; - //if ( this.getStop() > that.getStop() ) return 1; - return 0; + //System.out.printf("this vs. that = %s %s => %d%n", this, that, result); + return result; } /**