diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/indels/IndelRealigner.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/indels/IndelRealigner.java index 9c03a9bb4..d5276254f 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/indels/IndelRealigner.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/indels/IndelRealigner.java @@ -394,7 +394,7 @@ public class IndelRealigner extends ReadWalker { throw new RuntimeException("Entropy threshold must be a fraction between 0 and 1"); try { - referenceReader = new CachingIndexedFastaSequenceFile(getToolkit().getArguments().referenceFile); + referenceReader = new CachingIndexedFastaSequenceFile(getToolkit().getArguments().referenceFile, false, true); } catch(FileNotFoundException ex) { throw new UserException.CouldNotReadInputFile(getToolkit().getArguments().referenceFile,ex); diff --git a/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/fasta/CachingIndexedFastaSequenceFile.java b/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/fasta/CachingIndexedFastaSequenceFile.java index 598c13d90..a456008a5 100644 --- a/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/fasta/CachingIndexedFastaSequenceFile.java +++ b/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/fasta/CachingIndexedFastaSequenceFile.java @@ -125,8 +125,9 @@ public class CachingIndexedFastaSequenceFile extends IndexedFastaSequenceFile { * @param fasta The file to open. * @param cacheSize the size of the cache to use in this CachingIndexedFastaReader, must be >= 0 * @param preserveCase If true, we will keep the case of the underlying bases in the FASTA, otherwise everything is converted to upper case + * @param preserveIUPAC If true, we will keep the IUPAC bases in the FASTA, otherwise they are converted to Ns */ - public CachingIndexedFastaSequenceFile(final File fasta, final long cacheSize, final boolean preserveCase, final boolean preserveIUPAC) throws FileNotFoundException { + public CachingIndexedFastaSequenceFile(final File fasta, final long cacheSize, final boolean preserveCase, final boolean preserveIUPAC) throws FileNotFoundException { super(fasta); if ( cacheSize < 0 ) throw new IllegalArgumentException("cacheSize must be > 0"); this.cacheSize = cacheSize; @@ -172,6 +173,19 @@ public class CachingIndexedFastaSequenceFile extends IndexedFastaSequenceFile { this(fasta, DEFAULT_CACHE_SIZE, preserveCase, false); } + /** + * Open the given indexed fasta sequence file. Throw an exception if the file cannot be opened. + * + * Looks for a index file for fasta on disk + * + * @param fasta The file to open. + * @param preserveCase If true, we will keep the case of the underlying bases in the FASTA, otherwise everything is converted to upper case + * @param preserveIUPAC If true, we will keep the IUPAC bases in the FASTA, otherwise they are converted to Ns + */ + public CachingIndexedFastaSequenceFile(final File fasta, final boolean preserveCase, final boolean preserveIUPAC) throws FileNotFoundException { + this(fasta, DEFAULT_CACHE_SIZE, preserveCase, preserveIUPAC); + } + /** * Create reference data source from fasta file, after performing several preliminary checks on the file. * This static utility was refactored from the constructor of ReferenceDataSource. diff --git a/public/gatk-utils/src/test/java/org/broadinstitute/gatk/utils/fasta/CachingIndexedFastaSequenceFileUnitTest.java b/public/gatk-utils/src/test/java/org/broadinstitute/gatk/utils/fasta/CachingIndexedFastaSequenceFileUnitTest.java index 17cdb0938..ef8565dba 100644 --- a/public/gatk-utils/src/test/java/org/broadinstitute/gatk/utils/fasta/CachingIndexedFastaSequenceFileUnitTest.java +++ b/public/gatk-utils/src/test/java/org/broadinstitute/gatk/utils/fasta/CachingIndexedFastaSequenceFileUnitTest.java @@ -236,7 +236,7 @@ public class CachingIndexedFastaSequenceFileUnitTest extends BaseTest { @Test(enabled = true) public void testIupacChanges() throws FileNotFoundException, InterruptedException { final String testFasta = privateTestDir + "iupacFASTA.fasta"; - final CachingIndexedFastaSequenceFile iupacPreserving = new CachingIndexedFastaSequenceFile(new File(testFasta), CachingIndexedFastaSequenceFile.DEFAULT_CACHE_SIZE, false, true); + final CachingIndexedFastaSequenceFile iupacPreserving = new CachingIndexedFastaSequenceFile(new File(testFasta), false, true); final CachingIndexedFastaSequenceFile makeNs = new CachingIndexedFastaSequenceFile(new File(testFasta)); int preservingNs = 0;