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);