From be499fc986f43e699a73e42341960947e73217cf Mon Sep 17 00:00:00 2001 From: aaron Date: Sun, 7 Nov 2010 18:15:31 +0000 Subject: [PATCH] making the reference optional (the GATK will set it on the first run if it's not included), and setting the seq index if they do supply it. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4635 348d0f76-0448-11de-a6fe-93d51630548a --- .../sting/gatk/refdata/indexer/RMDIndexer.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/indexer/RMDIndexer.java b/java/src/org/broadinstitute/sting/gatk/refdata/indexer/RMDIndexer.java index 34a9a330f..2b0d726a0 100644 --- a/java/src/org/broadinstitute/sting/gatk/refdata/indexer/RMDIndexer.java +++ b/java/src/org/broadinstitute/sting/gatk/refdata/indexer/RMDIndexer.java @@ -46,12 +46,10 @@ public class RMDIndexer extends CommandLineProgram { // --------------------------------------------------------------------------------- // check the input parameters - if (referenceFile == null || !referenceFile.canRead()) + if (referenceFile != null && !referenceFile.canRead()) throw new IllegalArgumentException("We can't read the reference file: " + referenceFile + ", check that it exists, and that you have permissions to read it"); - // create a reference file reader - IndexedFastaSequenceFile seq = new IndexedFastaSequenceFile(referenceFile); // set the index file to the default name if they didn't specify a file if (indexFile == null && inputFileSource != null) @@ -88,6 +86,14 @@ public class RMDIndexer extends CommandLineProgram { Index index = IndexFactory.createIndex(inputFileSource, codec, approach); + if (referenceFile != null) { + // create a reference file reader + IndexedFastaSequenceFile seq = new IndexedFastaSequenceFile(referenceFile); + + // add writing of the sequence dictionary, if supplied + RMDTrackBuilder.setIndexSequenceDictionary(index, seq.getSequenceDictionary(), indexFile, false); + } + // create the output stream, and write the index LittleEndianOutputStream stream = new LittleEndianOutputStream(new FileOutputStream(indexFile)); index.write(stream);