From 7fa6b2135b1c8c17159779b36e29fb692d24f420 Mon Sep 17 00:00:00 2001 From: hanna Date: Tue, 14 Sep 2010 18:58:08 +0000 Subject: [PATCH] Added a back door so that integration tests can reset the sequence dictionary in the reference. Reset routine is not accessible to any class outside GenomeLocParser's package. We'll have to do something more intelligent with this when the GATK goes distributed. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4275 348d0f76-0448-11de-a6fe-93d51630548a --- .../sting/utils/GenomeLocParser.java | 8 ++++ .../org/broadinstitute/sting/WalkerTest.java | 3 ++ .../sting/utils/GenomeLocParserTestUtils.java | 39 +++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 java/test/org/broadinstitute/sting/utils/GenomeLocParserTestUtils.java diff --git a/java/src/org/broadinstitute/sting/utils/GenomeLocParser.java b/java/src/org/broadinstitute/sting/utils/GenomeLocParser.java index 8f23ae6c7..832616731 100644 --- a/java/src/org/broadinstitute/sting/utils/GenomeLocParser.java +++ b/java/src/org/broadinstitute/sting/utils/GenomeLocParser.java @@ -135,6 +135,14 @@ public class GenomeLocParser { return true; } + /** + * A package-protected method that can be used by the test system to reset the sequence dictionary + * being used. Use this method sparingly. + */ + static void clearRefContigOrdering() { + contigInfo = null; + } + /** * parse a genome interval, from a location string * diff --git a/java/test/org/broadinstitute/sting/WalkerTest.java b/java/test/org/broadinstitute/sting/WalkerTest.java index fcd9ac2f0..6f8866f97 100755 --- a/java/test/org/broadinstitute/sting/WalkerTest.java +++ b/java/test/org/broadinstitute/sting/WalkerTest.java @@ -28,6 +28,7 @@ package org.broadinstitute.sting; import junit.framework.Assert; import org.broadinstitute.sting.gatk.CommandLineExecutable; import org.broadinstitute.sting.gatk.CommandLineGATK; +import org.broadinstitute.sting.utils.GenomeLocParserTestUtils; import org.broadinstitute.sting.utils.exceptions.ReviewedStingException; import org.broadinstitute.sting.utils.collections.Pair; import org.broadinstitute.sting.utils.Utils; @@ -274,6 +275,8 @@ public class WalkerTest extends BaseTest { * @return a pair of file and string lists */ private Pair, List> executeTest(String name, List md5s, List tmpFiles, String args, Class expectedException) { + GenomeLocParserTestUtils.clearSequenceDictionary(); + CommandLineGATK instance = new CommandLineGATK(); String[] command; diff --git a/java/test/org/broadinstitute/sting/utils/GenomeLocParserTestUtils.java b/java/test/org/broadinstitute/sting/utils/GenomeLocParserTestUtils.java new file mode 100644 index 000000000..89b527a38 --- /dev/null +++ b/java/test/org/broadinstitute/sting/utils/GenomeLocParserTestUtils.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2010, The Broad Institute + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +package org.broadinstitute.sting.utils; + +/** + * A suite of utilities for working with the GenomeLocParser + * in the context of the sequence dictionary. + */ +public class GenomeLocParserTestUtils { + /** + * Clear out the sequence dictionary associated with + * the genomeloc creator. + */ + public static void clearSequenceDictionary() { + GenomeLocParser.clearRefContigOrdering(); + } +}