Cleaned up error when fasta index is missing. Code still throws an exception, but the message is more direct (no more 'error while micromanaging') and tells the user to run 'samtools faidx' to fix the issue.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@867 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2009-06-01 15:34:38 +00:00
parent f19d7abba9
commit fc7320133c
3 changed files with 5 additions and 2 deletions

View File

@ -196,7 +196,7 @@ public abstract class MicroScheduler {
ref = new IndexedFastaSequenceFile(refFile);
}
catch (FileNotFoundException ex) {
throw new RuntimeException("File not found opening fasta file; please do this check before MicroManaging", ex);
throw new StingException("I/O error while opening fasta file: " + ex.getMessage(), ex);
}
GenomeLoc.setupRefContigOrdering(ref);
return ref;

View File

@ -31,7 +31,7 @@ public class FastaSequenceIndex implements Iterable {
*/
public FastaSequenceIndex( File indexFile ) throws FileNotFoundException {
if(!indexFile.exists())
throw new FileNotFoundException("Index file is missing");
throw new FileNotFoundException(String.format("Fasta index file is missing",indexFile.getAbsolutePath()));
IoUtil.assertFileIsReadable(indexFile);
parseIndexFile(indexFile);

View File

@ -90,6 +90,9 @@ public class IndexedFastaSequenceFile implements ReferenceSequenceFile {
*/
private void loadIndex( File fastaFile ) throws FileNotFoundException {
File indexFile = new File(fastaFile.getAbsolutePath() + ".fai");
if (!indexFile.exists())
throw new PicardException(String.format("Unable to load fasta index file %s. "+
"Please create it using 'samtools faidx'.",indexFile.getAbsolutePath()));
index = new FastaSequenceIndex(indexFile);
indexIterator = index.iterator();
}