Merged bug fix from Stable into Unstable
This commit is contained in:
commit
2be57fbcfb
|
|
@ -67,18 +67,20 @@ public class ReferenceDataSource {
|
|||
throw new UserException("The fasta file you specified (" + fastaFile.getAbsolutePath() + ") does not exist.");
|
||||
|
||||
final boolean isGzipped = fastaFile.getAbsolutePath().endsWith(".gz");
|
||||
if ( isGzipped ) {
|
||||
throw new UserException.CannotHandleGzippedRef();
|
||||
}
|
||||
|
||||
final File indexFile = new File(fastaFile.getAbsolutePath() + ".fai");
|
||||
|
||||
// determine the name for the dict file
|
||||
final String fastaExt = (fastaFile.getAbsolutePath().endsWith("fa") ? ".fa" : ".fasta" ) + (isGzipped ? ".gz" : "");
|
||||
final String fastaExt = fastaFile.getAbsolutePath().endsWith("fa") ? ".fa" : ".fasta";
|
||||
final File dictFile = new File(fastaFile.getAbsolutePath().replace(fastaExt, ".dict"));
|
||||
|
||||
/*
|
||||
* if index file does not exist, create it manually
|
||||
*/
|
||||
if (!indexFile.exists()) {
|
||||
if ( isGzipped ) throw new UserException.CouldNotCreateReferenceFAIorDictForGzippedRef(fastaFile);
|
||||
|
||||
logger.info(String.format("Index file %s does not exist. Trying to create it now.", indexFile.getAbsolutePath()));
|
||||
FSLockWithShared indexLock = new FSLockWithShared(indexFile,true);
|
||||
|
|
@ -115,7 +117,6 @@ public class ReferenceDataSource {
|
|||
* This has been filed in trac as (PIC-370) Want programmatic interface to CreateSequenceDictionary
|
||||
*/
|
||||
if (!dictFile.exists()) {
|
||||
if ( isGzipped ) throw new UserException.CouldNotCreateReferenceFAIorDictForGzippedRef(fastaFile);
|
||||
|
||||
logger.info(String.format("Dict file %s does not exist. Trying to create it now.", dictFile.getAbsolutePath()));
|
||||
|
||||
|
|
|
|||
|
|
@ -393,15 +393,10 @@ public class UserException extends ReviewedStingException {
|
|||
}
|
||||
}
|
||||
|
||||
public static class CouldNotCreateReferenceFAIorDictForGzippedRef extends UserException {
|
||||
public CouldNotCreateReferenceFAIorDictForGzippedRef(final File f) {
|
||||
super("Although the GATK can process .gz reference sequences, it currently cannot create FAI " +
|
||||
"or DICT files for them. In order to use the GATK with reference.fasta.gz you will need to " +
|
||||
"create .dict and .fai files for reference.fasta.gz and name them reference.fasta.gz.fai and " +
|
||||
"reference.dict. Potentially the easiest way to do this is to uncompress reference.fasta, " +
|
||||
"run the GATK to create the .dict and .fai files, and copy them to the appropriate location. " +
|
||||
"Sorry for the inconvenience.");
|
||||
}
|
||||
public static class CannotHandleGzippedRef extends UserException {
|
||||
public CannotHandleGzippedRef() {
|
||||
super("The GATK cannot process compressed (.gz) reference sequences. Please unzip the file and try again. Sorry for the inconvenience.");
|
||||
}
|
||||
}
|
||||
|
||||
public static class CouldNotCreateReferenceIndexFileBecauseOfLock extends UserException.CouldNotCreateReferenceIndexFile {
|
||||
|
|
|
|||
Loading…
Reference in New Issue