/** * Open the given indexed fasta sequence file. Throw an exception if the file cannot be opened. * @param file The file to open. * @param index Pre-built FastaSequenceIndex, for the case in which one does not exist on disk. * @throws FileNotFoundException If the fasta or any of its supporting files cannot be found. */ public IndexedFastaSequenceFile(final File file, final FastaSequenceIndex index) { super(file); if (index == null) throw new IllegalArgumentException("Null index for fasta " + file); this.index = index; IOUtil.assertFileIsReadable(file); final FileInputStream in; try { in = new FileInputStream(file); } catch (FileNotFoundException e) { throw new SAMException("Fasta file should be readable but is not: " + file, e); } channel = in.getChannel(); reset(); if(getSequenceDictionary() != null) sanityCheckDictionaryAgainstIndex(file.getAbsolutePath(),sequenceDictionary,index); }