From d9398dc347afaf5651e88e31a42b6f354a75cf67 Mon Sep 17 00:00:00 2001 From: hanna Date: Wed, 17 Mar 2010 19:39:30 +0000 Subject: [PATCH] Remove some of the restrictions on getStart() and getStop(); getStart() and getStop() now do the minimum validation rather than the more rigorous only-within-the-contig-bounds header validation. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3027 348d0f76-0448-11de-a6fe-93d51630548a --- .../sting/utils/GenomeLocParser.java | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/java/src/org/broadinstitute/sting/utils/GenomeLocParser.java b/java/src/org/broadinstitute/sting/utils/GenomeLocParser.java index 503468c54..86a3fe15a 100644 --- a/java/src/org/broadinstitute/sting/utils/GenomeLocParser.java +++ b/java/src/org/broadinstitute/sting/utils/GenomeLocParser.java @@ -605,6 +605,8 @@ public class GenomeLocParser { /** * create a new genome loc from an existing loc, with a new start position + * Note that this function will NOT explicitly check the ending offset, in case someone wants to + * set the start of a new GenomeLoc pertaining to a read that goes off the end of the contig. * * @param loc the old location * @param start a new start position @@ -613,18 +615,13 @@ public class GenomeLocParser { */ public static GenomeLoc setStart(GenomeLoc loc, long start) { checkSetup(); - if (loc.getContigIndex() < 0 || loc.getContigIndex() >= contigInfo.getSequences().size()) { - throw new StingException("Genome loc passed in to setStart has a contig index outside the range of our current sequence dictionary"); - } - int length = GenomeLocParser.contigInfo.getSequences().get(loc.getContigIndex()).getSequenceLength(); - if (start > length) { - throw new StingException("start value of " + start + " is greater than the contig length, and is not -1. (length = " + length + ")."); - } return exceptionOnInvalidGenomeLoc(new GenomeLoc(loc.getContig(), loc.getContigIndex(), start, loc.getStop())); } /** * create a new genome loc from an existing loc, with a new stop position + * Note that this function will NOT explicitly check the ending offset, in case someone wants to + * set the stop of a new GenomeLoc pertaining to a read that goes off the end of the contig. * * @param loc the old location * @param stop a new stop position @@ -633,12 +630,6 @@ public class GenomeLocParser { */ public static GenomeLoc setStop(GenomeLoc loc, long stop) { checkSetup(); - if (loc.getContigIndex() < 0 || loc.getContigIndex() >= contigInfo.getSequences().size()) { - throw new StingException("Genome loc passed in to setStart has a contig index outside the range of our current sequence dictionary"); - } - if ((stop != -1) && (stop > GenomeLocParser.contigInfo.getSequences().get(loc.getContigIndex()).getSequenceLength())) { - throw new StingException("stop value of " + stop + " is greater than the contig length, and is not -1."); - } return exceptionOnInvalidGenomeLoc(new GenomeLoc(loc.getContig(), loc.getContigIndex(), loc.start, stop)); }