diff --git a/java/src/org/broadinstitute/sting/utils/fasta/IndexedFastaSequenceFile.java b/java/src/org/broadinstitute/sting/utils/fasta/IndexedFastaSequenceFile.java index abad9755f..8f222b9be 100755 --- a/java/src/org/broadinstitute/sting/utils/fasta/IndexedFastaSequenceFile.java +++ b/java/src/org/broadinstitute/sting/utils/fasta/IndexedFastaSequenceFile.java @@ -67,20 +67,21 @@ public class IndexedFastaSequenceFile implements ReferenceSequenceFile { dictionaryName = dictionaryName.substring(0, dictionaryName.lastIndexOf(".fasta")); dictionaryName += ".dict"; final File dictionary = new File(dictionaryName); - if (dictionary.exists()) { - IoUtil.assertFileIsReadable(dictionary); + if (!dictionary.exists()) + throw new PicardException("Unable to load .dict file. Dictionary is required for the indexed fasta reader."); - try { - final SAMTextHeaderCodec codec = new SAMTextHeaderCodec(); - final SAMFileHeader header = codec.decode(new AsciiLineReader(new FileInputStream(dictionary)), dictionary); - if (header.getSequenceDictionary() != null && header.getSequenceDictionary().size() > 0) { - this.sequenceDictionary = header.getSequenceDictionary(); - } - } - catch (Exception e) { - throw new PicardException("Could not open sequence dictionary file: " + dictionaryName, e); + IoUtil.assertFileIsReadable(dictionary); + + try { + final SAMTextHeaderCodec codec = new SAMTextHeaderCodec(); + final SAMFileHeader header = codec.decode(new AsciiLineReader(new FileInputStream(dictionary)), dictionary); + if (header.getSequenceDictionary() != null && header.getSequenceDictionary().size() > 0) { + this.sequenceDictionary = header.getSequenceDictionary(); } } + catch (Exception e) { + throw new PicardException("Could not open sequence dictionary file: " + dictionaryName, e); + } }