Penultimate step in exception system overhaul. UserError is now UserException. This class should be used for all communication with the USER for problems with their inputs. Engine now validates sequence dictionaries for compatibility, detecting not only lack of overlap but now inconsistent headers (b36 ref with v37 BAM, for example) as well as ref / bam order inconsistency. New -U option to allow users to tolerate dangerous seq dict issues. WalkerTest system now supports testing for exceptions (see email and wiki for docs). Tests for vcf and bam vs. ref incompatibility. Waiting on Tribble seq dict improvements to detect b36 VCF with b37 ref (currently cannot tell this is wrong.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4258 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
da2e879bbc
commit
40e6179911
|
|
@ -27,14 +27,12 @@ package net.sf.picard.reference;
|
||||||
|
|
||||||
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.ReferenceDataSourceProgressListener;
|
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.ReferenceDataSourceProgressListener;
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import static net.sf.picard.reference.FastaSequenceIndexBuilder.Status.*;
|
import static net.sf.picard.reference.FastaSequenceIndexBuilder.Status.*;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
import net.sf.picard.reference.FastaSequenceIndex;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds FastaSequenceIndex from fasta file.
|
* Builds FastaSequenceIndex from fasta file.
|
||||||
|
|
@ -85,7 +83,7 @@ public class FastaSequenceIndexBuilder {
|
||||||
in = new DataInputStream(new BufferedInputStream(new FileInputStream(fastaFile)));
|
in = new DataInputStream(new BufferedInputStream(new FileInputStream(fastaFile)));
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
throw new UserError.CouldNotReadInputFile(fastaFile, "Could not read fasta file", e);
|
throw new UserException.CouldNotReadInputFile(fastaFile, "Could not read fasta file", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -168,7 +166,7 @@ public class FastaSequenceIndexBuilder {
|
||||||
// validate base character
|
// validate base character
|
||||||
else {
|
else {
|
||||||
if (!isValidBase(currentByte))
|
if (!isValidBase(currentByte))
|
||||||
throw new UserError.MalformedFile(fastaFile, String.format("An invalid base was found in the contig: %s", contig));
|
throw new UserException.MalformedFile(fastaFile, String.format("An invalid base was found in the contig: %s", contig));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -194,7 +192,7 @@ public class FastaSequenceIndexBuilder {
|
||||||
// error if next char is a valid base, end of contig otherwise
|
// error if next char is a valid base, end of contig otherwise
|
||||||
else if (basesThisLine != basesPerLine || bytesPerLine != bytesRead - endOfLastLine) {
|
else if (basesThisLine != basesPerLine || bytesPerLine != bytesRead - endOfLastLine) {
|
||||||
if (isValidBase(nextByte) && nextByte != -1) {
|
if (isValidBase(nextByte) && nextByte != -1) {
|
||||||
throw new UserError.MalformedFile(fastaFile, String.format("An invalid line was found in the contig: %s", contig));
|
throw new UserException.MalformedFile(fastaFile, String.format("An invalid line was found in the contig: %s", contig));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
finishReadingContig(sequenceIndex);
|
finishReadingContig(sequenceIndex);
|
||||||
|
|
@ -206,7 +204,7 @@ public class FastaSequenceIndexBuilder {
|
||||||
// validate base character
|
// validate base character
|
||||||
else {
|
else {
|
||||||
if (!isValidBase(currentByte))
|
if (!isValidBase(currentByte))
|
||||||
throw new UserError.MalformedFile(fastaFile, String.format("An invalid base was found in the contig: %s", contig));
|
throw new UserException.MalformedFile(fastaFile, String.format("An invalid base was found in the contig: %s", contig));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -214,7 +212,7 @@ public class FastaSequenceIndexBuilder {
|
||||||
return sequenceIndex;
|
return sequenceIndex;
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(fastaFile, String.format("Could not read fasta file"), e);
|
throw new UserException.CouldNotReadInputFile(fastaFile, String.format("Could not read fasta file"), e);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
throw new GATKException(e.getMessage(), e);
|
throw new GATKException(e.getMessage(), e);
|
||||||
|
|
@ -273,7 +271,7 @@ public class FastaSequenceIndexBuilder {
|
||||||
out = new BufferedWriter(new FileWriter(faiFile));
|
out = new BufferedWriter(new FileWriter(faiFile));
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(faiFile, e);
|
throw new UserException.CouldNotCreateOutputFile(faiFile, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -284,7 +282,7 @@ public class FastaSequenceIndexBuilder {
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(faiFile, e);
|
throw new UserException.CouldNotCreateOutputFile(faiFile, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,12 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.commandline;
|
package org.broadinstitute.sting.commandline;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic class for handling misc parsing exceptions.
|
* Generic class for handling misc parsing exceptions.
|
||||||
*/
|
*/
|
||||||
public class ArgumentException extends UserError {
|
public class ArgumentException extends UserException {
|
||||||
public ArgumentException( String message ) {
|
public ArgumentException( String message ) {
|
||||||
super( message );
|
super( message );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,12 @@
|
||||||
package org.broadinstitute.sting.commandline;
|
package org.broadinstitute.sting.commandline;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.utils.classloader.JVMUtils;
|
import org.broadinstitute.sting.utils.classloader.JVMUtils;
|
||||||
import org.broadinstitute.sting.gatk.walkers.Multiplex;
|
import org.broadinstitute.sting.gatk.walkers.Multiplex;
|
||||||
import org.broadinstitute.sting.gatk.walkers.Multiplexer;
|
import org.broadinstitute.sting.gatk.walkers.Multiplexer;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.*;
|
import java.lang.reflect.*;
|
||||||
|
|
@ -222,7 +221,7 @@ public abstract class ArgumentTypeDescriptor {
|
||||||
protected String getArgumentValue( ArgumentDefinition definition, ArgumentMatches matches ) {
|
protected String getArgumentValue( ArgumentDefinition definition, ArgumentMatches matches ) {
|
||||||
Collection<String> argumentValues = getArgumentValues( definition, matches );
|
Collection<String> argumentValues = getArgumentValues( definition, matches );
|
||||||
if( argumentValues.size() > 1 )
|
if( argumentValues.size() > 1 )
|
||||||
throw new UserError.CommandLineError("Multiple values associated with given definition, but this argument expects only one: " + definition.fullName);
|
throw new UserException.CommandLineException("Multiple values associated with given definition, but this argument expects only one: " + definition.fullName);
|
||||||
return argumentValues.size() > 0 ? argumentValues.iterator().next() : null;
|
return argumentValues.size() > 0 ? argumentValues.iterator().next() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,14 +26,11 @@
|
||||||
package org.broadinstitute.sting.commandline;
|
package org.broadinstitute.sting.commandline;
|
||||||
|
|
||||||
import org.apache.log4j.*;
|
import org.apache.log4j.*;
|
||||||
import org.broadinstitute.sting.gatk.phonehome.GATKRunReport;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
import org.broadinstitute.sting.utils.help.ApplicationDetails;
|
import org.broadinstitute.sting.utils.help.ApplicationDetails;
|
||||||
import org.broadinstitute.sting.utils.help.HelpFormatter;
|
import org.broadinstitute.sting.utils.help.HelpFormatter;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintStream;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public abstract class CommandLineProgram {
|
public abstract class CommandLineProgram {
|
||||||
|
|
@ -253,12 +250,6 @@ public abstract class CommandLineProgram {
|
||||||
// Rethrow the exception to exit with an error.
|
// Rethrow the exception to exit with an error.
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
|
||||||
// we catch all exceptions here. if it makes it to this level, we're in trouble. Let's bail!
|
|
||||||
// TODO: what if the logger is the exception? hmm...
|
|
||||||
logger.fatal("\n");
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -376,7 +367,7 @@ public abstract class CommandLineProgram {
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void exitSystemWithUserError(UserError e) {
|
public static void exitSystemWithUserError(UserException e) {
|
||||||
errorPrintf("------------------------------------------------------------------------------------------%n");
|
errorPrintf("------------------------------------------------------------------------------------------%n");
|
||||||
errorPrintf("A USER ERROR has occurred. The invalid arguments or inputs must be corrected before the GATK can proceed%n");
|
errorPrintf("A USER ERROR has occurred. The invalid arguments or inputs must be corrected before the GATK can proceed%n");
|
||||||
errorPrintf("%n");
|
errorPrintf("%n");
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,10 @@
|
||||||
package org.broadinstitute.sting.commandline;
|
package org.broadinstitute.sting.commandline;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.utils.collections.Pair;
|
import org.broadinstitute.sting.utils.collections.Pair;
|
||||||
import org.broadinstitute.sting.utils.classloader.JVMUtils;
|
import org.broadinstitute.sting.utils.classloader.JVMUtils;
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
import org.broadinstitute.sting.utils.Utils;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.help.ApplicationDetails;
|
import org.broadinstitute.sting.utils.help.ApplicationDetails;
|
||||||
import org.broadinstitute.sting.utils.help.HelpFormatter;
|
import org.broadinstitute.sting.utils.help.HelpFormatter;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
@ -297,7 +296,7 @@ public class ParsingEngine {
|
||||||
if(definitions.size() < 1)
|
if(definitions.size() < 1)
|
||||||
throw new GATKException("Internal error. Argument source creates no definitions.");
|
throw new GATKException("Internal error. Argument source creates no definitions.");
|
||||||
ArgumentDefinition definition = definitions.get(0);
|
ArgumentDefinition definition = definitions.get(0);
|
||||||
throw new UserError.DeprecatedArgument(definition.fullName,definition.doc);
|
throw new UserException.DeprecatedArgument(definition.fullName,definition.doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,8 @@ public abstract class CommandLineExecutable extends CommandLineProgram {
|
||||||
*/
|
*/
|
||||||
protected int execute() throws Exception {
|
protected int execute() throws Exception {
|
||||||
Walker<?,?> mWalker = GATKEngine.getWalkerByName(getAnalysisName());
|
Walker<?,?> mWalker = GATKEngine.getWalkerByName(getAnalysisName());
|
||||||
|
|
||||||
|
try {
|
||||||
Collection<SamRecordFilter> filters = GATKEngine.createFiltersForWalker(getArgumentCollection(),mWalker);
|
Collection<SamRecordFilter> filters = GATKEngine.createFiltersForWalker(getArgumentCollection(),mWalker);
|
||||||
|
|
||||||
// load the arguments into the walker / filters.
|
// load the arguments into the walker / filters.
|
||||||
|
|
@ -80,7 +82,6 @@ public abstract class CommandLineExecutable extends CommandLineProgram {
|
||||||
loadArgumentsIntoObject(filter);
|
loadArgumentsIntoObject(filter);
|
||||||
|
|
||||||
// set the analysis name in the argument collection
|
// set the analysis name in the argument collection
|
||||||
try {
|
|
||||||
GATKResult = GATKEngine.execute(getArgumentCollection(), mWalker, filters);
|
GATKResult = GATKEngine.execute(getArgumentCollection(), mWalker, filters);
|
||||||
generateGATKRunReport(mWalker);
|
generateGATKRunReport(mWalker);
|
||||||
} catch ( Exception e ) {
|
} catch ( Exception e ) {
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,12 @@
|
||||||
package org.broadinstitute.sting.gatk;
|
package org.broadinstitute.sting.gatk;
|
||||||
|
|
||||||
import org.broadinstitute.sting.gatk.arguments.GATKArgumentCollection;
|
import org.broadinstitute.sting.gatk.arguments.GATKArgumentCollection;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.text.TextFormattingUtils;
|
import org.broadinstitute.sting.utils.text.TextFormattingUtils;
|
||||||
import org.broadinstitute.sting.utils.help.ApplicationDetails;
|
import org.broadinstitute.sting.utils.help.ApplicationDetails;
|
||||||
import org.broadinstitute.sting.commandline.*;
|
import org.broadinstitute.sting.commandline.*;
|
||||||
import org.broadinstitute.sting.gatk.walkers.Walker;
|
import org.broadinstitute.sting.gatk.walkers.Walker;
|
||||||
|
|
||||||
import java.io.PrintStream;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -92,7 +91,7 @@ public class CommandLineGATK extends CommandLineExecutable {
|
||||||
CommandLineGATK instance = new CommandLineGATK();
|
CommandLineGATK instance = new CommandLineGATK();
|
||||||
start(instance, argv);
|
start(instance, argv);
|
||||||
System.exit(CommandLineProgram.result); // todo -- this is a painful hack
|
System.exit(CommandLineProgram.result); // todo -- this is a painful hack
|
||||||
} catch (UserError e) {
|
} catch (UserException e) {
|
||||||
exitSystemWithUserError(e);
|
exitSystemWithUserError(e);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
exitSystemWithError(e);
|
exitSystemWithError(e);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package org.broadinstitute.sting.gatk;
|
package org.broadinstitute.sting.gatk;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes the method for downsampling reads at a given locus.
|
* Describes the method for downsampling reads at a given locus.
|
||||||
|
|
@ -36,15 +35,15 @@ public class DownsamplingMethod {
|
||||||
|
|
||||||
// Can't leave toFraction and toCoverage null unless type is experimental naive duplicate eliminator.
|
// Can't leave toFraction and toCoverage null unless type is experimental naive duplicate eliminator.
|
||||||
if(type != DownsampleType.NONE && toFraction == null && toCoverage == null)
|
if(type != DownsampleType.NONE && toFraction == null && toCoverage == null)
|
||||||
throw new UserError.CommandLineError("Must specify either toFraction or toCoverage when downsampling.");
|
throw new UserException.CommandLineException("Must specify either toFraction or toCoverage when downsampling.");
|
||||||
|
|
||||||
// Fraction and coverage cannot both be specified.
|
// Fraction and coverage cannot both be specified.
|
||||||
if(toFraction != null && toCoverage != null)
|
if(toFraction != null && toCoverage != null)
|
||||||
throw new UserError.CommandLineError("Downsampling coverage and fraction are both specified. Please choose only one.");
|
throw new UserException.CommandLineException("Downsampling coverage and fraction are both specified. Please choose only one.");
|
||||||
|
|
||||||
// Experimental by sample downsampling does not work with a fraction of reads.
|
// Experimental by sample downsampling does not work with a fraction of reads.
|
||||||
if(type == DownsampleType.BY_SAMPLE && toFraction != null)
|
if(type == DownsampleType.BY_SAMPLE && toFraction != null)
|
||||||
throw new UserError.CommandLineError("Cannot downsample to fraction with new EXPERIMENTAL_BY_SAMPLE method");
|
throw new UserException.CommandLineException("Cannot downsample to fraction with new EXPERIMENTAL_BY_SAMPLE method");
|
||||||
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.toCoverage = toCoverage;
|
this.toCoverage = toCoverage;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ import net.sf.samtools.*;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.broadinstitute.sting.gatk.arguments.GATKArgumentCollection;
|
import org.broadinstitute.sting.gatk.arguments.GATKArgumentCollection;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.helpers.DbSNPHelper;
|
import org.broadinstitute.sting.gatk.refdata.utils.helpers.DbSNPHelper;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.interval.IntervalMergingRule;
|
import org.broadinstitute.sting.utils.interval.IntervalMergingRule;
|
||||||
import org.broadinstitute.sting.utils.interval.IntervalUtils;
|
import org.broadinstitute.sting.utils.interval.IntervalUtils;
|
||||||
import org.broadinstitute.sting.gatk.arguments.ValidationExclusion;
|
import org.broadinstitute.sting.gatk.arguments.ValidationExclusion;
|
||||||
|
|
@ -267,7 +267,7 @@ public class GenomeAnalysisEngine {
|
||||||
|
|
||||||
// check to make sure we have a rod of that name
|
// check to make sure we have a rod of that name
|
||||||
if (!rodNames.containsKey(rodName))
|
if (!rodNames.containsKey(rodName))
|
||||||
throw new UserError.CommandLineError("--rodToIntervalTrackName (-BTI) was passed the name '"+rodName+"', which wasn't given as a ROD name in the -B option");
|
throw new UserException.CommandLineException("--rodToIntervalTrackName (-BTI) was passed the name '"+rodName+"', which wasn't given as a ROD name in the -B option");
|
||||||
|
|
||||||
for (String str : rodNames.keySet())
|
for (String str : rodNames.keySet())
|
||||||
if (str.equals(rodName)) {
|
if (str.equals(rodName)) {
|
||||||
|
|
@ -400,7 +400,7 @@ public class GenomeAnalysisEngine {
|
||||||
// Temporarily require all walkers to have a reference, even if that reference is not conceptually necessary.
|
// Temporarily require all walkers to have a reference, even if that reference is not conceptually necessary.
|
||||||
if ((my_walker instanceof ReadWalker || my_walker instanceof DuplicateWalker || my_walker instanceof ReadPairWalker) &&
|
if ((my_walker instanceof ReadWalker || my_walker instanceof DuplicateWalker || my_walker instanceof ReadPairWalker) &&
|
||||||
argCollection.referenceFile == null) {
|
argCollection.referenceFile == null) {
|
||||||
throw new UserError.CommandLineError("Read-based traversals require a reference file but none was given");
|
throw new UserException.CommandLineException("Read-based traversals require a reference file but none was given");
|
||||||
}
|
}
|
||||||
|
|
||||||
return MicroScheduler.create(this,my_walker,readsDataSource,referenceDataSource.getReference(),rodDataSources,argCollection.numberOfThreads);
|
return MicroScheduler.create(this,my_walker,readsDataSource,referenceDataSource.getReference(),rodDataSources,argCollection.numberOfThreads);
|
||||||
|
|
@ -661,11 +661,6 @@ public class GenomeAnalysisEngine {
|
||||||
// Compile a set of sequence names that exist in the reference file.
|
// Compile a set of sequence names that exist in the reference file.
|
||||||
SAMSequenceDictionary referenceDictionary = reference.getSequenceDictionary();
|
SAMSequenceDictionary referenceDictionary = reference.getSequenceDictionary();
|
||||||
|
|
||||||
Set<String> referenceSequenceNames = new TreeSet<String>();
|
|
||||||
for (SAMSequenceRecord dictionaryEntry : referenceDictionary.getSequences())
|
|
||||||
referenceSequenceNames.add(dictionaryEntry.getSequenceName());
|
|
||||||
|
|
||||||
|
|
||||||
if (!reads.isEmpty()) {
|
if (!reads.isEmpty()) {
|
||||||
// Compile a set of sequence names that exist in the BAM files.
|
// Compile a set of sequence names that exist in the BAM files.
|
||||||
SAMSequenceDictionary readsDictionary = reads.getHeader().getSequenceDictionary();
|
SAMSequenceDictionary readsDictionary = reads.getHeader().getSequenceDictionary();
|
||||||
|
|
@ -681,7 +676,7 @@ public class GenomeAnalysisEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
// compare the reads to the reference
|
// compare the reads to the reference
|
||||||
compareTwoDictionaries("reads", readsDictionary, readsSequenceNames, referenceDictionary, referenceSequenceNames);
|
SequenceDictionaryUtils.validateDictionaries(logger, "reads", readsDictionary, "reference", referenceDictionary);
|
||||||
}
|
}
|
||||||
|
|
||||||
// compare the tracks to the reference, if they have a sequence dictionary
|
// compare the tracks to the reference, if they have a sequence dictionary
|
||||||
|
|
@ -693,57 +688,15 @@ public class GenomeAnalysisEngine {
|
||||||
logger.info("Track " + track.getName() + " doesn't have a sequence dictionary built in, skipping dictionary validation");
|
logger.info("Track " + track.getName() + " doesn't have a sequence dictionary built in, skipping dictionary validation");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<String> trackSequences = new TreeSet<String>();
|
Set<String> trackSequences = new TreeSet<String>();
|
||||||
for (SAMSequenceRecord dictionaryEntry : trackDict.getSequences())
|
for (SAMSequenceRecord dictionaryEntry : trackDict.getSequences())
|
||||||
trackSequences.add(dictionaryEntry.getSequenceName());
|
trackSequences.add(dictionaryEntry.getSequenceName());
|
||||||
compareTwoDictionaries(track.getName(), trackDict, trackSequences, referenceDictionary, referenceSequenceNames);
|
SequenceDictionaryUtils.validateDictionaries(logger, track.getName(), trackDict, "reference", referenceDictionary);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* compare two dictionaries, warning if one isn't a subset of the other, or erroring out if they have no overlap
|
|
||||||
* @param compareToName the name of the track or bam (used in the output to the user)
|
|
||||||
* @param comparedToDictionary the dictionary to compare to
|
|
||||||
* @param compareToSequenceNames the unique sequence names in the compared to dictionary
|
|
||||||
* @param referenceDictionary the reference dictionary
|
|
||||||
* @param referenceSequenceNames the reference unique sequence names
|
|
||||||
*/
|
|
||||||
private void compareTwoDictionaries(String compareToName, SAMSequenceDictionary comparedToDictionary, Set<String> compareToSequenceNames, SAMSequenceDictionary referenceDictionary, Set<String> referenceSequenceNames) {
|
|
||||||
// If there's no overlap between reads and reference, data will be bogus. Throw an exception.
|
|
||||||
Set<String> intersectingSequenceNames = new HashSet<String>(compareToSequenceNames);
|
|
||||||
intersectingSequenceNames.retainAll(referenceSequenceNames);
|
|
||||||
if (intersectingSequenceNames.size() == 0) {
|
|
||||||
StringBuilder error = new StringBuilder();
|
|
||||||
error.append("No overlap exists between sequence dictionary of the " + compareToName + " and the sequence dictionary of the reference. Perhaps you're using the wrong reference?\n");
|
|
||||||
error.append(System.getProperty("line.separator"));
|
|
||||||
error.append(String.format(compareToName + " contigs: %s%n", prettyPrintSequenceRecords(comparedToDictionary)));
|
|
||||||
error.append(String.format("Reference contigs: %s%n", prettyPrintSequenceRecords(referenceDictionary)));
|
|
||||||
logger.error(error.toString());
|
|
||||||
throw new UserError.IncompatibleSequenceDictionaries(referenceDictionary, comparedToDictionary, compareToName);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the two datasets are not equal and neither is a strict subset of the other, warn the user.
|
|
||||||
if (!compareToSequenceNames.equals(referenceSequenceNames) &&
|
|
||||||
!compareToSequenceNames.containsAll(referenceSequenceNames) &&
|
|
||||||
!referenceSequenceNames.containsAll(compareToSequenceNames)) {
|
|
||||||
StringBuilder warning = new StringBuilder();
|
|
||||||
warning.append("Limited overlap exists between sequence dictionary of the " + compareToName + " and the sequence dictionary of the reference. Perhaps you're using the wrong reference?\n");
|
|
||||||
warning.append(System.getProperty("line.separator"));
|
|
||||||
warning.append(String.format(compareToName + " contigs: %s%n", prettyPrintSequenceRecords(comparedToDictionary)));
|
|
||||||
warning.append(String.format("Reference contigs: %s%n", prettyPrintSequenceRecords(referenceDictionary)));
|
|
||||||
logger.warn(warning.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String prettyPrintSequenceRecords(SAMSequenceDictionary sequenceDictionary) {
|
|
||||||
String[] sequenceRecordNames = new String[sequenceDictionary.size()];
|
|
||||||
int sequenceRecordIndex = 0;
|
|
||||||
for (SAMSequenceRecord sequenceRecord : sequenceDictionary.getSequences())
|
|
||||||
sequenceRecordNames[sequenceRecordIndex++] = sequenceRecord.getSequenceName();
|
|
||||||
return Arrays.deepToString(sequenceRecordNames);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience function that binds RODs using the old-style command line parser to the new style list for
|
* Convenience function that binds RODs using the old-style command line parser to the new style list for
|
||||||
|
|
@ -773,20 +726,20 @@ public class GenomeAnalysisEngine {
|
||||||
// sharding system; it's required with the new sharding system only for locus walkers.
|
// sharding system; it's required with the new sharding system only for locus walkers.
|
||||||
if(readsDataSource != null && !readsDataSource.hasIndex() ) {
|
if(readsDataSource != null && !readsDataSource.hasIndex() ) {
|
||||||
if(!exclusions.contains(ValidationExclusion.TYPE.ALLOW_UNINDEXED_BAM))
|
if(!exclusions.contains(ValidationExclusion.TYPE.ALLOW_UNINDEXED_BAM))
|
||||||
throw new UserError.CommandLineError("The GATK cannot currently process unindexed BAM files without the -U ALLOW_UNINDEXED_BAM");
|
throw new UserException.CommandLineException("The GATK cannot currently process unindexed BAM files without the -U ALLOW_UNINDEXED_BAM");
|
||||||
if(intervals != null && WalkerManager.getWalkerDataSource(walker) != DataSource.REFERENCE)
|
if(intervals != null && WalkerManager.getWalkerDataSource(walker) != DataSource.REFERENCE)
|
||||||
throw new UserError.CommandLineError("Cannot perform interval processing when walker is not driven by reference and no index is available.");
|
throw new UserException.CommandLineException("Cannot perform interval processing when walker is not driven by reference and no index is available.");
|
||||||
|
|
||||||
Shard.ShardType shardType;
|
Shard.ShardType shardType;
|
||||||
if(walker instanceof LocusWalker) {
|
if(walker instanceof LocusWalker) {
|
||||||
if (readsDataSource.getSortOrder() != SAMFileHeader.SortOrder.coordinate)
|
if (readsDataSource.getSortOrder() != SAMFileHeader.SortOrder.coordinate)
|
||||||
throw new UserError.MissortedBAM(SAMFileHeader.SortOrder.coordinate, "Locus walkers can only walk over coordinate-sorted data. Please resort your input BAM file(s).");
|
throw new UserException.MissortedBAM(SAMFileHeader.SortOrder.coordinate, "Locus walkers can only walk over coordinate-sorted data. Please resort your input BAM file(s).");
|
||||||
shardType = Shard.ShardType.LOCUS;
|
shardType = Shard.ShardType.LOCUS;
|
||||||
}
|
}
|
||||||
else if(walker instanceof ReadWalker || walker instanceof DuplicateWalker || walker instanceof ReadPairWalker)
|
else if(walker instanceof ReadWalker || walker instanceof DuplicateWalker || walker instanceof ReadPairWalker)
|
||||||
shardType = Shard.ShardType.READ;
|
shardType = Shard.ShardType.READ;
|
||||||
else
|
else
|
||||||
throw new UserError.CommandLineError("The GATK cannot currently process unindexed BAM files");
|
throw new UserException.CommandLineException("The GATK cannot currently process unindexed BAM files");
|
||||||
|
|
||||||
List<GenomeLoc> region;
|
List<GenomeLoc> region;
|
||||||
if(intervals != null)
|
if(intervals != null)
|
||||||
|
|
@ -810,7 +763,7 @@ public class GenomeAnalysisEngine {
|
||||||
|
|
||||||
if (intervals != null && !intervals.isEmpty()) {
|
if (intervals != null && !intervals.isEmpty()) {
|
||||||
if(!readsDataSource.isEmpty() && readsDataSource.getSortOrder() != SAMFileHeader.SortOrder.coordinate)
|
if(!readsDataSource.isEmpty() && readsDataSource.getSortOrder() != SAMFileHeader.SortOrder.coordinate)
|
||||||
throw new UserError.MissortedBAM(SAMFileHeader.SortOrder.coordinate, "Locus walkers can only walk over coordinate-sorted data. Please resort your input BAM file(s).");
|
throw new UserException.MissortedBAM(SAMFileHeader.SortOrder.coordinate, "Locus walkers can only walk over coordinate-sorted data. Please resort your input BAM file(s).");
|
||||||
|
|
||||||
shardStrategy = ShardStrategyFactory.shatter(readsDataSource,
|
shardStrategy = ShardStrategyFactory.shatter(readsDataSource,
|
||||||
referenceDataSource.getReference(),
|
referenceDataSource.getReference(),
|
||||||
|
|
@ -844,9 +797,9 @@ public class GenomeAnalysisEngine {
|
||||||
}
|
}
|
||||||
} else if (walker instanceof ReadPairWalker) {
|
} else if (walker instanceof ReadPairWalker) {
|
||||||
if(readsDataSource != null && readsDataSource.getSortOrder() != SAMFileHeader.SortOrder.queryname)
|
if(readsDataSource != null && readsDataSource.getSortOrder() != SAMFileHeader.SortOrder.queryname)
|
||||||
throw new UserError.MissortedBAM(SAMFileHeader.SortOrder.queryname, "Read pair walkers can only walk over query name-sorted data. Please resort your input BAM file.");
|
throw new UserException.MissortedBAM(SAMFileHeader.SortOrder.queryname, "Read pair walkers can only walk over query name-sorted data. Please resort your input BAM file.");
|
||||||
if(intervals != null && !intervals.isEmpty())
|
if(intervals != null && !intervals.isEmpty())
|
||||||
throw new UserError.CommandLineError("Pairs traversal cannot be used in conjunction with intervals.");
|
throw new UserException.CommandLineException("Pairs traversal cannot be used in conjunction with intervals.");
|
||||||
|
|
||||||
shardStrategy = ShardStrategyFactory.shatter(readsDataSource,
|
shardStrategy = ShardStrategyFactory.shatter(readsDataSource,
|
||||||
referenceDataSource.getReference(),
|
referenceDataSource.getReference(),
|
||||||
|
|
@ -996,7 +949,7 @@ public class GenomeAnalysisEngine {
|
||||||
unpackedReads.add(new SAMReaderID(new File(fileName),getTags(inputFile)));
|
unpackedReads.add(new SAMReaderID(new File(fileName),getTags(inputFile)));
|
||||||
}
|
}
|
||||||
catch( FileNotFoundException ex ) {
|
catch( FileNotFoundException ex ) {
|
||||||
throw new UserError.CouldNotReadInputFile(inputFile, "Unable to find file while unpacking reads", ex);
|
throw new UserException.CouldNotReadInputFile(inputFile, "Unable to find file while unpacking reads", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(inputFile.getName().toLowerCase().endsWith(".bam")) {
|
else if(inputFile.getName().toLowerCase().endsWith(".bam")) {
|
||||||
|
|
@ -1006,7 +959,7 @@ public class GenomeAnalysisEngine {
|
||||||
unpackedReads.add(new SAMReaderID(new File("/dev/stdin"),Collections.<String>emptyList()));
|
unpackedReads.add(new SAMReaderID(new File("/dev/stdin"),Collections.<String>emptyList()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new UserError.CommandLineError(String.format("The GATK reads argument (-I) supports only BAM files with the .bam extension and lists of BAM files " +
|
throw new UserException.CommandLineException(String.format("The GATK reads argument (-I) supports only BAM files with the .bam extension and lists of BAM files " +
|
||||||
"with the .list extension, but the file %s has neither extension. Please ensure that your BAM file or list " +
|
"with the .list extension, but the file %s has neither extension. Please ensure that your BAM file or list " +
|
||||||
"of BAM files is in the correct format, update the extension, and try again.",inputFile.getName()));
|
"of BAM files is in the correct format, update the extension, and try again.",inputFile.getName()));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ public class ValidationExclusion {
|
||||||
ALLOW_EMPTY_INTERVAL_LIST, // allow the user to pass in an empty interval list
|
ALLOW_EMPTY_INTERVAL_LIST, // allow the user to pass in an empty interval list
|
||||||
ALLOW_UNSET_BAM_SORT_ORDER, // assume that the bam is sorted, even if the SO (sort-order) flag is not set
|
ALLOW_UNSET_BAM_SORT_ORDER, // assume that the bam is sorted, even if the SO (sort-order) flag is not set
|
||||||
NO_READ_ORDER_VERIFICATION, // do not validate that the reads are in order as we take them from the bam file
|
NO_READ_ORDER_VERIFICATION, // do not validate that the reads are in order as we take them from the bam file
|
||||||
|
ALLOW_SEQ_DICT_INCOMPATIBILITY, // allow dangerous, but not fatal, sequence dictionary incompabilities
|
||||||
@EnumerationArgumentDefault // set the ALL value to the default value, so if they specify just -U, we get the ALL
|
@EnumerationArgumentDefault // set the ALL value to the default value, so if they specify just -U, we get the ALL
|
||||||
ALL // do not check for all of the above conditions, DEFAULT
|
ALL // do not check for all of the above conditions, DEFAULT
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,9 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.gatk.contexts;
|
package org.broadinstitute.sting.gatk.contexts;
|
||||||
|
|
||||||
import net.sf.samtools.SAMRecord;
|
|
||||||
import net.sf.samtools.SAMReadGroupRecord;
|
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
import org.broadinstitute.sting.utils.pileup.*;
|
import org.broadinstitute.sting.utils.pileup.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -116,7 +113,7 @@ public class StratifiedAlignmentContext<RBP extends ReadBackedPileup> {
|
||||||
contexts.put(sampleName,new StratifiedAlignmentContext<RBP>(loc,pileupBySample));
|
contexts.put(sampleName,new StratifiedAlignmentContext<RBP>(loc,pileupBySample));
|
||||||
else {
|
else {
|
||||||
if(assumedSingleSample == null) {
|
if(assumedSingleSample == null) {
|
||||||
throw new UserError.MalformedBam(pileupBySample.iterator().next().getRead(), "Missing read group for read");
|
throw new UserException.MalformedBam(pileupBySample.iterator().next().getRead(), "Missing read group for read");
|
||||||
}
|
}
|
||||||
contexts.put(assumedSingleSample,new StratifiedAlignmentContext<RBP>(loc,pileupBySample));
|
contexts.put(assumedSingleSample,new StratifiedAlignmentContext<RBP>(loc,pileupBySample));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ import org.broad.tribble.util.popgen.HardyWeinbergCalculation;
|
||||||
import org.broad.tribble.util.variantcontext.*;
|
import org.broad.tribble.util.variantcontext.*;
|
||||||
import org.broadinstitute.sting.utils.*;
|
import org.broadinstitute.sting.utils.*;
|
||||||
import org.broad.tribble.vcf.VCFConstants;
|
import org.broad.tribble.vcf.VCFConstants;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
|
|
||||||
public class VariantContextUtils {
|
public class VariantContextUtils {
|
||||||
final public static JexlEngine engine = new JexlEngine();
|
final public static JexlEngine engine = new JexlEngine();
|
||||||
|
|
@ -113,7 +113,7 @@ public class VariantContextUtils {
|
||||||
throw new GATKException("BUG: neither names nor exps can be null: names " + Arrays.toString(names) + " exps=" + Arrays.toString(exps) );
|
throw new GATKException("BUG: neither names nor exps can be null: names " + Arrays.toString(names) + " exps=" + Arrays.toString(exps) );
|
||||||
|
|
||||||
if ( names.length != exps.length )
|
if ( names.length != exps.length )
|
||||||
throw new UserError("Inconsistent number of provided filter names and expressions: names=" + Arrays.toString(names) + " exps=" + Arrays.toString(exps));
|
throw new UserException("Inconsistent number of provided filter names and expressions: names=" + Arrays.toString(names) + " exps=" + Arrays.toString(exps));
|
||||||
|
|
||||||
Map<String, String> map = new HashMap<String, String>();
|
Map<String, String> map = new HashMap<String, String>();
|
||||||
for ( int i = 0; i < names.length; i++ ) { map.put(names[i], exps[i]); }
|
for ( int i = 0; i < names.length; i++ ) { map.put(names[i], exps[i]); }
|
||||||
|
|
@ -149,7 +149,7 @@ public class VariantContextUtils {
|
||||||
Expression exp = engine.createExpression(expStr);
|
Expression exp = engine.createExpression(expStr);
|
||||||
exps.add(new JexlVCMatchExp(name, exp));
|
exps.add(new JexlVCMatchExp(name, exp));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new UserError.BadArgumentValue(name, "Invalid expression used (" + expStr + "). Please see the JEXL docs for correct syntax.") ;
|
throw new UserException.BadArgumentValue(name, "Invalid expression used (" + expStr + "). Please see the JEXL docs for correct syntax.") ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -433,7 +433,7 @@ public class VariantContextUtils {
|
||||||
for ( String name : vc.getSampleNames() ) {
|
for ( String name : vc.getSampleNames() ) {
|
||||||
//System.out.printf("Checking %s %b%n", name, names.contains(name));
|
//System.out.printf("Checking %s %b%n", name, names.contains(name));
|
||||||
if ( names.contains(name) )
|
if ( names.contains(name) )
|
||||||
throw new UserError("REQUIRE_UNIQUE sample names is true but duplicate names were discovered " + name);
|
throw new UserException("REQUIRE_UNIQUE sample names is true but duplicate names were discovered " + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
names.addAll(vc.getSampleNames());
|
names.addAll(vc.getSampleNames());
|
||||||
|
|
@ -642,7 +642,7 @@ public class VariantContextUtils {
|
||||||
|
|
||||||
private int getIndex(VariantContext vc) {
|
private int getIndex(VariantContext vc) {
|
||||||
int i = priorityListOfVCs.indexOf(vc.getName());
|
int i = priorityListOfVCs.indexOf(vc.getName());
|
||||||
if ( i == -1 ) throw new UserError.BadArgumentValue(Utils.join(",", priorityListOfVCs), "Priority list " + priorityListOfVCs + " doesn't contain variant context " + vc.getName());
|
if ( i == -1 ) throw new UserException.BadArgumentValue(Utils.join(",", priorityListOfVCs), "Priority list " + priorityListOfVCs + " doesn't contain variant context " + vc.getName());
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,9 @@ import org.apache.commons.jexl2.JexlContext;
|
||||||
import org.apache.commons.jexl2.MapContext;
|
import org.apache.commons.jexl2.MapContext;
|
||||||
import org.broad.tribble.util.variantcontext.Genotype;
|
import org.broad.tribble.util.variantcontext.Genotype;
|
||||||
import org.broad.tribble.util.variantcontext.VariantContext;
|
import org.broad.tribble.util.variantcontext.VariantContext;
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
import org.broadinstitute.sting.utils.Utils;
|
||||||
import org.broad.tribble.vcf.VCFConstants;
|
import org.broad.tribble.vcf.VCFConstants;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
@ -274,7 +272,7 @@ class JEXLMap implements Map<VariantContextUtils.JexlVCMatchExp, Boolean> {
|
||||||
try {
|
try {
|
||||||
jexl.put (exp, (Boolean) exp.exp.evaluate(jContext));
|
jexl.put (exp, (Boolean) exp.exp.evaluate(jContext));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new UserError.CommandLineError(String.format("Invalid JEXL expression detected for %s with message %s", exp.name, e.getMessage()));
|
throw new UserException.CommandLineException(String.format("Invalid JEXL expression detected for %s with message %s", exp.name, e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,12 +26,11 @@
|
||||||
package org.broadinstitute.sting.gatk.datasources.simpleDataSources;
|
package org.broadinstitute.sting.gatk.datasources.simpleDataSources;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import net.sf.picard.reference.FastaSequenceIndexBuilder;
|
import net.sf.picard.reference.FastaSequenceIndexBuilder;
|
||||||
import net.sf.picard.sam.CreateSequenceDictionary;
|
import net.sf.picard.sam.CreateSequenceDictionary;
|
||||||
import net.sf.picard.reference.IndexedFastaSequenceFile;
|
import net.sf.picard.reference.IndexedFastaSequenceFile;
|
||||||
import net.sf.picard.reference.FastaSequenceIndex;
|
import net.sf.picard.reference.FastaSequenceIndex;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.file.FSLockWithShared;
|
import org.broadinstitute.sting.utils.file.FSLockWithShared;
|
||||||
import org.broadinstitute.sting.utils.file.FileSystemInabilityToLockException;
|
import org.broadinstitute.sting.utils.file.FileSystemInabilityToLockException;
|
||||||
|
|
||||||
|
|
@ -172,7 +171,7 @@ public class ReferenceDataSource implements ReferenceDataSourceProgressListener
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
throw new UserError.CouldNotReadInputFile(fastaFile, e);
|
throw new UserException.CouldNotReadInputFile(fastaFile, e);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
dictLock.unlock();
|
dictLock.unlock();
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,7 @@ import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||||
import org.broadinstitute.sting.gatk.walkers.Walker;
|
import org.broadinstitute.sting.gatk.walkers.Walker;
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -225,7 +224,7 @@ class ReferenceOrderedQueryDataPool extends ResourcePool<FeatureSource, Location
|
||||||
try {
|
try {
|
||||||
resource.close();
|
resource.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotReadInputFile("Unable to close reader for rod named " + rod.getName(),e);
|
throw new UserException.CouldNotReadInputFile("Unable to close reader for rod named " + rod.getName(),e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,7 @@ import org.broadinstitute.sting.gatk.ReadMetrics;
|
||||||
import org.broadinstitute.sting.gatk.arguments.ValidationExclusion;
|
import org.broadinstitute.sting.gatk.arguments.ValidationExclusion;
|
||||||
import org.broadinstitute.sting.gatk.filters.CountingFilteringIterator;
|
import org.broadinstitute.sting.gatk.filters.CountingFilteringIterator;
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -128,7 +127,7 @@ public class SAMDataSource implements SimpleDataSource {
|
||||||
|
|
||||||
// Validate that all input files are sorted in the same order.
|
// Validate that all input files are sorted in the same order.
|
||||||
if(this.sortOrder != null && this.sortOrder != sortOrder)
|
if(this.sortOrder != null && this.sortOrder != sortOrder)
|
||||||
throw new UserError.MissortedBAM(String.format("Attempted to process mixed of files sorted as %s and %s.",this.sortOrder,sortOrder));
|
throw new UserException.MissortedBAM(String.format("Attempted to process mixed of files sorted as %s and %s.",this.sortOrder,sortOrder));
|
||||||
|
|
||||||
// Update the sort order.
|
// Update the sort order.
|
||||||
this.sortOrder = sortOrder;
|
this.sortOrder = sortOrder;
|
||||||
|
|
|
||||||
|
|
@ -39,13 +39,11 @@ import org.broadinstitute.sting.gatk.iterators.NullSAMIterator;
|
||||||
import org.broadinstitute.sting.gatk.ReadProperties;
|
import org.broadinstitute.sting.gatk.ReadProperties;
|
||||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||||
import org.broadinstitute.sting.gatk.ReadMetrics;
|
import org.broadinstitute.sting.gatk.ReadMetrics;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import net.sf.picard.reference.IndexedFastaSequenceFile;
|
import net.sf.picard.reference.IndexedFastaSequenceFile;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -86,14 +84,14 @@ public abstract class MicroScheduler {
|
||||||
public static MicroScheduler create(GenomeAnalysisEngine engine, Walker walker, SAMDataSource reads, IndexedFastaSequenceFile reference, Collection<ReferenceOrderedDataSource> rods, int nThreadsToUse) {
|
public static MicroScheduler create(GenomeAnalysisEngine engine, Walker walker, SAMDataSource reads, IndexedFastaSequenceFile reference, Collection<ReferenceOrderedDataSource> rods, int nThreadsToUse) {
|
||||||
if (walker instanceof TreeReducible && nThreadsToUse > 1) {
|
if (walker instanceof TreeReducible && nThreadsToUse > 1) {
|
||||||
if(walker.isReduceByInterval())
|
if(walker.isReduceByInterval())
|
||||||
throw new UserError.BadArgumentValue("nt", String.format("The analysis %s aggregates results by interval. Due to a current limitation of the GATK, analyses of this type do not currently support parallel execution. Please run your analysis without the -nt option.", engine.getWalkerName(walker.getClass())));
|
throw new UserException.BadArgumentValue("nt", String.format("The analysis %s aggregates results by interval. Due to a current limitation of the GATK, analyses of this type do not currently support parallel execution. Please run your analysis without the -nt option.", engine.getWalkerName(walker.getClass())));
|
||||||
if(walker instanceof ReadWalker)
|
if(walker instanceof ReadWalker)
|
||||||
throw new UserError.BadArgumentValue("nt", String.format("The analysis %s is a read walker. Due to a current limitation of the GATK, analyses of this type do not currently support parallel execution. Please run your analysis without the -nt option.", engine.getWalkerName(walker.getClass())));
|
throw new UserException.BadArgumentValue("nt", String.format("The analysis %s is a read walker. Due to a current limitation of the GATK, analyses of this type do not currently support parallel execution. Please run your analysis without the -nt option.", engine.getWalkerName(walker.getClass())));
|
||||||
logger.info(String.format("Running the GATK in parallel mode with %d concurrent threads",nThreadsToUse));
|
logger.info(String.format("Running the GATK in parallel mode with %d concurrent threads",nThreadsToUse));
|
||||||
return new HierarchicalMicroScheduler(engine, walker, reads, reference, rods, nThreadsToUse);
|
return new HierarchicalMicroScheduler(engine, walker, reads, reference, rods, nThreadsToUse);
|
||||||
} else {
|
} else {
|
||||||
if(nThreadsToUse > 1)
|
if(nThreadsToUse > 1)
|
||||||
throw new UserError.BadArgumentValue("nt", String.format("The analysis %s currently does not support parallel execution. Please run your analysis without the -nt option.", engine.getWalkerName(walker.getClass())));
|
throw new UserException.BadArgumentValue("nt", String.format("The analysis %s currently does not support parallel execution. Please run your analysis without the -nt option.", engine.getWalkerName(walker.getClass())));
|
||||||
return new LinearMicroScheduler(engine, walker, reads, reference, rods);
|
return new LinearMicroScheduler(engine, walker, reads, reference, rods);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,7 @@ import net.sf.samtools.SAMReadGroupRecord;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by IntelliJ IDEA.
|
* Created by IntelliJ IDEA.
|
||||||
|
|
@ -30,7 +29,7 @@ public class PlatformUnitFilter implements SamRecordFilter {
|
||||||
if ( pu_attr == null ) {
|
if ( pu_attr == null ) {
|
||||||
// no platform unit in the record, go get from read group
|
// no platform unit in the record, go get from read group
|
||||||
SAMReadGroupRecord rgr = samRecord.getReadGroup();
|
SAMReadGroupRecord rgr = samRecord.getReadGroup();
|
||||||
if ( rgr == null ) throw new UserError.MalformedBam(samRecord, "Read " + samRecord.getReadName() +" has NO associated read group record");
|
if ( rgr == null ) throw new UserException.MalformedBam(samRecord, "Read " + samRecord.getReadName() +" has NO associated read group record");
|
||||||
pu_attr = rgr.getAttribute("PU") ;
|
pu_attr = rgr.getAttribute("PU") ;
|
||||||
}
|
}
|
||||||
if ( pu_attr == null ) return false; // could not get PU, forget about the filtering...
|
if ( pu_attr == null ) return false; // could not get PU, forget about the filtering...
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,8 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.gatk.filters;
|
package org.broadinstitute.sting.gatk.filters;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.text.XReadLines;
|
import org.broadinstitute.sting.utils.text.XReadLines;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
|
@ -76,7 +75,7 @@ public class PlatformUnitFilterHelper {
|
||||||
if ( EMPTYLINE_PATTERN.matcher(line).matches() ) continue; // skip empty lines
|
if ( EMPTYLINE_PATTERN.matcher(line).matches() ) continue; // skip empty lines
|
||||||
PlatformUnitFilter.addBlackListedLane(line); // PlatformUnitFilter will trim the line as needed
|
PlatformUnitFilter.addBlackListedLane(line); // PlatformUnitFilter will trim the line as needed
|
||||||
}
|
}
|
||||||
} catch ( FileNotFoundException e) { throw new UserError.CouldNotReadInputFile(f, e); } // this should NEVER happen
|
} catch ( FileNotFoundException e) { throw new UserException.CouldNotReadInputFile(f, e); } // this should NEVER happen
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,7 @@ import java.io.FileNotFoundException;
|
||||||
import net.sf.picard.filter.SamRecordFilter;
|
import net.sf.picard.filter.SamRecordFilter;
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
import net.sf.samtools.SAMReadGroupRecord;
|
import net.sf.samtools.SAMReadGroupRecord;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
import org.broadinstitute.sting.utils.text.XReadLines;
|
import org.broadinstitute.sting.utils.text.XReadLines;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -94,7 +93,7 @@ public class ReadGroupBlackListFilter implements SamRecordFilter {
|
||||||
if (parentFile != null) {
|
if (parentFile != null) {
|
||||||
message += ", " + parentFile.getAbsolutePath() + ":" + parentLineNum;
|
message += ", " + parentFile.getAbsolutePath() + ":" + parentLineNum;
|
||||||
}
|
}
|
||||||
throw new UserError(message);
|
throw new UserException(message);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String[] filterEntry = filter.split(":", 2);
|
String[] filterEntry = filter.split(":", 2);
|
||||||
|
|
@ -111,7 +110,7 @@ public class ReadGroupBlackListFilter implements SamRecordFilter {
|
||||||
message += ", " + parentFile.getAbsolutePath() + ":" + parentLineNum;
|
message += ", " + parentFile.getAbsolutePath() + ":" + parentLineNum;
|
||||||
}
|
}
|
||||||
message += ", format is <TAG>:<SUBSTRING>";
|
message += ", format is <TAG>:<SUBSTRING>";
|
||||||
throw new UserError(message);
|
throw new UserException(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!filters.containsKey(filterEntry[0]))
|
if (!filters.containsKey(filterEntry[0]))
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,7 @@ import org.broadinstitute.sting.gatk.io.stubs.Stub;
|
||||||
import org.broadinstitute.sting.gatk.io.storage.StorageFactory;
|
import org.broadinstitute.sting.gatk.io.storage.StorageFactory;
|
||||||
import org.broadinstitute.sting.gatk.io.storage.Storage;
|
import org.broadinstitute.sting.gatk.io.storage.Storage;
|
||||||
import org.broadinstitute.sting.gatk.executive.OutputMergeTask;
|
import org.broadinstitute.sting.gatk.executive.OutputMergeTask;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
@ -122,7 +121,7 @@ public class ThreadLocalOutputTracker extends OutputTracker {
|
||||||
tempFile.deleteOnExit();
|
tempFile.deleteOnExit();
|
||||||
}
|
}
|
||||||
catch( IOException ex ) {
|
catch( IOException ex ) {
|
||||||
throw new UserError.BadTmpDir("Unable to create temporary file for stub: " + stub.getClass().getName() );
|
throw new UserException.BadTmpDir("Unable to create temporary file for stub: " + stub.getClass().getName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return tempFile;
|
return tempFile;
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,8 @@
|
||||||
package org.broadinstitute.sting.gatk.io.storage;
|
package org.broadinstitute.sting.gatk.io.storage;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.gatk.io.stubs.OutputStreamStub;
|
import org.broadinstitute.sting.gatk.io.stubs.OutputStreamStub;
|
||||||
import org.broadinstitute.sting.gatk.io.storage.Storage;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.channels.FileChannel;
|
import java.nio.channels.FileChannel;
|
||||||
|
|
@ -74,7 +72,7 @@ public class OutputStreamStorage extends OutputStream implements Storage<OutputS
|
||||||
return new FileOutputStream( file );
|
return new FileOutputStream( file );
|
||||||
}
|
}
|
||||||
catch(FileNotFoundException ex) {
|
catch(FileNotFoundException ex) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(file, "Unable to open output stream for file", ex);
|
throw new UserException.CouldNotCreateOutputFile(file, "Unable to open output stream for file", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -98,7 +96,7 @@ public class OutputStreamStorage extends OutputStream implements Storage<OutputS
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
}
|
}
|
||||||
catch( IOException ex ) {
|
catch( IOException ex ) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(file, "Unable to close output stream", ex );
|
throw new UserException.CouldNotCreateOutputFile(file, "Unable to close output stream", ex );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -137,10 +135,10 @@ public class OutputStreamStorage extends OutputStream implements Storage<OutputS
|
||||||
file.delete();
|
file.delete();
|
||||||
}
|
}
|
||||||
catch( FileNotFoundException ex ) {
|
catch( FileNotFoundException ex ) {
|
||||||
throw new UserError.CouldNotReadInputFile(file, "Unable to open input stream for file", ex);
|
throw new UserException.CouldNotReadInputFile(file, "Unable to open input stream for file", ex);
|
||||||
}
|
}
|
||||||
catch( IOException ex ) {
|
catch( IOException ex ) {
|
||||||
throw new UserError.CouldNotReadInputFile(file, "Unable to transfer contents of file", ex);
|
throw new UserException.CouldNotReadInputFile(file, "Unable to transfer contents of file", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,7 @@ import net.sf.samtools.util.CloseableIterator;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
import org.broadinstitute.sting.gatk.io.stubs.SAMFileWriterStub;
|
import org.broadinstitute.sting.gatk.io.stubs.SAMFileWriterStub;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides temporary storage for SAMFileWriters.
|
* Provides temporary storage for SAMFileWriters.
|
||||||
|
|
@ -73,7 +72,7 @@ public class SAMFileWriterStorage implements SAMFileWriter, Storage<SAMFileWrite
|
||||||
this.writer = factory.makeSAMWriter( stub.getFileHeader(), stub.isPresorted(), stub.getSAMOutputStream());
|
this.writer = factory.makeSAMWriter( stub.getFileHeader(), stub.isPresorted(), stub.getSAMOutputStream());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw new UserError("Unable to write to SAM file; neither a target file nor a stream has been specified");
|
throw new UserException("Unable to write to SAM file; neither a target file nor a stream has been specified");
|
||||||
}
|
}
|
||||||
|
|
||||||
public SAMFileHeader getFileHeader() {
|
public SAMFileHeader getFileHeader() {
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,12 @@ import org.broad.tribble.vcf.VCFHeaderLine;
|
||||||
import org.broad.tribble.util.variantcontext.VariantContext;
|
import org.broad.tribble.util.variantcontext.VariantContext;
|
||||||
import org.broad.tribble.vcf.VCFWriter;
|
import org.broad.tribble.vcf.VCFWriter;
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.gatk.io.stubs.VCFWriterStub;
|
import org.broadinstitute.sting.gatk.io.stubs.VCFWriterStub;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
import net.sf.samtools.util.BlockCompressedOutputStream;
|
import net.sf.samtools.util.BlockCompressedOutputStream;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides temporary and permanent storage for genotypes in VCF format.
|
* Provides temporary and permanent storage for genotypes in VCF format.
|
||||||
|
|
@ -41,7 +40,7 @@ public class VCFWriterStorage implements Storage<VCFWriterStorage>, VCFWriter {
|
||||||
stream = new PrintStream(file);
|
stream = new PrintStream(file);
|
||||||
}
|
}
|
||||||
catch(IOException ex) {
|
catch(IOException ex) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(file, "Unable to open target output stream", ex);
|
throw new UserException.CouldNotCreateOutputFile(file, "Unable to open target output stream", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( stub.getOutputStream() != null ) {
|
else if ( stub.getOutputStream() != null ) {
|
||||||
|
|
@ -65,7 +64,7 @@ public class VCFWriterStorage implements Storage<VCFWriterStorage>, VCFWriter {
|
||||||
this.stream = new PrintStream(file);
|
this.stream = new PrintStream(file);
|
||||||
}
|
}
|
||||||
catch(IOException ex) {
|
catch(IOException ex) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(file, "Unable to open target output stream",ex);
|
throw new UserException.CouldNotCreateOutputFile(file, "Unable to open target output stream",ex);
|
||||||
}
|
}
|
||||||
writer = new StandardVCFWriter(this.stream);
|
writer = new StandardVCFWriter(this.stream);
|
||||||
writer.writeHeader(stub.getVCFHeader());
|
writer.writeHeader(stub.getVCFHeader());
|
||||||
|
|
@ -108,7 +107,7 @@ public class VCFWriterStorage implements Storage<VCFWriterStorage>, VCFWriter {
|
||||||
|
|
||||||
reader.close();
|
reader.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(file, "Error reading file in VCFWriterStorage: ", e);
|
throw new UserException.CouldNotReadInputFile(file, "Error reading file in VCFWriterStorage: ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,14 +28,12 @@ import org.broadinstitute.sting.commandline.ArgumentTypeDescriptor;
|
||||||
import org.broadinstitute.sting.commandline.ArgumentSource;
|
import org.broadinstitute.sting.commandline.ArgumentSource;
|
||||||
import org.broadinstitute.sting.commandline.ArgumentMatches;
|
import org.broadinstitute.sting.commandline.ArgumentMatches;
|
||||||
import org.broadinstitute.sting.commandline.ParsingEngine;
|
import org.broadinstitute.sting.commandline.ParsingEngine;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.sam.SAMFileReaderBuilder;
|
import org.broadinstitute.sting.utils.sam.SAMFileReaderBuilder;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||||
import net.sf.samtools.SAMFileReader;
|
import net.sf.samtools.SAMFileReader;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.OutputStream;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describe how to parse SAMFileReaders.
|
* Describe how to parse SAMFileReaders.
|
||||||
|
|
@ -67,7 +65,7 @@ public class SAMFileReaderArgumentTypeDescriptor extends ArgumentTypeDescriptor
|
||||||
String readerFileName = getArgumentValue( createDefaultArgumentDefinition(source), matches );
|
String readerFileName = getArgumentValue( createDefaultArgumentDefinition(source), matches );
|
||||||
|
|
||||||
if( readerFileName == null )
|
if( readerFileName == null )
|
||||||
throw new UserError.CommandLineError("SAM file compression was supplied, but no associated writer was supplied with it.");
|
throw new UserException.CommandLineException("SAM file compression was supplied, but no associated writer was supplied with it.");
|
||||||
|
|
||||||
builder.setSAMFile(new File(readerFileName));
|
builder.setSAMFile(new File(readerFileName));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,10 @@
|
||||||
package org.broadinstitute.sting.gatk.io.stubs;
|
package org.broadinstitute.sting.gatk.io.stubs;
|
||||||
|
|
||||||
import org.broadinstitute.sting.commandline.*;
|
import org.broadinstitute.sting.commandline.*;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||||
import org.broadinstitute.sting.gatk.io.StingSAMFileWriter;
|
import org.broadinstitute.sting.gatk.io.StingSAMFileWriter;
|
||||||
import net.sf.samtools.SAMFileWriter;
|
import net.sf.samtools.SAMFileWriter;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -98,7 +97,7 @@ public class SAMFileWriterArgumentTypeDescriptor extends ArgumentTypeDescriptor
|
||||||
public Object parse( ParsingEngine parsingEngine, ArgumentSource source, Class type, ArgumentMatches matches ) {
|
public Object parse( ParsingEngine parsingEngine, ArgumentSource source, Class type, ArgumentMatches matches ) {
|
||||||
String writerFileName = getArgumentValue( createBAMArgumentDefinition(source), matches );
|
String writerFileName = getArgumentValue( createBAMArgumentDefinition(source), matches );
|
||||||
if( writerFileName == null )
|
if( writerFileName == null )
|
||||||
throw new UserError.CommandLineError("SAM file compression was supplied, but no associated writer was supplied with it.");
|
throw new UserException.CommandLineException("SAM file compression was supplied, but no associated writer was supplied with it.");
|
||||||
|
|
||||||
SAMFileWriterStub stub = new SAMFileWriterStub(engine, new File(writerFileName));
|
SAMFileWriterStub stub = new SAMFileWriterStub(engine, new File(writerFileName));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,7 @@ import org.broadinstitute.sting.gatk.io.OutputTracker;
|
||||||
import org.broadinstitute.sting.gatk.io.StingSAMFileWriter;
|
import org.broadinstitute.sting.gatk.io.StingSAMFileWriter;
|
||||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A stub for routing and management of SAM file reading and writing.
|
* A stub for routing and management of SAM file reading and writing.
|
||||||
|
|
@ -175,7 +174,7 @@ public class SAMFileWriterStub implements Stub<SAMFileWriter>, StingSAMFileWrite
|
||||||
*/
|
*/
|
||||||
public void setIndexOnTheFly( boolean indexOnTheFly ) {
|
public void setIndexOnTheFly( boolean indexOnTheFly ) {
|
||||||
if(writeStarted)
|
if(writeStarted)
|
||||||
throw new UserError("Attempted to index a BAM on the fly of a file with alignments already in it.");
|
throw new UserException("Attempted to index a BAM on the fly of a file with alignments already in it.");
|
||||||
this.indexOnTheFly = indexOnTheFly;
|
this.indexOnTheFly = indexOnTheFly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ import org.broadinstitute.sting.gatk.DownsamplingMethod;
|
||||||
import org.broadinstitute.sting.gatk.DownsampleType;
|
import org.broadinstitute.sting.gatk.DownsampleType;
|
||||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||||
import org.broadinstitute.sting.utils.*;
|
import org.broadinstitute.sting.utils.*;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.pileup.*;
|
import org.broadinstitute.sting.utils.pileup.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -198,7 +198,7 @@ public class LocusIteratorByState extends LocusIterator {
|
||||||
if ( generateExtendedEvents ) {
|
if ( generateExtendedEvents ) {
|
||||||
// we see insertions only once, when we step right onto them; the position on the read is scrolled
|
// we see insertions only once, when we step right onto them; the position on the read is scrolled
|
||||||
// past the insertion right after that
|
// past the insertion right after that
|
||||||
if ( eventDelayedFlag > 1 ) throw new UserError.MalformedBam(read, "Adjacent I/D events in read "+read.getReadName());
|
if ( eventDelayedFlag > 1 ) throw new UserException.MalformedBam(read, "Adjacent I/D events in read "+read.getReadName());
|
||||||
insertedBases = Arrays.copyOfRange(read.getReadBases(),readOffset+1,readOffset+1+curElement.getLength());
|
insertedBases = Arrays.copyOfRange(read.getReadBases(),readOffset+1,readOffset+1+curElement.getLength());
|
||||||
eventLength = curElement.getLength() ;
|
eventLength = curElement.getLength() ;
|
||||||
eventStart = readOffset;
|
eventStart = readOffset;
|
||||||
|
|
@ -214,7 +214,7 @@ public class LocusIteratorByState extends LocusIterator {
|
||||||
if ( cigarElementCounter == 1) {
|
if ( cigarElementCounter == 1) {
|
||||||
// generate an extended event only if we just stepped into the deletion (i.e. don't
|
// generate an extended event only if we just stepped into the deletion (i.e. don't
|
||||||
// generate the event at every deleted position on the ref, that's what cigarElementCounter==1 is for!)
|
// generate the event at every deleted position on the ref, that's what cigarElementCounter==1 is for!)
|
||||||
if ( eventDelayedFlag > 1 ) throw new UserError.MalformedBam(read, "Adjacent I/D events in read "+read.getReadName());
|
if ( eventDelayedFlag > 1 ) throw new UserException.MalformedBam(read, "Adjacent I/D events in read "+read.getReadName());
|
||||||
eventLength = curElement.getLength();
|
eventLength = curElement.getLength();
|
||||||
eventDelayedFlag = 2; // deletion on the ref causes an immediate return, so we have to delay by 1 only
|
eventDelayedFlag = 2; // deletion on the ref causes an immediate return, so we have to delay by 1 only
|
||||||
eventStart = readOffset;
|
eventStart = readOffset;
|
||||||
|
|
@ -546,7 +546,7 @@ public class LocusIteratorByState extends LocusIterator {
|
||||||
switch(this.downsamplingMethod.type) {
|
switch(this.downsamplingMethod.type) {
|
||||||
case BY_SAMPLE:
|
case BY_SAMPLE:
|
||||||
if(downsamplingMethod.toCoverage == null)
|
if(downsamplingMethod.toCoverage == null)
|
||||||
throw new UserError.BadArgumentValue("dcov", "Downsampling coverage (-dcov) must be specified when downsampling by sample");
|
throw new UserException.BadArgumentValue("dcov", "Downsampling coverage (-dcov) must be specified when downsampling by sample");
|
||||||
this.targetCoverage = downsamplingMethod.toCoverage;
|
this.targetCoverage = downsamplingMethod.toCoverage;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -27,17 +27,14 @@ package org.broadinstitute.sting.gatk.refdata;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.text.XReadLines;
|
import org.broadinstitute.sting.utils.text.XReadLines;
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.gatk.iterators.PushbackIterator;
|
import org.broadinstitute.sting.gatk.iterators.PushbackIterator;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -117,7 +114,7 @@ public class RODRecordIterator<ROD extends ReferenceOrderedDatum> implements Ite
|
||||||
try {
|
try {
|
||||||
reader = new PushbackIterator<String>(new XReadLines(file));
|
reader = new PushbackIterator<String>(new XReadLines(file));
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(file, e);
|
throw new UserException.CouldNotReadInputFile(file, e);
|
||||||
}
|
}
|
||||||
this.file = file;
|
this.file = file;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
@ -133,7 +130,7 @@ public class RODRecordIterator<ROD extends ReferenceOrderedDatum> implements Ite
|
||||||
try {
|
try {
|
||||||
header = rod.initialize(file);
|
header = rod.initialize(file);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(file, "ROD "+type.getName() + " failed to initialize properly from file "+file);
|
throw new UserException.CouldNotReadInputFile(file, "ROD "+type.getName() + " failed to initialize properly from file "+file);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -197,7 +194,7 @@ public class RODRecordIterator<ROD extends ReferenceOrderedDatum> implements Ite
|
||||||
parsed_ok = n.parseLine(header,parts) ;
|
parsed_ok = n.parseLine(header,parts) ;
|
||||||
}
|
}
|
||||||
catch ( Exception e ) {
|
catch ( Exception e ) {
|
||||||
throw new UserError.MalformedFile(file, "Failed to parse ROD data ("+type.getName()+") from file "+ file + " at line #"+linenum+
|
throw new UserException.MalformedFile(file, "Failed to parse ROD data ("+type.getName()+") from file "+ file + " at line #"+linenum+
|
||||||
"\nOffending line: "+line+
|
"\nOffending line: "+line+
|
||||||
"\nReason ("+e.getClass().getName()+")", e);
|
"\nReason ("+e.getClass().getName()+")", e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,7 @@ import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.RODRecordList;
|
import org.broadinstitute.sting.gatk.refdata.utils.RODRecordList;
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
@ -108,7 +107,7 @@ public class RefMetaDataTracker {
|
||||||
|
|
||||||
Object obj = objects.get(0).getUnderlyingObject();
|
Object obj = objects.get(0).getUnderlyingObject();
|
||||||
if (!(clazz.isAssignableFrom(obj.getClass())))
|
if (!(clazz.isAssignableFrom(obj.getClass())))
|
||||||
throw new UserError.CommandLineError("Unable to case track named " + name + " to type of " + clazz.toString()
|
throw new UserException.CommandLineException("Unable to case track named " + name + " to type of " + clazz.toString()
|
||||||
+ " it's of type " + obj.getClass());
|
+ " it's of type " + obj.getClass());
|
||||||
|
|
||||||
return (T)obj;
|
return (T)obj;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
package org.broadinstitute.sting.gatk.refdata;
|
package org.broadinstitute.sting.gatk.refdata;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
@ -42,7 +41,7 @@ public class ReferenceOrderedData<ROD extends ReferenceOrderedDatum> implements
|
||||||
try {
|
try {
|
||||||
str = new BufferedReader(new FileReader(new File(filename)));
|
str = new BufferedReader(new FileReader(new File(filename)));
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(new File(filename), "Unable to load the ROD input file", e);
|
throw new UserException.CouldNotReadInputFile(new File(filename), "Unable to load the ROD input file", e);
|
||||||
}
|
}
|
||||||
String line = "NO LINES READ IN";
|
String line = "NO LINES READ IN";
|
||||||
try {
|
try {
|
||||||
|
|
@ -51,7 +50,7 @@ public class ReferenceOrderedData<ROD extends ReferenceOrderedDatum> implements
|
||||||
else logger.warn("the following file line didn't parsing into a triplet -> " + line);
|
else logger.warn("the following file line didn't parsing into a triplet -> " + line);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(new File(filename), "Failed reading the input rod file; last line read was " + line, e);
|
throw new UserException.CouldNotReadInputFile(new File(filename), "Failed reading the input rod file; last line read was " + line, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,7 @@ import org.broadinstitute.sting.gatk.refdata.utils.RODRecordList;
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
@ -166,12 +165,12 @@ public class SeekableRODIterator implements LocationAwareSeekableRODIterator {
|
||||||
}
|
}
|
||||||
int that_contig = r.getLocation().getContigIndex();
|
int that_contig = r.getLocation().getContigIndex();
|
||||||
if ( curr_contig > that_contig )
|
if ( curr_contig > that_contig )
|
||||||
throw new UserError("LocationAwareSeekableRODIterator: contig " +r.getLocation().getContig() +
|
throw new UserException("LocationAwareSeekableRODIterator: contig " +r.getLocation().getContig() +
|
||||||
" occurs out of order in track " + r.getName() );
|
" occurs out of order in track " + r.getName() );
|
||||||
if ( curr_contig < that_contig ) break; // next record is on a higher contig, we do not need it yet...
|
if ( curr_contig < that_contig ) break; // next record is on a higher contig, we do not need it yet...
|
||||||
|
|
||||||
if ( r.getLocation().getStart() < curr_position )
|
if ( r.getLocation().getStart() < curr_position )
|
||||||
throw new UserError("LocationAwareSeekableRODIterator: track "+r.getName() +
|
throw new UserException("LocationAwareSeekableRODIterator: track "+r.getName() +
|
||||||
" is out of coordinate order on contig "+r.getLocation() + " compared to " + curr_contig + ":" + curr_position);
|
" is out of coordinate order on contig "+r.getLocation() + " compared to " + curr_contig + ":" + curr_position);
|
||||||
|
|
||||||
if ( r.getLocation().getStart() > curr_position ) break; // next record starts after the current position; we do not need it yet
|
if ( r.getLocation().getStart() > curr_position ) break; // next record starts after the current position; we do not need it yet
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,9 @@ import org.broad.tribble.TribbleException;
|
||||||
import org.broad.tribble.readers.LineReader;
|
import org.broad.tribble.readers.LineReader;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the ref seq codec
|
* the ref seq codec
|
||||||
|
|
@ -41,7 +38,7 @@ public class RefSeqCodec implements FeatureCodec {
|
||||||
feature.setTranscript_id(fields[1]);
|
feature.setTranscript_id(fields[1]);
|
||||||
if ( fields[3].length()==1 && fields[3].charAt(0)=='+') feature.setStrand(1);
|
if ( fields[3].length()==1 && fields[3].charAt(0)=='+') feature.setStrand(1);
|
||||||
else if ( fields[3].length()==1 && fields[3].charAt(0)=='-') feature.setStrand(-1);
|
else if ( fields[3].length()==1 && fields[3].charAt(0)=='-') feature.setStrand(-1);
|
||||||
else throw new UserError.MalformedFile("Expected strand symbol (+/-), found: "+fields[3]);
|
else throw new UserException.MalformedFile("Expected strand symbol (+/-), found: "+fields[3]);
|
||||||
|
|
||||||
|
|
||||||
feature.setTranscript_interval(GenomeLocParser.parseGenomeLoc(contig_name, Integer.parseInt(fields[4])+1, Integer.parseInt(fields[5])));
|
feature.setTranscript_interval(GenomeLocParser.parseGenomeLoc(contig_name, Integer.parseInt(fields[4])+1, Integer.parseInt(fields[5])));
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,8 @@ package org.broadinstitute.sting.gatk.refdata.tracks;
|
||||||
import org.broadinstitute.sting.gatk.refdata.tracks.builders.RMDTrackBuilder;
|
import org.broadinstitute.sting.gatk.refdata.tracks.builders.RMDTrackBuilder;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.RMDTriplet;
|
import org.broadinstitute.sting.gatk.refdata.utils.RMDTriplet;
|
||||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
|
||||||
import org.broadinstitute.sting.utils.classloader.PluginManager;
|
import org.broadinstitute.sting.utils.classloader.PluginManager;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -177,7 +175,7 @@ public class RMDTrackManager extends PluginManager<RMDTrackBuilder> {
|
||||||
// create instances of each of the requested types
|
// create instances of each of the requested types
|
||||||
for (RMDTriplet trip : inputs) {
|
for (RMDTriplet trip : inputs) {
|
||||||
RMDTrackBuilder b = availableTrackBuilders.get(trip.getType().toUpperCase());
|
RMDTrackBuilder b = availableTrackBuilders.get(trip.getType().toUpperCase());
|
||||||
if (b == null) throw new UserError.CommandLineError("Unable to find track for " + trip.getType());
|
if (b == null) throw new UserException.CommandLineException("Unable to find track for " + trip.getType());
|
||||||
tracks.add(b.createInstanceOfTrack(availableTrackTypes.get(trip.getType().toUpperCase()), trip.getName(), new File(trip.getFile())));
|
tracks.add(b.createInstanceOfTrack(availableTrackTypes.get(trip.getType().toUpperCase()), trip.getName(), new File(trip.getFile())));
|
||||||
}
|
}
|
||||||
return tracks;
|
return tracks;
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,7 @@ import org.broadinstitute.sting.gatk.refdata.utils.FeatureToGATKFeatureIterator;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
@ -82,7 +81,7 @@ public class TribbleTrack extends RMDTrack implements QueryableTrack {
|
||||||
try {
|
try {
|
||||||
return new FeatureToGATKFeatureIterator(reader.iterator(),this.getName());
|
return new FeatureToGATKFeatureIterator(reader.iterator(),this.getName());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(getFile(), "Unable to read from file", e);
|
throw new UserException.CouldNotReadInputFile(getFile(), "Unable to read from file", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,7 @@ import net.sf.samtools.SAMSequenceRecord;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.broad.tribble.*;
|
import org.broad.tribble.*;
|
||||||
import org.broad.tribble.index.Index;
|
import org.broad.tribble.index.Index;
|
||||||
import org.broad.tribble.index.IndexCreator;
|
|
||||||
import org.broad.tribble.index.IndexFactory;
|
import org.broad.tribble.index.IndexFactory;
|
||||||
import org.broad.tribble.index.interval.IntervalIndexCreator;
|
|
||||||
import org.broad.tribble.index.linear.LinearIndexCreator;
|
|
||||||
import org.broad.tribble.source.BasicFeatureSource;
|
import org.broad.tribble.source.BasicFeatureSource;
|
||||||
import org.broad.tribble.util.LittleEndianOutputStream;
|
import org.broad.tribble.util.LittleEndianOutputStream;
|
||||||
import org.broadinstitute.sting.gatk.refdata.tracks.TribbleTrack;
|
import org.broadinstitute.sting.gatk.refdata.tracks.TribbleTrack;
|
||||||
|
|
@ -42,8 +39,7 @@ import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrackCreationException;
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.collections.Pair;
|
import org.broadinstitute.sting.utils.collections.Pair;
|
||||||
import org.broadinstitute.sting.utils.classloader.PluginManager;
|
import org.broadinstitute.sting.utils.classloader.PluginManager;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
import org.broadinstitute.sting.utils.file.FSLockWithShared;
|
import org.broadinstitute.sting.utils.file.FSLockWithShared;
|
||||||
import org.broadinstitute.sting.utils.file.FileSystemInabilityToLockException;
|
import org.broadinstitute.sting.utils.file.FileSystemInabilityToLockException;
|
||||||
|
|
||||||
|
|
@ -104,7 +100,7 @@ public class TribbleRMDTrackBuilder extends PluginManager<FeatureCodec> implemen
|
||||||
public RMDTrack createInstanceOfTrack(Class targetClass, String name, File inputFile) throws RMDTrackCreationException {
|
public RMDTrack createInstanceOfTrack(Class targetClass, String name, File inputFile) throws RMDTrackCreationException {
|
||||||
// return a feature reader track
|
// return a feature reader track
|
||||||
Pair<BasicFeatureSource, SAMSequenceDictionary> pair = createFeatureReader(targetClass, name, inputFile);
|
Pair<BasicFeatureSource, SAMSequenceDictionary> pair = createFeatureReader(targetClass, name, inputFile);
|
||||||
if (pair == null) throw new UserError.CouldNotReadInputFile(inputFile, "Unable to make the feature reader for input file");
|
if (pair == null) throw new UserException.CouldNotReadInputFile(inputFile, "Unable to make the feature reader for input file");
|
||||||
return new TribbleTrack(targetClass, name, inputFile, pair.first, pair.second, createCodec(targetClass, name));
|
return new TribbleTrack(targetClass, name, inputFile, pair.first, pair.second, createCodec(targetClass, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -150,7 +146,7 @@ public class TribbleRMDTrackBuilder extends PluginManager<FeatureCodec> implemen
|
||||||
try {
|
try {
|
||||||
return new Pair<BasicFeatureSource, SAMSequenceDictionary>(BasicFeatureSource.getFeatureSource(inputFile.getAbsolutePath(), createCodec(targetClass, name)),null);
|
return new Pair<BasicFeatureSource, SAMSequenceDictionary>(BasicFeatureSource.getFeatureSource(inputFile.getAbsolutePath(), createCodec(targetClass, name)),null);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(inputFile, "Unable to create feature reader from file", e);
|
throw new UserException.CouldNotReadInputFile(inputFile, "Unable to create feature reader from file", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -183,9 +179,9 @@ public class TribbleRMDTrackBuilder extends PluginManager<FeatureCodec> implemen
|
||||||
createCodec(targetClass, name)),
|
createCodec(targetClass, name)),
|
||||||
sequenceSetToDictionary(index.getSequenceNames()));
|
sequenceSetToDictionary(index.getSequenceNames()));
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(inputFile, "Unable to create reader with file", e);
|
throw new UserException.CouldNotReadInputFile(inputFile, "Unable to create reader with file", e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError("Unable to make the index file for " + inputFile, e);
|
throw new UserException("Unable to make the index file for " + inputFile, e);
|
||||||
}
|
}
|
||||||
return reader;
|
return reader;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,7 @@ package org.broadinstitute.sting.gatk.walkers.analyzeannotations;
|
||||||
|
|
||||||
import org.broad.tribble.util.variantcontext.VariantContext;
|
import org.broad.tribble.util.variantcontext.VariantContext;
|
||||||
import org.broadinstitute.sting.utils.BaseUtils;
|
import org.broadinstitute.sting.utils.BaseUtils;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -113,7 +112,7 @@ public class AnnotationDataManager {
|
||||||
try {
|
try {
|
||||||
output = new PrintStream(filename); // Create the intermediate data file for this annotation
|
output = new PrintStream(filename); // Create the intermediate data file for this annotation
|
||||||
} catch ( FileNotFoundException e ) {
|
} catch ( FileNotFoundException e ) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(new File(filename), "Can't create intermediate output annotation data file. Does the output directory exist?", e);
|
throw new UserException.CouldNotCreateOutputFile(new File(filename), "Can't create intermediate output annotation data file. Does the output directory exist?", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output a header line
|
// Output a header line
|
||||||
|
|
@ -164,7 +163,7 @@ public class AnnotationDataManager {
|
||||||
try {
|
try {
|
||||||
Runtime.getRuntime().exec( rScriptCommandLine );
|
Runtime.getRuntime().exec( rScriptCommandLine );
|
||||||
} catch ( IOException e ) {
|
} catch ( IOException e ) {
|
||||||
throw new UserError.CannotExecuteRScript( rScriptCommandLine, e );
|
throw new UserException.CannotExecuteRScript( rScriptCommandLine, e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,8 @@ import org.broadinstitute.sting.gatk.refdata.utils.helpers.DbSNPHelper;
|
||||||
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*;
|
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*;
|
||||||
import org.broadinstitute.sting.gatk.walkers.annotator.genomicannotator.*;
|
import org.broadinstitute.sting.gatk.walkers.annotator.genomicannotator.*;
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.utils.classloader.PackageUtils;
|
import org.broadinstitute.sting.utils.classloader.PackageUtils;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
|
|
||||||
|
|
||||||
public class VariantAnnotatorEngine {
|
public class VariantAnnotatorEngine {
|
||||||
|
|
@ -106,7 +105,7 @@ public class VariantAnnotatorEngine {
|
||||||
if ( interfaceClass == null )
|
if ( interfaceClass == null )
|
||||||
interfaceClass = classMap.get(group + "Annotation");
|
interfaceClass = classMap.get(group + "Annotation");
|
||||||
if ( interfaceClass == null )
|
if ( interfaceClass == null )
|
||||||
throw new UserError.BadArgumentValue("group", "Class " + group + " is not found; please check that you have specified the class name correctly");
|
throw new UserException.BadArgumentValue("group", "Class " + group + " is not found; please check that you have specified the class name correctly");
|
||||||
classes.addAll(PackageUtils.getClassesImplementingInterface(interfaceClass));
|
classes.addAll(PackageUtils.getClassesImplementingInterface(interfaceClass));
|
||||||
}
|
}
|
||||||
// get the specific classes provided
|
// get the specific classes provided
|
||||||
|
|
@ -115,7 +114,7 @@ public class VariantAnnotatorEngine {
|
||||||
if ( annotationClass == null )
|
if ( annotationClass == null )
|
||||||
annotationClass = classMap.get(annotation + "Annotation");
|
annotationClass = classMap.get(annotation + "Annotation");
|
||||||
if ( annotationClass == null )
|
if ( annotationClass == null )
|
||||||
throw new UserError.BadArgumentValue("annotation", "Class " + annotation + " is not found; please check that you have specified the class name correctly");
|
throw new UserException.BadArgumentValue("annotation", "Class " + annotation + " is not found; please check that you have specified the class name correctly");
|
||||||
classes.add(annotationClass);
|
classes.add(annotationClass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,7 @@ import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
||||||
import org.broadinstitute.sting.gatk.walkers.annotator.VariantAnnotatorEngine;
|
import org.broadinstitute.sting.gatk.walkers.annotator.VariantAnnotatorEngine;
|
||||||
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
|
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
|
||||||
import org.broadinstitute.sting.utils.BaseUtils;
|
import org.broadinstitute.sting.utils.BaseUtils;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This plugin for {@link VariantAnnotatorEngine} serves as the core
|
* This plugin for {@link VariantAnnotatorEngine} serves as the core
|
||||||
|
|
@ -135,7 +134,7 @@ public class GenomicAnnotation implements InfoFieldAnnotation {
|
||||||
//continue; //TODO If this site is monomorphic in the VC, and the current record specifies a particular alternate allele, skip this record. Right?
|
//continue; //TODO If this site is monomorphic in the VC, and the current record specifies a particular alternate allele, skip this record. Right?
|
||||||
//} else
|
//} else
|
||||||
if(alternateAlleles.size() > 1) {
|
if(alternateAlleles.size() > 1) {
|
||||||
throw new UserError.MalformedFile("File associated with " + vc.getName() + " contains record [" + vc + "] contains " + alternateAlleles.size() + " alternate alleles. GenomicAnnotion currently only supports annotating 1 alternate allele.");
|
throw new UserException.MalformedFile("File associated with " + vc.getName() + " contains record [" + vc + "] contains " + alternateAlleles.size() + " alternate alleles. GenomicAnnotion currently only supports annotating 1 alternate allele.");
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean positiveStrand = true; //if HAPLOTYPE_STRAND_COLUMN isn't specified, assume positive strand.
|
boolean positiveStrand = true; //if HAPLOTYPE_STRAND_COLUMN isn't specified, assume positive strand.
|
||||||
|
|
@ -145,7 +144,7 @@ public class GenomicAnnotation implements InfoFieldAnnotation {
|
||||||
if(hapStrandValue.equals("-") || hapStrandValue.equals("r")) {
|
if(hapStrandValue.equals("-") || hapStrandValue.equals("r")) {
|
||||||
positiveStrand = false;
|
positiveStrand = false;
|
||||||
} else if(!hapStrandValue.equals("+") && !hapStrandValue.equals("f")) {
|
} else if(!hapStrandValue.equals("+") && !hapStrandValue.equals("f")) {
|
||||||
throw new UserError.MalformedFile("Record (" + gatkFeature.getUnderlyingObject() + ") in " + name + " has an invalid value for " + HAPLOTYPE_STRAND_COLUMN + ". This value is: \"" + hapStrandValue + "\"");
|
throw new UserException.MalformedFile("Record (" + gatkFeature.getUnderlyingObject() + ") in " + name + " has an invalid value for " + HAPLOTYPE_STRAND_COLUMN + ". This value is: \"" + hapStrandValue + "\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,7 @@ import org.broadinstitute.sting.gatk.refdata.features.annotator.AnnotatorInputTa
|
||||||
import org.broadinstitute.sting.gatk.walkers.*;
|
import org.broadinstitute.sting.gatk.walkers.*;
|
||||||
import org.broadinstitute.sting.gatk.walkers.annotator.VariantAnnotatorEngine;
|
import org.broadinstitute.sting.gatk.walkers.annotator.VariantAnnotatorEngine;
|
||||||
import org.broadinstitute.sting.utils.SampleUtils;
|
import org.broadinstitute.sting.utils.SampleUtils;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
import org.broadinstitute.sting.utils.vcf.VCFUtils;
|
import org.broadinstitute.sting.utils.vcf.VCFUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -107,7 +106,7 @@ public class GenomicAnnotator extends RodWalker<Integer, Integer> implements Tre
|
||||||
allFullyQualifiedColumnNames.add(bindingName + "." + columnName);
|
allFullyQualifiedColumnNames.add(bindingName + "." + columnName);
|
||||||
}
|
}
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(file, "Failed when attempting to read file header. ", e);
|
throw new UserException.CouldNotReadInputFile(file, "Failed when attempting to read file header. ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -118,25 +117,25 @@ public class GenomicAnnotator extends RodWalker<Integer, Integer> implements Tre
|
||||||
//parse the tokens
|
//parse the tokens
|
||||||
final String[] arg = joinArg.split(",");
|
final String[] arg = joinArg.split(",");
|
||||||
if(arg.length != 3) {
|
if(arg.length != 3) {
|
||||||
throw new UserError.BadArgumentValue("-J", "The following -J arg: \"" + joinArg + "\" must contain 3 comma-separated values. (ex: -J name,/path/to/file,name.columnName=name2.columnName2)");
|
throw new UserException.BadArgumentValue("-J", "The following -J arg: \"" + joinArg + "\" must contain 3 comma-separated values. (ex: -J name,/path/to/file,name.columnName=name2.columnName2)");
|
||||||
}
|
}
|
||||||
final String bindingName = arg[0];
|
final String bindingName = arg[0];
|
||||||
final String filename = arg[1];
|
final String filename = arg[1];
|
||||||
final String columnsToJoin = arg[2];
|
final String columnsToJoin = arg[2];
|
||||||
|
|
||||||
if(allBindingNames.contains(bindingName)) {
|
if(allBindingNames.contains(bindingName)) {
|
||||||
throw new UserError.BadArgumentValue("-J", "The name \"" + bindingName + "\" in the -J arg: \"" + joinArg + "\" has already been used in another binding.");
|
throw new UserException.BadArgumentValue("-J", "The name \"" + bindingName + "\" in the -J arg: \"" + joinArg + "\" has already been used in another binding.");
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] splitOnEquals = columnsToJoin.split("=+");
|
String[] splitOnEquals = columnsToJoin.split("=+");
|
||||||
if(splitOnEquals.length != 2) {
|
if(splitOnEquals.length != 2) {
|
||||||
throw new UserError.BadArgumentValue("-J", "The -J arg: \"" + joinArg + "\" must specify the columns to join on. (ex: -J name,/path/to/file,name.columnName=name2.columnName2)");
|
throw new UserException.BadArgumentValue("-J", "The -J arg: \"" + joinArg + "\" must specify the columns to join on. (ex: -J name,/path/to/file,name.columnName=name2.columnName2)");
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] splitOnDot1 = splitOnEquals[0].split("\\.");
|
String[] splitOnDot1 = splitOnEquals[0].split("\\.");
|
||||||
String[] splitOnDot2 = splitOnEquals[1].split("\\.");
|
String[] splitOnDot2 = splitOnEquals[1].split("\\.");
|
||||||
if(splitOnDot1.length != 2 || splitOnDot2.length != 2) {
|
if(splitOnDot1.length != 2 || splitOnDot2.length != 2) {
|
||||||
throw new UserError.BadArgumentValue("-J", "The -J arg: \"" + joinArg + "\" must fully specify the columns to join on. (ex: -J name,/path/to/file,name.columnName=name2.columnName2)");
|
throw new UserException.BadArgumentValue("-J", "The -J arg: \"" + joinArg + "\" must fully specify the columns to join on. (ex: -J name,/path/to/file,name.columnName=name2.columnName2)");
|
||||||
}
|
}
|
||||||
|
|
||||||
final String bindingName1 = splitOnDot1[0];
|
final String bindingName1 = splitOnDot1[0];
|
||||||
|
|
@ -158,13 +157,13 @@ public class GenomicAnnotator extends RodWalker<Integer, Integer> implements Tre
|
||||||
externalBindingName = bindingName1;
|
externalBindingName = bindingName1;
|
||||||
externalColumnName = columnName1;
|
externalColumnName = columnName1;
|
||||||
} else {
|
} else {
|
||||||
throw new UserError.BadArgumentValue("-J", "The name \"" + bindingName + "\" in the -J arg: \"" + joinArg + "\" must be specified in one the columns to join on. (ex: -J name,/path/to/file,name.columnName=name2.columnName2)");
|
throw new UserException.BadArgumentValue("-J", "The name \"" + bindingName + "\" in the -J arg: \"" + joinArg + "\" must be specified in one the columns to join on. (ex: -J name,/path/to/file,name.columnName=name2.columnName2)");
|
||||||
}
|
}
|
||||||
|
|
||||||
//validate externalColumnName
|
//validate externalColumnName
|
||||||
final String fullyQualifiedExternalColumnName = externalBindingName + '.' + externalColumnName;
|
final String fullyQualifiedExternalColumnName = externalBindingName + '.' + externalColumnName;
|
||||||
if( !allFullyQualifiedColumnNames.contains(fullyQualifiedExternalColumnName) ) {
|
if( !allFullyQualifiedColumnNames.contains(fullyQualifiedExternalColumnName) ) {
|
||||||
throw new UserError.BadArgumentValue("-J", "The -J arg: \"" + joinArg + "\" specifies an unknown column name: \"" + fullyQualifiedExternalColumnName + "\"");
|
throw new UserException.BadArgumentValue("-J", "The -J arg: \"" + joinArg + "\" specifies an unknown column name: \"" + fullyQualifiedExternalColumnName + "\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
//read in the file contents into a JoinTable object
|
//read in the file contents into a JoinTable object
|
||||||
|
|
@ -182,7 +181,7 @@ public class GenomicAnnotator extends RodWalker<Integer, Integer> implements Tre
|
||||||
fullyQualifiedColumnNames.add(localBindingName + '.' + columnName);
|
fullyQualifiedColumnNames.add(localBindingName + '.' + columnName);
|
||||||
}
|
}
|
||||||
if ( !found )
|
if ( !found )
|
||||||
throw new UserError.BadArgumentValue("-J", "The -J arg: \"" + joinArg + "\" specifies an unknown column name: \"" + localColumnName + "\". It's not one of the column names in the header " + columnNames + " of the file: " + filename);
|
throw new UserException.BadArgumentValue("-J", "The -J arg: \"" + joinArg + "\" specifies an unknown column name: \"" + localColumnName + "\". It's not one of the column names in the header " + columnNames + " of the file: " + filename);
|
||||||
|
|
||||||
allFullyQualifiedColumnNames.addAll(fullyQualifiedColumnNames);
|
allFullyQualifiedColumnNames.addAll(fullyQualifiedColumnNames);
|
||||||
}
|
}
|
||||||
|
|
@ -195,7 +194,7 @@ public class GenomicAnnotator extends RodWalker<Integer, Integer> implements Tre
|
||||||
|
|
||||||
for ( String columnName : SELECT_COLUMNS ) {
|
for ( String columnName : SELECT_COLUMNS ) {
|
||||||
if ( !allFullyQualifiedColumnNames.contains(columnName) )
|
if ( !allFullyQualifiedColumnNames.contains(columnName) )
|
||||||
throw new UserError.BadArgumentValue("-s", "The column name '" + columnName + "' provided to -s doesn't match any of the column names in any of the -B files. Here is the list of available column names: " + allFullyQualifiedColumnNames);
|
throw new UserException.BadArgumentValue("-s", "The column name '" + columnName + "' provided to -s doesn't match any of the column names in any of the -B files. Here is the list of available column names: " + allFullyQualifiedColumnNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
//instantiate the VariantAnnotatorEngine
|
//instantiate the VariantAnnotatorEngine
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,7 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a container that holds all data corresponding to a single join table as specified by one -J arg (ex: -J bindingName1,/path/to/file,bindingName1.columnName=bindingName2.columnName2).
|
* This is a container that holds all data corresponding to a single join table as specified by one -J arg (ex: -J bindingName1,/path/to/file,bindingName1.columnName=bindingName2.columnName2).
|
||||||
|
|
@ -112,7 +111,7 @@ public class JoinTable
|
||||||
}
|
}
|
||||||
|
|
||||||
if(localColumnNameIdx == -1) {
|
if(localColumnNameIdx == -1) {
|
||||||
throw new UserError.BadArgumentValue("-J", "The -J arg specifies an unknown column name: \"" + localColumnName + "\". It's not one of the column names in the header " + columnNames + " of the file: " + filename);
|
throw new UserException.BadArgumentValue("-J", "The -J arg specifies an unknown column name: \"" + localColumnName + "\". It's not one of the column names in the header " + columnNames + " of the file: " + filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
//read in all records and create a map entry for each
|
//read in all records and create a map entry for each
|
||||||
|
|
@ -127,7 +126,7 @@ public class JoinTable
|
||||||
}
|
}
|
||||||
catch(IOException e)
|
catch(IOException e)
|
||||||
{
|
{
|
||||||
throw new UserError.CouldNotReadInputFile(new File(filename), "Unable to parse file", e);
|
throw new UserException.CouldNotReadInputFile(new File(filename), "Unable to parse file", e);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,8 @@ import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
import org.broadinstitute.sting.utils.Utils;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to parse files passed to the GenomicAnnotator via the -J arg.
|
* Used to parse files passed to the GenomicAnnotator via the -J arg.
|
||||||
|
|
@ -92,7 +91,7 @@ public class JoinTableParser
|
||||||
final ArrayList<String> values = Utils.split(line, DELIMITER, header.size());
|
final ArrayList<String> values = Utils.split(line, DELIMITER, header.size());
|
||||||
|
|
||||||
if ( values.size() != header.size() ) {
|
if ( values.size() != header.size() ) {
|
||||||
throw new UserError.MalformedFile(String.format("Encountered a row with %d columns which is different from the number or columns in the header: %d\nHeader: " + header + "\nLine: " + values, values.size(), header.size()));
|
throw new UserException.MalformedFile(String.format("Encountered a row with %d columns which is different from the number or columns in the header: %d\nHeader: " + header + "\nLine: " + values, values.size(), header.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return values;
|
return values;
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,7 @@ import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
||||||
import org.broadinstitute.sting.gatk.walkers.Window;
|
import org.broadinstitute.sting.gatk.walkers.Window;
|
||||||
import org.broadinstitute.sting.utils.BaseUtils;
|
import org.broadinstitute.sting.utils.BaseUtils;
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Takes a table of transcripts (eg. UCSC refGene, knownGene, and CCDS tables) and generates the big table which contains
|
* Takes a table of transcripts (eg. UCSC refGene, knownGene, and CCDS tables) and generates the big table which contains
|
||||||
|
|
@ -174,12 +173,12 @@ public class TranscriptToGenomicInfo extends RodWalker<Integer, Integer> {
|
||||||
try {
|
try {
|
||||||
header = AnnotatorInputTableCodec.readHeader(transcriptsDataSource.getReferenceOrderedData().getFile());
|
header = AnnotatorInputTableCodec.readHeader(transcriptsDataSource.getReferenceOrderedData().getFile());
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
throw new UserError.MalformedFile(transcriptsDataSource.getReferenceOrderedData().getFile(), "Failed when attempting to read header from file", e);
|
throw new UserException.MalformedFile(transcriptsDataSource.getReferenceOrderedData().getFile(), "Failed when attempting to read header from file", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( String columnName : GENE_NAME_COLUMNS ) {
|
for ( String columnName : GENE_NAME_COLUMNS ) {
|
||||||
if ( !header.contains(columnName) )
|
if ( !header.contains(columnName) )
|
||||||
throw new UserError.CommandLineError("The column name '" + columnName + "' provided to -n doesn't match any of the column names in: " + transcriptsDataSource.getReferenceOrderedData().getFile());
|
throw new UserException.CommandLineException("The column name '" + columnName + "' provided to -n doesn't match any of the column names in: " + transcriptsDataSource.getReferenceOrderedData().getFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
//init outputColumnNames list
|
//init outputColumnNames list
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,7 @@ import org.broadinstitute.sting.gatk.walkers.Requires;
|
||||||
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
||||||
import org.broadinstitute.sting.gatk.walkers.TreeReducible;
|
import org.broadinstitute.sting.gatk.walkers.TreeReducible;
|
||||||
import org.broadinstitute.sting.gatk.walkers.Window;
|
import org.broadinstitute.sting.gatk.walkers.Window;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -71,7 +70,7 @@ public class TranscriptToInfo extends RodWalker<Integer, Integer> implements Tre
|
||||||
private String[] GENE_NAME_COLUMNS = {};
|
private String[] GENE_NAME_COLUMNS = {};
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
throw new UserError.MissingWalker("TranscriptToInfo", "This walker is no longer supported. We are actively working on a bug-free replacement. We thank you for your patience at this time.");
|
throw new UserException.MissingWalker("TranscriptToInfo", "This walker is no longer supported. We are actively working on a bug-free replacement. We thank you for your patience at this time.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer reduceInit() { return 0; }
|
public Integer reduceInit() { return 0; }
|
||||||
|
|
|
||||||
|
|
@ -29,13 +29,11 @@ import org.broadinstitute.sting.gatk.walkers.By;
|
||||||
import org.broadinstitute.sting.gatk.walkers.DataSource;
|
import org.broadinstitute.sting.gatk.walkers.DataSource;
|
||||||
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
|
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
|
||||||
import org.broadinstitute.sting.utils.*;
|
import org.broadinstitute.sting.utils.*;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.commandline.Output;
|
import org.broadinstitute.sting.commandline.Output;
|
||||||
|
|
||||||
import java.util.EnumMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
|
@ -92,7 +90,7 @@ public class CallableLociWalker extends LocusWalker<CallableLociWalker.CallableB
|
||||||
PrintStream summaryOut = new PrintStream(summaryFile);
|
PrintStream summaryOut = new PrintStream(summaryFile);
|
||||||
summaryOut.close();
|
summaryOut.close();
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(summaryFile, e);
|
throw new UserException.CouldNotCreateOutputFile(summaryFile, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -220,7 +218,7 @@ public class CallableLociWalker extends LocusWalker<CallableLociWalker.CallableB
|
||||||
|
|
||||||
summaryOut.close();
|
summaryOut.close();
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(summaryFile, e);
|
throw new UserException.CouldNotCreateOutputFile(summaryFile, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,12 @@ import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||||
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.commandline.Output;
|
import org.broadinstitute.sting.commandline.Output;
|
||||||
import org.broad.tribble.bed.FullBEDFeature;
|
import org.broad.tribble.bed.FullBEDFeature;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
|
@ -95,7 +94,7 @@ public class CompareCallableLociWalker extends RodWalker<List<CallableLociWalker
|
||||||
//System.out.printf("tracker %s%n", tracker);
|
//System.out.printf("tracker %s%n", tracker);
|
||||||
List<Object> bindings = tracker.getReferenceMetaData(track);
|
List<Object> bindings = tracker.getReferenceMetaData(track);
|
||||||
if ( bindings.size() != 1 || ! (bindings.get(0) instanceof FullBEDFeature)) {
|
if ( bindings.size() != 1 || ! (bindings.get(0) instanceof FullBEDFeature)) {
|
||||||
throw new UserError.MalformedFile(String.format("%s track isn't a properly formated CallableBases object!", track));
|
throw new UserException.MalformedFile(String.format("%s track isn't a properly formated CallableBases object!", track));
|
||||||
}
|
}
|
||||||
|
|
||||||
FullBEDFeature bed = (FullBEDFeature)bindings.get(0);
|
FullBEDFeature bed = (FullBEDFeature)bindings.get(0);
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,7 @@ import net.sf.samtools.SAMRecord;
|
||||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||||
import org.broadinstitute.sting.utils.BaseUtils;
|
import org.broadinstitute.sting.utils.BaseUtils;
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -129,7 +128,7 @@ public class CoverageUtils {
|
||||||
SAMReadGroupRecord rg = r.getReadGroup();
|
SAMReadGroupRecord rg = r.getReadGroup();
|
||||||
if ( rg == null ) {
|
if ( rg == null ) {
|
||||||
String msg = "Read "+r.getReadName()+" lacks read group information; Please associate all reads with read groups";
|
String msg = "Read "+r.getReadName()+" lacks read group information; Please associate all reads with read groups";
|
||||||
throw new UserError.MalformedBam(r, msg);
|
throw new UserException.MalformedBam(r, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rg;
|
return rg;
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ import org.broadinstitute.sting.utils.*;
|
||||||
import org.broadinstitute.sting.utils.collections.Pair;
|
import org.broadinstitute.sting.utils.collections.Pair;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.commandline.Output;
|
import org.broadinstitute.sting.commandline.Output;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
@ -403,7 +403,7 @@ public class DepthOfCoverageWalker extends LocusWalker<Map<DoCOutputType.Partiti
|
||||||
try {
|
try {
|
||||||
return new SeekableRODIterator(new FeatureToGATKFeatureIterator(refseq.iterator(),"refseq"));
|
return new SeekableRODIterator(new FeatureToGATKFeatureIterator(refseq.iterator(),"refseq"));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(refSeqGeneList, "Unable to open file", e);
|
throw new UserException.CouldNotReadInputFile(refSeqGeneList, "Unable to open file", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -613,7 +613,7 @@ public class DepthOfCoverageWalker extends LocusWalker<Map<DoCOutputType.Partiti
|
||||||
private PrintStream getCorrectStream(DoCOutputType.Partition partition, DoCOutputType.Aggregation aggregation, DoCOutputType.FileType fileType) {
|
private PrintStream getCorrectStream(DoCOutputType.Partition partition, DoCOutputType.Aggregation aggregation, DoCOutputType.FileType fileType) {
|
||||||
DoCOutputType outputType = new DoCOutputType(partition,aggregation,fileType);
|
DoCOutputType outputType = new DoCOutputType(partition,aggregation,fileType);
|
||||||
if(!out.containsKey(outputType))
|
if(!out.containsKey(outputType))
|
||||||
throw new UserError.CommandLineError(String.format("Unable to find appropriate stream for partition = %s, aggregation = %s, file type = %s",partition,aggregation,fileType));
|
throw new UserException.CommandLineException(String.format("Unable to find appropriate stream for partition = %s, aggregation = %s, file type = %s",partition,aggregation,fileType));
|
||||||
return out.get(outputType);
|
return out.get(outputType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,11 +45,9 @@ import org.broadinstitute.sting.gatk.refdata.utils.RODRecordList;
|
||||||
import org.broadinstitute.sting.gatk.walkers.ReadFilters;
|
import org.broadinstitute.sting.gatk.walkers.ReadFilters;
|
||||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
|
||||||
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.ReferenceDataSource;
|
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.ReferenceDataSource;
|
||||||
import org.broadinstitute.sting.utils.*;
|
import org.broadinstitute.sting.utils.*;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.vcf.VCFUtils;
|
|
||||||
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
||||||
import org.broadinstitute.sting.utils.collections.CircularArray;
|
import org.broadinstitute.sting.utils.collections.CircularArray;
|
||||||
import org.broadinstitute.sting.utils.collections.PrimitivePair;
|
import org.broadinstitute.sting.utils.collections.PrimitivePair;
|
||||||
|
|
@ -211,7 +209,7 @@ public class IndelGenotyperV2Walker extends ReadWalker<Integer,Integer> {
|
||||||
normal_context = new WindowContext(0,WINDOW_SIZE);
|
normal_context = new WindowContext(0,WINDOW_SIZE);
|
||||||
|
|
||||||
if ( bedOutput != null && output_file != null ) {
|
if ( bedOutput != null && output_file != null ) {
|
||||||
throw new UserError.DeprecatedArgument("-O", "-O option is deprecated and -bed option replaces it; you can not use both at the same time");
|
throw new UserException.DeprecatedArgument("-O", "-O option is deprecated and -bed option replaces it; you can not use both at the same time");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( RefseqFileName != null ) {
|
if ( RefseqFileName != null ) {
|
||||||
|
|
@ -223,7 +221,7 @@ public class IndelGenotyperV2Walker extends ReadWalker<Integer,Integer> {
|
||||||
try {
|
try {
|
||||||
refseqIterator = new SeekableRODIterator(new FeatureToGATKFeatureIterator(refseq.iterator(),"refseq"));
|
refseqIterator = new SeekableRODIterator(new FeatureToGATKFeatureIterator(refseq.iterator(),"refseq"));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(new File(RefseqFileName), "Write failed", e);
|
throw new UserException.CouldNotReadInputFile(new File(RefseqFileName), "Write failed", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -264,12 +262,12 @@ public class IndelGenotyperV2Walker extends ReadWalker<Integer,Integer> {
|
||||||
if ( bedOutput != null ) bedWriter = new FileWriter(bedOutput);
|
if ( bedOutput != null ) bedWriter = new FileWriter(bedOutput);
|
||||||
if ( output_file != null ) bedWriter = new FileWriter(output_file);
|
if ( output_file != null ) bedWriter = new FileWriter(output_file);
|
||||||
} catch (java.io.IOException e) {
|
} catch (java.io.IOException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(bedOutput, "Failed to open BED file for writing.", e);
|
throw new UserException.CouldNotReadInputFile(bedOutput, "Failed to open BED file for writing.", e);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if ( verboseOutput != null ) verboseWriter = new FileWriter(verboseOutput);
|
if ( verboseOutput != null ) verboseWriter = new FileWriter(verboseOutput);
|
||||||
} catch (java.io.IOException e) {
|
} catch (java.io.IOException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(verboseOutput, "Failed to open BED file for writing.", e);
|
throw new UserException.CouldNotReadInputFile(verboseOutput, "Failed to open BED file for writing.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
vcf_writer.writeHeader(new VCFHeader(getVCFHeaderInfo(), SampleUtils.getSAMFileSamples(getToolkit().getSAMFileHeader()))) ;
|
vcf_writer.writeHeader(new VCFHeader(getVCFHeaderInfo(), SampleUtils.getSAMFileSamples(getToolkit().getSAMFileHeader()))) ;
|
||||||
|
|
@ -299,7 +297,7 @@ public class IndelGenotyperV2Walker extends ReadWalker<Integer,Integer> {
|
||||||
// we just jumped onto a new contig
|
// we just jumped onto a new contig
|
||||||
if ( DEBUG ) System.out.println("DEBUG>>> Moved to contig "+read.getReferenceName());
|
if ( DEBUG ) System.out.println("DEBUG>>> Moved to contig "+read.getReferenceName());
|
||||||
if ( read.getReferenceIndex() < currentContigIndex ) // paranoidal
|
if ( read.getReferenceIndex() < currentContigIndex ) // paranoidal
|
||||||
throw new UserError.MissortedBAM(SAMFileHeader.SortOrder.coordinate, read, "Read "+read.getReadName()+": contig is out of order; input BAM file is unsorted");
|
throw new UserException.MissortedBAM(SAMFileHeader.SortOrder.coordinate, read, "Read "+read.getReadName()+": contig is out of order; input BAM file is unsorted");
|
||||||
|
|
||||||
// print remaining indels from the previous contig (if any);
|
// print remaining indels from the previous contig (if any);
|
||||||
if ( call_somatic ) emit_somatic(1000000000, true);
|
if ( call_somatic ) emit_somatic(1000000000, true);
|
||||||
|
|
@ -327,7 +325,7 @@ public class IndelGenotyperV2Walker extends ReadWalker<Integer,Integer> {
|
||||||
// tumor_context are synchronized exactly (windows are always shifted together by emit_somatic), so it's safe
|
// tumor_context are synchronized exactly (windows are always shifted together by emit_somatic), so it's safe
|
||||||
|
|
||||||
if ( read.getAlignmentStart() < currentPosition ) // oops, read out of order?
|
if ( read.getAlignmentStart() < currentPosition ) // oops, read out of order?
|
||||||
throw new UserError.MissortedBAM(SAMFileHeader.SortOrder.coordinate, read, "Read "+read.getReadName() +" out of order on the contig\n"+
|
throw new UserException.MissortedBAM(SAMFileHeader.SortOrder.coordinate, read, "Read "+read.getReadName() +" out of order on the contig\n"+
|
||||||
"Read starts at "+refName+":"+read.getAlignmentStart()+"; last read seen started at "+refName+":"+currentPosition
|
"Read starts at "+refName+":"+read.getAlignmentStart()+"; last read seen started at "+refName+":"+currentPosition
|
||||||
+"\nLast read was: "+lastRead.getReadName()+" RG="+lastRead.getAttribute("RG")+" at "+lastRead.getAlignmentStart()+"-"
|
+"\nLast read was: "+lastRead.getReadName()+" RG="+lastRead.getAttribute("RG")+" at "+lastRead.getAlignmentStart()+"-"
|
||||||
+lastRead.getAlignmentEnd()+" cigar="+lastRead.getCigarString());
|
+lastRead.getAlignmentEnd()+" cigar="+lastRead.getCigarString());
|
||||||
|
|
@ -382,7 +380,7 @@ public class IndelGenotyperV2Walker extends ReadWalker<Integer,Integer> {
|
||||||
// let's double check now that the read fits after the shift
|
// let's double check now that the read fits after the shift
|
||||||
if ( read.getAlignmentEnd() > normal_context.getStop()) {
|
if ( read.getAlignmentEnd() > normal_context.getStop()) {
|
||||||
// ooops, looks like the read does not fit into the window even after the latter was shifted!!
|
// ooops, looks like the read does not fit into the window even after the latter was shifted!!
|
||||||
throw new UserError.MissortedBAM(SAMFileHeader.SortOrder.coordinate, read, "Read "+read.getReadName()+": out of coverage window bounds. Probably window is too small.\n"+
|
throw new UserException.MissortedBAM(SAMFileHeader.SortOrder.coordinate, read, "Read "+read.getReadName()+": out of coverage window bounds. Probably window is too small.\n"+
|
||||||
"Read length="+read.getReadLength()+"; cigar="+read.getCigarString()+"; start="+
|
"Read length="+read.getReadLength()+"; cigar="+read.getCigarString()+"; start="+
|
||||||
read.getAlignmentStart()+"; end="+read.getAlignmentEnd()+
|
read.getAlignmentStart()+"; end="+read.getAlignmentEnd()+
|
||||||
"; window start (after trying to accomodate the read)="+normal_context.getStart()+
|
"; window start (after trying to accomodate the read)="+normal_context.getStart()+
|
||||||
|
|
@ -394,14 +392,14 @@ public class IndelGenotyperV2Walker extends ReadWalker<Integer,Integer> {
|
||||||
|
|
||||||
String rg = (String)read.getAttribute("RG");
|
String rg = (String)read.getAttribute("RG");
|
||||||
if ( rg == null )
|
if ( rg == null )
|
||||||
throw new UserError.MalformedBam(read, "Read "+read.getReadName()+" has no read group in merged stream. RG is required for somatic calls.");
|
throw new UserException.MalformedBam(read, "Read "+read.getReadName()+" has no read group in merged stream. RG is required for somatic calls.");
|
||||||
|
|
||||||
if ( normalReadGroups.contains(rg) ) {
|
if ( normalReadGroups.contains(rg) ) {
|
||||||
normal_context.add(read,ref.getBases());
|
normal_context.add(read,ref.getBases());
|
||||||
} else if ( tumorReadGroups.contains(rg) ) {
|
} else if ( tumorReadGroups.contains(rg) ) {
|
||||||
tumor_context.add(read,ref.getBases());
|
tumor_context.add(read,ref.getBases());
|
||||||
} else {
|
} else {
|
||||||
throw new UserError.MalformedBam(read, "Unrecognized read group in merged stream: "+rg);
|
throw new UserException.MalformedBam(read, "Unrecognized read group in merged stream: "+rg);
|
||||||
}
|
}
|
||||||
if ( tumor_context.getReads().size() > MAX_READ_NUMBER ) {
|
if ( tumor_context.getReads().size() > MAX_READ_NUMBER ) {
|
||||||
System.out.println("WARNING: a count of "+MAX_READ_NUMBER+" reads reached in a window "+
|
System.out.println("WARNING: a count of "+MAX_READ_NUMBER+" reads reached in a window "+
|
||||||
|
|
@ -503,7 +501,7 @@ public class IndelGenotyperV2Walker extends ReadWalker<Integer,Integer> {
|
||||||
verboseWriter.write(fullRecord.toString());
|
verboseWriter.write(fullRecord.toString());
|
||||||
verboseWriter.write('\n');
|
verboseWriter.write('\n');
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(verboseOutput, "Write failed", e);
|
throw new UserException.CouldNotCreateOutputFile(verboseOutput, "Write failed", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -663,7 +661,7 @@ public class IndelGenotyperV2Walker extends ReadWalker<Integer,Integer> {
|
||||||
verboseWriter.write(fullRecord + "\t"+ annotationString);
|
verboseWriter.write(fullRecord + "\t"+ annotationString);
|
||||||
verboseWriter.write('\n');
|
verboseWriter.write('\n');
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(verboseOutput, "Write failed", e);
|
throw new UserException.CouldNotCreateOutputFile(verboseOutput, "Write failed", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1222,7 +1220,7 @@ public class IndelGenotyperV2Walker extends ReadWalker<Integer,Integer> {
|
||||||
try {
|
try {
|
||||||
bed.write(message.toString()+"\n");
|
bed.write(message.toString()+"\n");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(bedOutput, "Error encountered while writing into output BED file", e);
|
throw new UserException.CouldNotCreateOutputFile(bedOutput, "Error encountered while writing into output BED file", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ import net.sf.samtools.util.SequenceUtil;
|
||||||
import net.sf.picard.reference.IndexedFastaSequenceFile;
|
import net.sf.picard.reference.IndexedFastaSequenceFile;
|
||||||
import org.broad.tribble.util.variantcontext.VariantContext;
|
import org.broad.tribble.util.variantcontext.VariantContext;
|
||||||
import org.broadinstitute.sting.commandline.*;
|
import org.broadinstitute.sting.commandline.*;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.interval.IntervalMergingRule;
|
import org.broadinstitute.sting.utils.interval.IntervalMergingRule;
|
||||||
import org.broadinstitute.sting.utils.interval.IntervalUtils;
|
import org.broadinstitute.sting.utils.interval.IntervalUtils;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
|
|
@ -334,7 +334,7 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
|
||||||
currentInterval = intervals.hasNext() ? intervals.next() : null;
|
currentInterval = intervals.hasNext() ? intervals.next() : null;
|
||||||
} while ( currentInterval != null && (readLoc == null || currentInterval.isBefore(readLoc)) );
|
} while ( currentInterval != null && (readLoc == null || currentInterval.isBefore(readLoc)) );
|
||||||
} catch (GATKException e) {
|
} catch (GATKException e) {
|
||||||
throw new UserError.MissortedFile(new File(intervalsFile), " *** Are you sure that your interval file is sorted? If not, you must use the --targetIntervalsAreNotSorted argument. ***", e);
|
throw new UserException.MissortedFile(new File(intervalsFile), " *** Are you sure that your interval file is sorted? If not, you must use the --targetIntervalsAreNotSorted argument. ***", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -532,7 +532,7 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
|
||||||
statsOutput.write("\n");
|
statsOutput.write("\n");
|
||||||
statsOutput.flush();
|
statsOutput.flush();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new UserError.CouldNotCreateOutputFile("statsOutput", "Failed to write stats output file", e);
|
throw new UserException.CouldNotCreateOutputFile("statsOutput", "Failed to write stats output file", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -559,7 +559,7 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
|
||||||
indelOutput.write(str.toString());
|
indelOutput.write(str.toString());
|
||||||
indelOutput.flush();
|
indelOutput.flush();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new UserError.CouldNotCreateOutputFile("indelOutput", "Failed to write indel output file", e);
|
throw new UserException.CouldNotCreateOutputFile("indelOutput", "Failed to write indel output file", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( statsOutput != null ) {
|
if ( statsOutput != null ) {
|
||||||
|
|
@ -573,7 +573,7 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
|
||||||
statsOutput.write("\n");
|
statsOutput.write("\n");
|
||||||
statsOutput.flush();
|
statsOutput.flush();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new UserError.CouldNotCreateOutputFile("statsOutput", "Failed to write stats output file", e);
|
throw new UserException.CouldNotCreateOutputFile("statsOutput", "Failed to write stats output file", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -619,7 +619,7 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
|
||||||
currentInterval.toString(), improvement));
|
currentInterval.toString(), improvement));
|
||||||
statsOutput.flush();
|
statsOutput.flush();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new UserError.CouldNotCreateOutputFile("statsOutput", "Failed to write stats output file", e);
|
throw new UserException.CouldNotCreateOutputFile("statsOutput", "Failed to write stats output file", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1059,7 +1059,7 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
|
||||||
snpsOutput.write(sb.toString());
|
snpsOutput.write(sb.toString());
|
||||||
snpsOutput.flush();
|
snpsOutput.flush();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new UserError.CouldNotCreateOutputFile("snpsOutput", "Failed to write SNPs output file", e);
|
throw new UserException.CouldNotCreateOutputFile("snpsOutput", "Failed to write SNPs output file", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return reduces;
|
return reduces;
|
||||||
|
|
|
||||||
|
|
@ -33,13 +33,11 @@ import org.broadinstitute.sting.gatk.filters.ZeroMappingQualityReadFilter;
|
||||||
import org.broadinstitute.sting.gatk.filters.BadMateFilter;
|
import org.broadinstitute.sting.gatk.filters.BadMateFilter;
|
||||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||||
import org.broadinstitute.sting.gatk.walkers.*;
|
import org.broadinstitute.sting.gatk.walkers.*;
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.commandline.Output;
|
import org.broadinstitute.sting.commandline.Output;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.pileup.ExtendedEventPileupElement;
|
import org.broadinstitute.sting.utils.pileup.ExtendedEventPileupElement;
|
||||||
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
||||||
import org.broadinstitute.sting.utils.pileup.ReadBackedExtendedEventPileup;
|
import org.broadinstitute.sting.utils.pileup.ReadBackedExtendedEventPileup;
|
||||||
|
|
@ -85,7 +83,7 @@ public class RealignerTargetCreator extends RodWalker<RealignerTargetCreator.Eve
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
if ( windowSize < 2 )
|
if ( windowSize < 2 )
|
||||||
throw new UserError.BadArgumentValue("windowSize", "Window Size must be an integer greater than 1");
|
throw new UserException.BadArgumentValue("windowSize", "Window Size must be an integer greater than 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Event map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
public Event map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,8 @@ import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.utils.collections.PrimitivePair;
|
import org.broadinstitute.sting.utils.collections.PrimitivePair;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.commandline.Output;
|
import org.broadinstitute.sting.commandline.Output;
|
||||||
|
|
@ -96,13 +95,13 @@ public class CycleQualityWalker extends ReadWalker<Integer,Integer> {
|
||||||
|
|
||||||
SAMReadGroupRecord rg = read.getReadGroup();
|
SAMReadGroupRecord rg = read.getReadGroup();
|
||||||
|
|
||||||
if ( rg == null ) throw new UserError.ReadMissingReadGroup(read);
|
if ( rg == null ) throw new UserException.ReadMissingReadGroup(read);
|
||||||
|
|
||||||
String lane = read.getReadGroup().getPlatformUnit();
|
String lane = read.getReadGroup().getPlatformUnit();
|
||||||
String library = read.getReadGroup().getLibrary();
|
String library = read.getReadGroup().getLibrary();
|
||||||
|
|
||||||
if ( lane == null ) throw new UserError.MalformedBam(read, "Read "+read.getReadName()+" has no platform unit information");
|
if ( lane == null ) throw new UserException.MalformedBam(read, "Read "+read.getReadName()+" has no platform unit information");
|
||||||
if ( library == null ) throw new UserError.MalformedBam(read, "Read "+read.getReadName()+" has no library information");
|
if ( library == null ) throw new UserException.MalformedBam(read, "Read "+read.getReadName()+" has no library information");
|
||||||
|
|
||||||
int end = 0;
|
int end = 0;
|
||||||
|
|
||||||
|
|
@ -110,11 +109,11 @@ public class CycleQualityWalker extends ReadWalker<Integer,Integer> {
|
||||||
|
|
||||||
if ( read.getFirstOfPairFlag() ) {
|
if ( read.getFirstOfPairFlag() ) {
|
||||||
if ( read.getSecondOfPairFlag() )
|
if ( read.getSecondOfPairFlag() )
|
||||||
throw new UserError.MalformedBam(read, "Read "+read.getReadName()+" has conflicting first/second in pair attributes");
|
throw new UserException.MalformedBam(read, "Read "+read.getReadName()+" has conflicting first/second in pair attributes");
|
||||||
end = 1;
|
end = 1;
|
||||||
} else {
|
} else {
|
||||||
if ( ! read.getSecondOfPairFlag() )
|
if ( ! read.getSecondOfPairFlag() )
|
||||||
throw new UserError.MalformedBam(read, "Read "+read.getReadName()+" has conflicting first/second in pair attributes");
|
throw new UserException.MalformedBam(read, "Read "+read.getReadName()+" has conflicting first/second in pair attributes");
|
||||||
end = 2;
|
end = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -361,7 +360,7 @@ public class CycleQualityWalker extends ReadWalker<Integer,Integer> {
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(f, "Failed to write report", ioe);
|
throw new UserException.CouldNotCreateOutputFile(f, "Failed to write report", ioe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -408,7 +407,7 @@ public class CycleQualityWalker extends ReadWalker<Integer,Integer> {
|
||||||
|
|
||||||
public void add(byte[] quals) {
|
public void add(byte[] quals) {
|
||||||
if ( quals.length > cycleQualsAv.length )
|
if ( quals.length > cycleQualsAv.length )
|
||||||
throw new UserError("A read of length "+quals.length+" encountered, which exceeds specified maximum read length");
|
throw new UserException("A read of length "+quals.length+" encountered, which exceeds specified maximum read length");
|
||||||
if ( quals.length > maxL ) maxL = quals.length;
|
if ( quals.length > maxL ) maxL = quals.length;
|
||||||
if ( quals.length < minL ) minL = quals.length;
|
if ( quals.length < minL ) minL = quals.length;
|
||||||
readCount++;
|
readCount++;
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,9 @@ import org.broadinstitute.sting.gatk.walkers.DataSource;
|
||||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
import org.broadinstitute.sting.utils.Utils;
|
||||||
import org.broadinstitute.sting.utils.MathUtils;
|
import org.broadinstitute.sting.utils.MathUtils;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.commandline.Output;
|
import org.broadinstitute.sting.commandline.Output;
|
||||||
|
|
@ -77,7 +76,7 @@ public class ReadClippingStatsWalker extends ReadWalker<ReadClippingStatsWalker.
|
||||||
ReadClippingInfo info = new ReadClippingInfo();
|
ReadClippingInfo info = new ReadClippingInfo();
|
||||||
info.rg = read.getReadGroup();
|
info.rg = read.getReadGroup();
|
||||||
|
|
||||||
if ( info.rg == null ) throw new UserError.ReadMissingReadGroup(read);
|
if ( info.rg == null ) throw new UserException.ReadMissingReadGroup(read);
|
||||||
|
|
||||||
for ( CigarElement elt : read.getCigar().getCigarElements() ) {
|
for ( CigarElement elt : read.getCigar().getCigarElements() ) {
|
||||||
if ( elt.getOperator() != CigarOperator.N )
|
if ( elt.getOperator() != CigarOperator.N )
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ import org.broadinstitute.sting.gatk.walkers.*;
|
||||||
import org.broadinstitute.sting.utils.*;
|
import org.broadinstitute.sting.utils.*;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.commandline.Output;
|
import org.broadinstitute.sting.commandline.Output;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
|
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -59,7 +59,7 @@ public class ValidatingPileupWalker extends LocusWalker<Integer, ValidationStats
|
||||||
if ( truePileup == null ) {
|
if ( truePileup == null ) {
|
||||||
out.printf("No truth pileup data available at %s%n", pileup.getPileupString(ref.getBaseAsChar()));
|
out.printf("No truth pileup data available at %s%n", pileup.getPileupString(ref.getBaseAsChar()));
|
||||||
if ( ! CONTINUE_AFTER_AN_ERROR ) {
|
if ( ! CONTINUE_AFTER_AN_ERROR ) {
|
||||||
throw new UserError.CommandLineError(String.format("No pileup data available at %s given GATK's output of %s -- this walker requires samtools pileup data over all bases",
|
throw new UserException.CommandLineException(String.format("No pileup data available at %s given GATK's output of %s -- this walker requires samtools pileup data over all bases",
|
||||||
context.getLocation(), new String(pileup.getBases())));
|
context.getLocation(), new String(pileup.getBases())));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ import org.broadinstitute.sting.utils.collections.NestedHashMap;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.commandline.ArgumentCollection;
|
import org.broadinstitute.sting.commandline.ArgumentCollection;
|
||||||
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
||||||
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
||||||
|
|
||||||
|
|
@ -188,7 +188,7 @@ public class CovariateCounterWalker extends LocusWalker<CovariateCounterWalker.C
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( !foundDBSNP && !RUN_WITHOUT_DBSNP ) {
|
if( !foundDBSNP && !RUN_WITHOUT_DBSNP ) {
|
||||||
throw new UserError.CommandLineError("This calculation is critically dependent on being able to skip over known variant sites. Please provide a dbSNP ROD or a VCF file containing known sites of genetic variation.");
|
throw new UserException.CommandLineException("This calculation is critically dependent on being able to skip over known variant sites. Please provide a dbSNP ROD or a VCF file containing known sites of genetic variation.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the requested covariates by parsing the -cov argument
|
// Initialize the requested covariates by parsing the -cov argument
|
||||||
|
|
@ -197,7 +197,7 @@ public class CovariateCounterWalker extends LocusWalker<CovariateCounterWalker.C
|
||||||
requestedCovariates.add( new ReadGroupCovariate() ); // Order is important here
|
requestedCovariates.add( new ReadGroupCovariate() ); // Order is important here
|
||||||
requestedCovariates.add( new QualityScoreCovariate() );
|
requestedCovariates.add( new QualityScoreCovariate() );
|
||||||
} else {
|
} else {
|
||||||
throw new UserError.CommandLineError("There are more required covariates than expected. The instantiation list needs to be updated with the new required covariate and in the correct order.");
|
throw new UserException.CommandLineException("There are more required covariates than expected. The instantiation list needs to be updated with the new required covariate and in the correct order.");
|
||||||
}
|
}
|
||||||
// Next add the standard covariates if -standard was specified by the user
|
// Next add the standard covariates if -standard was specified by the user
|
||||||
if( USE_STANDARD_COVARIATES ) {
|
if( USE_STANDARD_COVARIATES ) {
|
||||||
|
|
@ -241,7 +241,7 @@ public class CovariateCounterWalker extends LocusWalker<CovariateCounterWalker.C
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !foundClass ) {
|
if( !foundClass ) {
|
||||||
throw new UserError.CommandLineError( "The requested covariate type (" + requestedCovariateString + ") isn't a valid covariate option. Use --list to see possible covariates." );
|
throw new UserException.CommandLineException( "The requested covariate type (" + requestedCovariateString + ") isn't a valid covariate option. Use --list to see possible covariates." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,7 @@ package org.broadinstitute.sting.gatk.walkers.recalibration;
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.BaseUtils;
|
import org.broadinstitute.sting.utils.BaseUtils;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009 The Broad Institute
|
* Copyright (c) 2009 The Broad Institute
|
||||||
|
|
@ -53,7 +51,7 @@ public class CycleCovariate implements StandardCovariate {
|
||||||
RAC.DEFAULT_PLATFORM.contains( "454" ) || RAC.DEFAULT_PLATFORM.equalsIgnoreCase( "SOLID" ) || RAC.DEFAULT_PLATFORM.equalsIgnoreCase( "ABI_SOLID" ) ) {
|
RAC.DEFAULT_PLATFORM.contains( "454" ) || RAC.DEFAULT_PLATFORM.equalsIgnoreCase( "SOLID" ) || RAC.DEFAULT_PLATFORM.equalsIgnoreCase( "ABI_SOLID" ) ) {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
} else {
|
} else {
|
||||||
throw new UserError.CommandLineError("The requested default platform (" + RAC.DEFAULT_PLATFORM +") is not a recognized platform. Implemented options are illumina, 454, and solid");
|
throw new UserException.CommandLineException("The requested default platform (" + RAC.DEFAULT_PLATFORM +") is not a recognized platform. Implemented options are illumina, 454, and solid");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.gatk.walkers.recalibration;
|
package org.broadinstitute.sting.gatk.walkers.recalibration;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
||||||
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
||||||
import org.broadinstitute.sting.utils.*;
|
import org.broadinstitute.sting.utils.*;
|
||||||
|
|
@ -234,7 +234,7 @@ public class RecalDataManager {
|
||||||
readGroup.setPlatform( RAC.DEFAULT_PLATFORM );
|
readGroup.setPlatform( RAC.DEFAULT_PLATFORM );
|
||||||
((GATKSAMRecord)read).setReadGroup( readGroup );
|
((GATKSAMRecord)read).setReadGroup( readGroup );
|
||||||
} else {
|
} else {
|
||||||
throw new UserError.MalformedBam(read, "The input .bam file contains reads with no read group. First observed at read with name = " + read.getReadName() +
|
throw new UserException.MalformedBam(read, "The input .bam file contains reads with no read group. First observed at read with name = " + read.getReadName() +
|
||||||
" Users must set both the default read group using the --default_read_group <String> argument and the default platform using the --default_platform <String> argument." );
|
" Users must set both the default read group using the --default_read_group <String> argument and the default platform using the --default_platform <String> argument." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -260,7 +260,7 @@ public class RecalDataManager {
|
||||||
}
|
}
|
||||||
readGroup.setPlatform( RAC.DEFAULT_PLATFORM );
|
readGroup.setPlatform( RAC.DEFAULT_PLATFORM );
|
||||||
} else {
|
} else {
|
||||||
throw new UserError.MalformedBam(read, "The input .bam file contains reads with no platform information. First observed at read with name = " + read.getReadName() +
|
throw new UserException.MalformedBam(read, "The input .bam file contains reads with no platform information. First observed at read with name = " + read.getReadName() +
|
||||||
" Users must set the default platform using the --default_platform <String> argument." );
|
" Users must set the default platform using the --default_platform <String> argument." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -281,7 +281,7 @@ public class RecalDataManager {
|
||||||
if( attr instanceof String ) {
|
if( attr instanceof String ) {
|
||||||
colorSpace = ((String)attr).getBytes();
|
colorSpace = ((String)attr).getBytes();
|
||||||
} else {
|
} else {
|
||||||
throw new UserError.MalformedBam(read, String.format("Value encoded by %s in %s isn't a string!", RecalDataManager.COLOR_SPACE_ATTRIBUTE_TAG, read.getReadName()));
|
throw new UserException.MalformedBam(read, String.format("Value encoded by %s in %s isn't a string!", RecalDataManager.COLOR_SPACE_ATTRIBUTE_TAG, read.getReadName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop over the read and calculate first the inferred bases from the color and then check if it is consistent with the read
|
// Loop over the read and calculate first the inferred bases from the color and then check if it is consistent with the read
|
||||||
|
|
@ -300,7 +300,7 @@ public class RecalDataManager {
|
||||||
read.setAttribute( RecalDataManager.COLOR_SPACE_INCONSISTENCY_TAG, inconsistency );
|
read.setAttribute( RecalDataManager.COLOR_SPACE_INCONSISTENCY_TAG, inconsistency );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new UserError.MalformedBam(read, "Unable to find color space information in SOLiD read. First observed at read with name = " + read.getReadName() +
|
throw new UserException.MalformedBam(read, "Unable to find color space information in SOLiD read. First observed at read with name = " + read.getReadName() +
|
||||||
" Unfortunately this .bam file can not be recalibrated without color space information because of potential reference bias.");
|
" Unfortunately this .bam file can not be recalibrated without color space information because of potential reference bias.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -357,7 +357,7 @@ public class RecalDataManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new UserError.MalformedBam(read, "Unable to find color space information in SOLiD read. First observed at read with name = " + read.getReadName() +
|
throw new UserException.MalformedBam(read, "Unable to find color space information in SOLiD read. First observed at read with name = " + read.getReadName() +
|
||||||
" Unfortunately this .bam file can not be recalibrated without color space information because of potential reference bias.");
|
" Unfortunately this .bam file can not be recalibrated without color space information because of potential reference bias.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -382,7 +382,7 @@ public class RecalDataManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new UserError.MalformedBam(read, "Unable to find color space information in SOLiD read. First observed at read with name = " + read.getReadName() +
|
throw new UserException.MalformedBam(read, "Unable to find color space information in SOLiD read. First observed at read with name = " + read.getReadName() +
|
||||||
" Unfortunately this .bam file can not be recalibrated without color space information because of potential reference bias.");
|
" Unfortunately this .bam file can not be recalibrated without color space information because of potential reference bias.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -492,7 +492,7 @@ public class RecalDataManager {
|
||||||
}
|
}
|
||||||
read.setReadBases( readBases );
|
read.setReadBases( readBases );
|
||||||
} else { // No color space quality tag in file
|
} else { // No color space quality tag in file
|
||||||
throw new UserError.MalformedBam(read, "REMOVE_REF_BIAS recal mode requires color space qualities but they can't be found for read: " + read.getReadName());
|
throw new UserException.MalformedBam(read, "REMOVE_REF_BIAS recal mode requires color space qualities but they can't be found for read: " + read.getReadName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -513,7 +513,7 @@ public class RecalDataManager {
|
||||||
case '3':
|
case '3':
|
||||||
return performColorThree( prevBase );
|
return performColorThree( prevBase );
|
||||||
default:
|
default:
|
||||||
throw new UserError.MalformedBam(read, "Unrecognized color space in SOLID read, color = " + (char)color +
|
throw new UserException.MalformedBam(read, "Unrecognized color space in SOLID read, color = " + (char)color +
|
||||||
" Unfortunately this bam file can not be recalibrated without full color space information because of potential reference bias.");
|
" Unfortunately this bam file can not be recalibrated without full color space information because of potential reference bias.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ package org.broadinstitute.sting.gatk.walkers.recalibration;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.PrintStream;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
|
@ -46,9 +45,8 @@ import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.utils.classloader.PackageUtils;
|
import org.broadinstitute.sting.utils.classloader.PackageUtils;
|
||||||
import org.broadinstitute.sting.utils.collections.NestedHashMap;
|
import org.broadinstitute.sting.utils.collections.NestedHashMap;
|
||||||
import org.broadinstitute.sting.utils.QualityUtils;
|
import org.broadinstitute.sting.utils.QualityUtils;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.text.TextFormattingUtils;
|
import org.broadinstitute.sting.utils.text.TextFormattingUtils;
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
import org.broadinstitute.sting.utils.Utils;
|
||||||
import org.broadinstitute.sting.utils.text.XReadLines;
|
import org.broadinstitute.sting.utils.text.XReadLines;
|
||||||
|
|
@ -181,7 +179,7 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
|
||||||
// Read in the covariates that were used from the input file
|
// Read in the covariates that were used from the input file
|
||||||
else if( COVARIATE_PATTERN.matcher(line).matches() ) { // The line string is either specifying a covariate or is giving csv data
|
else if( COVARIATE_PATTERN.matcher(line).matches() ) { // The line string is either specifying a covariate or is giving csv data
|
||||||
if( foundAllCovariates ) {
|
if( foundAllCovariates ) {
|
||||||
throw new UserError.MalformedFile( RECAL_FILE, "Malformed input recalibration file. Found covariate names intermingled with data in file: " + RECAL_FILE );
|
throw new UserException.MalformedFile( RECAL_FILE, "Malformed input recalibration file. Found covariate names intermingled with data in file: " + RECAL_FILE );
|
||||||
} else { // Found the covariate list in input file, loop through all of them and instantiate them
|
} else { // Found the covariate list in input file, loop through all of them and instantiate them
|
||||||
String[] vals = line.split(",");
|
String[] vals = line.split(",");
|
||||||
for( int iii = 0; iii < vals.length - 3; iii++ ) { // There are n-3 covariates. The last three items are nObservations, nMismatch, and Qempirical
|
for( int iii = 0; iii < vals.length - 3; iii++ ) { // There are n-3 covariates. The last three items are nObservations, nMismatch, and Qempirical
|
||||||
|
|
@ -200,7 +198,7 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !foundClass ) {
|
if( !foundClass ) {
|
||||||
throw new UserError.MalformedFile(RECAL_FILE, "Malformed input recalibration file. The requested covariate type (" + (vals[iii] + "Covariate") + ") isn't a valid covariate option." );
|
throw new UserException.MalformedFile(RECAL_FILE, "Malformed input recalibration file. The requested covariate type (" + (vals[iii] + "Covariate") + ") isn't a valid covariate option." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -211,7 +209,7 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
|
||||||
|
|
||||||
// At this point all the covariates should have been found and initialized
|
// At this point all the covariates should have been found and initialized
|
||||||
if( requestedCovariates.size() < 2 ) {
|
if( requestedCovariates.size() < 2 ) {
|
||||||
throw new UserError.MalformedFile(RECAL_FILE, "Malformed input recalibration csv file. Covariate names can't be found in file: " + RECAL_FILE );
|
throw new UserException.MalformedFile(RECAL_FILE, "Malformed input recalibration csv file. Covariate names can't be found in file: " + RECAL_FILE );
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean createCollapsedTables = true;
|
final boolean createCollapsedTables = true;
|
||||||
|
|
@ -229,16 +227,16 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch ( FileNotFoundException e ) {
|
} catch ( FileNotFoundException e ) {
|
||||||
throw new UserError.CouldNotReadInputFile(RECAL_FILE, "Can not find input file", e);
|
throw new UserException.CouldNotReadInputFile(RECAL_FILE, "Can not find input file", e);
|
||||||
} catch ( NumberFormatException e ) {
|
} catch ( NumberFormatException e ) {
|
||||||
throw new UserError.MalformedFile(RECAL_FILE, "Error parsing recalibration data at line " + lineNumber + ". Perhaps your table was generated by an older version of CovariateCounterWalker.");
|
throw new UserException.MalformedFile(RECAL_FILE, "Error parsing recalibration data at line " + lineNumber + ". Perhaps your table was generated by an older version of CovariateCounterWalker.");
|
||||||
}
|
}
|
||||||
logger.info( "...done!" );
|
logger.info( "...done!" );
|
||||||
|
|
||||||
if ( !sawEOF ) {
|
if ( !sawEOF ) {
|
||||||
final String errorMessage = "No EOF marker was present in the recal covariates table; this could mean that the file is corrupted or was generated with an old version of the CountCovariates tool.";
|
final String errorMessage = "No EOF marker was present in the recal covariates table; this could mean that the file is corrupted or was generated with an old version of the CountCovariates tool.";
|
||||||
if ( REQUIRE_EOF )
|
if ( REQUIRE_EOF )
|
||||||
throw new UserError.MalformedFile(RECAL_FILE, errorMessage);
|
throw new UserException.MalformedFile(RECAL_FILE, errorMessage);
|
||||||
logger.warn(errorMessage);
|
logger.warn(errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -248,7 +246,7 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
|
||||||
}
|
}
|
||||||
|
|
||||||
if( dataManager == null ) {
|
if( dataManager == null ) {
|
||||||
throw new UserError.MalformedFile(RECAL_FILE, "Can't initialize the data manager. Perhaps the recal csv file contains no data?");
|
throw new UserException.MalformedFile(RECAL_FILE, "Can't initialize the data manager. Perhaps the recal csv file contains no data?");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the tables of empirical quality scores that will be used in the sequential calculation
|
// Create the tables of empirical quality scores that will be used in the sequential calculation
|
||||||
|
|
@ -303,7 +301,7 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
|
||||||
|
|
||||||
// Check if the data line is malformed, for example if the read group string contains a comma then it won't be parsed correctly
|
// Check if the data line is malformed, for example if the read group string contains a comma then it won't be parsed correctly
|
||||||
if( vals.length != requestedCovariates.size() + 3 ) { // +3 because of nObservations, nMismatch, and Qempirical
|
if( vals.length != requestedCovariates.size() + 3 ) { // +3 because of nObservations, nMismatch, and Qempirical
|
||||||
throw new UserError.MalformedFile(file, "Malformed input recalibration file. Found data line with too many fields: " + line +
|
throw new UserException.MalformedFile(file, "Malformed input recalibration file. Found data line with too many fields: " + line +
|
||||||
" --Perhaps the read group string contains a comma and isn't being parsed correctly.");
|
" --Perhaps the read group string contains a comma and isn't being parsed correctly.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,9 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.gatk.walkers.recalibration;
|
package org.broadinstitute.sting.gatk.walkers.recalibration;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
import net.sf.picard.util.IlluminaUtil;
|
import net.sf.picard.util.IlluminaUtil;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author alecw@broadinstitute.org
|
* @author alecw@broadinstitute.org
|
||||||
|
|
@ -48,7 +47,7 @@ public class TileCovariate implements ExperimentalCovariate {
|
||||||
Integer tile = IlluminaUtil.getTileFromReadName(read.getReadName());
|
Integer tile = IlluminaUtil.getTileFromReadName(read.getReadName());
|
||||||
if (tile == null) {
|
if (tile == null) {
|
||||||
if( exceptionWhenNoTile ) {
|
if( exceptionWhenNoTile ) {
|
||||||
throw new UserError.MalformedBam(read, "Tile covariate specified but tile number not defined for read: " + read.getReadName() );
|
throw new UserException.MalformedBam(read, "Tile covariate specified but tile number not defined for read: " + read.getReadName() );
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,8 @@ import org.broadinstitute.sting.playground.utils.report.tags.Analysis;
|
||||||
import org.broadinstitute.sting.playground.utils.report.tags.DataPoint;
|
import org.broadinstitute.sting.playground.utils.report.tags.DataPoint;
|
||||||
import org.broadinstitute.sting.playground.utils.report.utils.TableType;
|
import org.broadinstitute.sting.playground.utils.report.utils.TableType;
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
@ -402,7 +401,7 @@ class SampleStats implements TableType {
|
||||||
if ( concordanceStats.containsKey(sample) )
|
if ( concordanceStats.containsKey(sample) )
|
||||||
concordanceStats.get(sample)[truth.ordinal()][called.ordinal()]++;
|
concordanceStats.get(sample)[truth.ordinal()][called.ordinal()]++;
|
||||||
else if ( called != Genotype.Type.NO_CALL )
|
else if ( called != Genotype.Type.NO_CALL )
|
||||||
throw new UserError.CommandLineError("Sample " + sample + " has not been seen in a previous eval; this analysis module assumes that all samples are present in each variant context");
|
throw new UserException.CommandLineException("Sample " + sample + " has not been seen in a previous eval; this analysis module assumes that all samples are present in each variant context");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -47,12 +47,11 @@ import org.broadinstitute.sting.playground.utils.report.templates.ReportFormat;
|
||||||
import org.broadinstitute.sting.playground.utils.report.utils.Node;
|
import org.broadinstitute.sting.playground.utils.report.utils.Node;
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.classloader.PackageUtils;
|
import org.broadinstitute.sting.utils.classloader.PackageUtils;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
import org.broadinstitute.sting.utils.Utils;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.commandline.Output;
|
import org.broadinstitute.sting.commandline.Output;
|
||||||
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.text.XReadLines;
|
import org.broadinstitute.sting.utils.text.XReadLines;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
@ -60,7 +59,6 @@ import java.io.FileNotFoundException;
|
||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
// todo -- evalations should support comment lines
|
// todo -- evalations should support comment lines
|
||||||
|
|
@ -310,7 +308,7 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> {
|
||||||
}
|
}
|
||||||
ReportFormat.AcceptableOutputType type = (outputLocation == null) ? ReportFormat.AcceptableOutputType.STREAM : ReportFormat.AcceptableOutputType.FILE;
|
ReportFormat.AcceptableOutputType type = (outputLocation == null) ? ReportFormat.AcceptableOutputType.STREAM : ReportFormat.AcceptableOutputType.FILE;
|
||||||
if (!VE2ReportFactory.isCompatibleWithOutputType(type,reportType))
|
if (!VE2ReportFactory.isCompatibleWithOutputType(type,reportType))
|
||||||
throw new UserError.CommandLineError("The report format requested is not compatible with your output location. You specified a " + type + " output type which isn't an option for " + reportType);
|
throw new UserException.CommandLineException("The report format requested is not compatible with your output location. You specified a " + type + " output type which isn't an option for " + reportType);
|
||||||
if ( LIST )
|
if ( LIST )
|
||||||
listModulesAndExit();
|
listModulesAndExit();
|
||||||
|
|
||||||
|
|
@ -378,7 +376,7 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> {
|
||||||
for ( String line : new XReadLines(rsIDFile) ) {
|
for ( String line : new XReadLines(rsIDFile) ) {
|
||||||
String parts[] = line.split(" ");
|
String parts[] = line.split(" ");
|
||||||
if ( parts.length != 2 )
|
if ( parts.length != 2 )
|
||||||
throw new UserError.MalformedFile(rsIDFile, "Invalid rsID / build pair at " + n + " line = " + line );
|
throw new UserException.MalformedFile(rsIDFile, "Invalid rsID / build pair at " + n + " line = " + line );
|
||||||
//System.out.printf("line %s %s %s%n", line, parts[0], parts[1]);
|
//System.out.printf("line %s %s %s%n", line, parts[0], parts[1]);
|
||||||
if ( Integer.valueOf(parts[1]) > maxRsIDBuild ) {
|
if ( Integer.valueOf(parts[1]) > maxRsIDBuild ) {
|
||||||
//System.out.printf("Excluding %s%n", line);
|
//System.out.printf("Excluding %s%n", line);
|
||||||
|
|
@ -390,7 +388,7 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> {
|
||||||
logger.info(String.format("Read %d rsIDs from rsID -> build file", n));
|
logger.info(String.format("Read %d rsIDs from rsID -> build file", n));
|
||||||
}
|
}
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(rsIDFile, e);
|
throw new UserException.CouldNotReadInputFile(rsIDFile, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info(String.format("Excluding %d of %d (%.2f%%) rsIDs found from builds > %d",
|
logger.info(String.format("Excluding %d of %d (%.2f%%) rsIDs found from builds > %d",
|
||||||
|
|
@ -425,7 +423,7 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> {
|
||||||
// get the specific classes provided
|
// get the specific classes provided
|
||||||
for ( String module : modulesToUse ) {
|
for ( String module : modulesToUse ) {
|
||||||
if ( !classMap.containsKey(module) )
|
if ( !classMap.containsKey(module) )
|
||||||
throw new UserError.CommandLineError("Module " + module + " could not be found; please check that you have specified the class name correctly");
|
throw new UserException.CommandLineException("Module " + module + " could not be found; please check that you have specified the class name correctly");
|
||||||
evaluationClasses.add(classMap.get(module));
|
evaluationClasses.add(classMap.get(module));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -672,7 +670,7 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> {
|
||||||
for ( String name : names ) {
|
for ( String name : names ) {
|
||||||
Collection<VariantContext> contexts = tracker.getVariantContexts(ref, name, ALLOW_VARIANT_CONTEXT_TYPES, context.getLocation(), true, true);
|
Collection<VariantContext> contexts = tracker.getVariantContexts(ref, name, ALLOW_VARIANT_CONTEXT_TYPES, context.getLocation(), true, true);
|
||||||
if ( contexts.size() > 1 )
|
if ( contexts.size() > 1 )
|
||||||
throw new UserError.CommandLineError("Found multiple variant contexts found in " + name + " at " + context.getLocation() + "; VariantEval assumes one variant per position");
|
throw new UserException.CommandLineException("Found multiple variant contexts found in " + name + " at " + context.getLocation() + "; VariantEval assumes one variant per position");
|
||||||
|
|
||||||
VariantContext vc = contexts.size() == 1 ? contexts.iterator().next() : null;
|
VariantContext vc = contexts.size() == 1 ? contexts.iterator().next() : null;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
||||||
import org.broadinstitute.sting.utils.*;
|
import org.broadinstitute.sting.utils.*;
|
||||||
import org.broadinstitute.sting.utils.collections.ExpandingArrayList;
|
import org.broadinstitute.sting.utils.collections.ExpandingArrayList;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.vcf.VCFUtils;
|
import org.broadinstitute.sting.utils.vcf.VCFUtils;
|
||||||
import org.broadinstitute.sting.utils.text.XReadLines;
|
import org.broadinstitute.sting.utils.text.XReadLines;
|
||||||
|
|
||||||
|
|
@ -128,7 +128,7 @@ public class ApplyVariantCuts extends RodWalker<Integer, Integer> {
|
||||||
|
|
||||||
return tranches;
|
return tranches;
|
||||||
} catch( FileNotFoundException e ) {
|
} catch( FileNotFoundException e ) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(f, e);
|
throw new UserException.CouldNotCreateOutputFile(f, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -156,7 +156,7 @@ public class ApplyVariantCuts extends RodWalker<Integer, Integer> {
|
||||||
firstLine = false;
|
firstLine = false;
|
||||||
}
|
}
|
||||||
} catch( FileNotFoundException e ) {
|
} catch( FileNotFoundException e ) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(TRANCHES_FILE, e);
|
throw new UserException.CouldNotCreateOutputFile(TRANCHES_FILE, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup the header fields
|
// setup the header fields
|
||||||
|
|
|
||||||
|
|
@ -30,21 +30,14 @@ import org.broad.tribble.util.variantcontext.VariantContext;
|
||||||
import org.broadinstitute.sting.commandline.Output;
|
import org.broadinstitute.sting.commandline.Output;
|
||||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
|
|
||||||
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.ReferenceOrderedDataSource;
|
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.ReferenceOrderedDataSource;
|
||||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||||
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrack;
|
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.helpers.DbSNPHelper;
|
import org.broadinstitute.sting.gatk.refdata.utils.helpers.DbSNPHelper;
|
||||||
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
||||||
import org.broadinstitute.sting.utils.BaseUtils;
|
|
||||||
import org.broadinstitute.sting.utils.collections.ExpandingArrayList;
|
import org.broadinstitute.sting.utils.collections.ExpandingArrayList;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
@ -148,7 +141,7 @@ public class GenerateVariantClustersWalker extends RodWalker<ExpandingArrayList<
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!foundDBSNP) {
|
if(!foundDBSNP) {
|
||||||
throw new UserError.CommandLineError("dbSNP track is required. This calculation is critically dependent on being able to distinguish known and novel sites.");
|
throw new UserException.CommandLineException("dbSNP track is required. This calculation is critically dependent on being able to distinguish known and novel sites.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -240,7 +233,7 @@ public class GenerateVariantClustersWalker extends RodWalker<ExpandingArrayList<
|
||||||
// theModel = new VariantNearestNeighborsModel( dataManager, TARGET_TITV, NUM_KNN );
|
// theModel = new VariantNearestNeighborsModel( dataManager, TARGET_TITV, NUM_KNN );
|
||||||
// break;
|
// break;
|
||||||
default:
|
default:
|
||||||
throw new UserError.BadArgumentValue("OPTIMIZATION_MODEL", "Variant Optimization Model is unrecognized. Implemented options are GAUSSIAN_MIXTURE_MODEL and K_NEAREST_NEIGHBORS" );
|
throw new UserException.BadArgumentValue("OPTIMIZATION_MODEL", "Variant Optimization Model is unrecognized. Implemented options are GAUSSIAN_MIXTURE_MODEL and K_NEAREST_NEIGHBORS" );
|
||||||
}
|
}
|
||||||
|
|
||||||
theModel.run( CLUSTER_FILE );
|
theModel.run( CLUSTER_FILE );
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,7 @@ package org.broadinstitute.sting.gatk.walkers.variantrecalibration;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.broadinstitute.sting.utils.collections.ExpandingArrayList;
|
import org.broadinstitute.sting.utils.collections.ExpandingArrayList;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
|
||||||
|
|
@ -54,7 +53,7 @@ public class VariantDataManager {
|
||||||
numVariants = dataList.size();
|
numVariants = dataList.size();
|
||||||
data = dataList.toArray( new VariantDatum[numVariants] );
|
data = dataList.toArray( new VariantDatum[numVariants] );
|
||||||
if( numVariants <= 0 ) {
|
if( numVariants <= 0 ) {
|
||||||
throw new UserError.BadInput("There are zero variants with > 0 clustering weight! Please provide sets of known polymorphic loci to be used as training data using the dbsnp, hapmap, or 1kg rod bindings. Clustering weights can be specified using -weightDBSNP, -weightHapMap, and -weight1KG" );
|
throw new UserException.BadInput("There are zero variants with > 0 clustering weight! Please provide sets of known polymorphic loci to be used as training data using the dbsnp, hapmap, or 1kg rod bindings. Clustering weights can be specified using -weightDBSNP, -weightHapMap, and -weight1KG" );
|
||||||
}
|
}
|
||||||
if( _annotationKeys == null ) {
|
if( _annotationKeys == null ) {
|
||||||
numAnnotations = 0;
|
numAnnotations = 0;
|
||||||
|
|
@ -63,7 +62,7 @@ public class VariantDataManager {
|
||||||
} else {
|
} else {
|
||||||
numAnnotations = _annotationKeys.size();
|
numAnnotations = _annotationKeys.size();
|
||||||
if( numAnnotations <= 0 ) {
|
if( numAnnotations <= 0 ) {
|
||||||
throw new UserError.BadInput("There are zero annotations. At least one annotation must be provided to use this walker!" );
|
throw new UserException.BadInput("There are zero annotations. At least one annotation must be provided to use this walker!" );
|
||||||
}
|
}
|
||||||
meanVector = new double[numAnnotations];
|
meanVector = new double[numAnnotations];
|
||||||
varianceVector = new double[numAnnotations];
|
varianceVector = new double[numAnnotations];
|
||||||
|
|
@ -111,7 +110,7 @@ public class VariantDataManager {
|
||||||
}
|
}
|
||||||
isNormalized = true; // Each data point is now [ (x - mean) / standard deviation ]
|
isNormalized = true; // Each data point is now [ (x - mean) / standard deviation ]
|
||||||
if( foundZeroVarianceAnnotation ) {
|
if( foundZeroVarianceAnnotation ) {
|
||||||
throw new UserError.BadInput("Found annotations with zero variance. They must be excluded before proceeding.");
|
throw new UserException.BadInput("Found annotations with zero variance. They must be excluded before proceeding.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,7 @@ import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.MathUtils;
|
import org.broadinstitute.sting.utils.MathUtils;
|
||||||
import org.broadinstitute.sting.utils.collections.ExpandingArrayList;
|
import org.broadinstitute.sting.utils.collections.ExpandingArrayList;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
import org.broadinstitute.sting.utils.text.XReadLines;
|
import org.broadinstitute.sting.utils.text.XReadLines;
|
||||||
|
|
||||||
import Jama.*;
|
import Jama.*;
|
||||||
|
|
@ -132,11 +131,11 @@ public final class VariantGaussianMixtureModel extends VariantOptimizationModel
|
||||||
} else if( CLUSTER_PATTERN.matcher(line).matches() ) {
|
} else if( CLUSTER_PATTERN.matcher(line).matches() ) {
|
||||||
clusterLines.add(line);
|
clusterLines.add(line);
|
||||||
} else {
|
} else {
|
||||||
throw new UserError.MalformedFile(clusterFile, "Could not parse line: " + line);
|
throw new UserException.MalformedFile(clusterFile, "Could not parse line: " + line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch ( FileNotFoundException e ) {
|
} catch ( FileNotFoundException e ) {
|
||||||
throw new UserError.CouldNotReadInputFile(clusterFile, e);
|
throw new UserException.CouldNotReadInputFile(clusterFile, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
dataManager = new VariantDataManager( annotationLines );
|
dataManager = new VariantDataManager( annotationLines );
|
||||||
|
|
@ -430,7 +429,7 @@ public final class VariantGaussianMixtureModel extends VariantOptimizationModel
|
||||||
try {
|
try {
|
||||||
value = Double.parseDouble( (String)vc.getAttribute( annotationKey ) );
|
value = Double.parseDouble( (String)vc.getAttribute( annotationKey ) );
|
||||||
} catch( NumberFormatException e ) {
|
} catch( NumberFormatException e ) {
|
||||||
throw new UserError.MalformedFile(vc.getName(), "No double value detected for annotation = " + annotationKey + " in variant at " + VariantContextUtils.getLocation(vc) + ", reported annotation value = " + vc.getAttribute( annotationKey ), e );
|
throw new UserException.MalformedFile(vc.getName(), "No double value detected for annotation = " + annotationKey + " in variant at " + VariantContextUtils.getLocation(vc) + ", reported annotation value = " + vc.getAttribute( annotationKey ), e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
|
|
@ -493,7 +492,7 @@ public final class VariantGaussianMixtureModel extends VariantOptimizationModel
|
||||||
try {
|
try {
|
||||||
outputFile = new PrintStream( file );
|
outputFile = new PrintStream( file );
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
throw new UserError.CouldNotCreateOutputFile( file, e );
|
throw new UserException.CouldNotCreateOutputFile( file, e );
|
||||||
}
|
}
|
||||||
|
|
||||||
outputFile.println("annotationValue,knownDist,novelDist");
|
outputFile.println("annotationValue,knownDist,novelDist");
|
||||||
|
|
|
||||||
|
|
@ -35,18 +35,16 @@ import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
|
import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
|
||||||
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.ReferenceOrderedDataSource;
|
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.ReferenceOrderedDataSource;
|
||||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||||
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrack;
|
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.helpers.DbSNPHelper;
|
import org.broadinstitute.sting.gatk.refdata.utils.helpers.DbSNPHelper;
|
||||||
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
||||||
import org.broadinstitute.sting.utils.*;
|
import org.broadinstitute.sting.utils.*;
|
||||||
import org.broadinstitute.sting.utils.collections.ExpandingArrayList;
|
import org.broadinstitute.sting.utils.collections.ExpandingArrayList;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.vcf.VCFUtils;
|
import org.broadinstitute.sting.utils.vcf.VCFUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
@ -144,7 +142,7 @@ public class VariantRecalibrator extends RodWalker<ExpandingArrayList<VariantDat
|
||||||
// theModel = new VariantNearestNeighborsModel( dataManager, TARGET_TITV, NUM_KNN );
|
// theModel = new VariantNearestNeighborsModel( dataManager, TARGET_TITV, NUM_KNN );
|
||||||
// break;
|
// break;
|
||||||
default:
|
default:
|
||||||
throw new UserError.BadArgumentValue("OPTIMIZATION_MODEL", "Variant Optimization Model is unrecognized. Implemented options are GAUSSIAN_MIXTURE_MODEL and K_NEAREST_NEIGHBORS" );
|
throw new UserException.BadArgumentValue("OPTIMIZATION_MODEL", "Variant Optimization Model is unrecognized. Implemented options are GAUSSIAN_MIXTURE_MODEL and K_NEAREST_NEIGHBORS" );
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean foundDBSNP = false;
|
boolean foundDBSNP = false;
|
||||||
|
|
@ -167,7 +165,7 @@ public class VariantRecalibrator extends RodWalker<ExpandingArrayList<VariantDat
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!foundDBSNP) {
|
if(!foundDBSNP) {
|
||||||
throw new UserError.CommandLineError("dbSNP track is required. This calculation is critically dependent on being able to distinguish known and novel sites.");
|
throw new UserException.CommandLineException("dbSNP track is required. This calculation is critically dependent on being able to distinguish known and novel sites.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup the header fields
|
// setup the header fields
|
||||||
|
|
@ -233,7 +231,7 @@ public class VariantRecalibrator extends RodWalker<ExpandingArrayList<VariantDat
|
||||||
final double totalPrior = 1.0 - ((1.0 - acPrior) * (1.0 - knownPrior));
|
final double totalPrior = 1.0 - ((1.0 - acPrior) * (1.0 - knownPrior));
|
||||||
|
|
||||||
if( MathUtils.compareDoubles(totalPrior, 1.0, 1E-8) == 0 || MathUtils.compareDoubles(totalPrior, 0.0, 1E-8) == 0 ) {
|
if( MathUtils.compareDoubles(totalPrior, 1.0, 1E-8) == 0 || MathUtils.compareDoubles(totalPrior, 0.0, 1E-8) == 0 ) {
|
||||||
throw new UserError.CommandLineError("Something is wrong with the prior that was entered by the user: Prior = " + totalPrior); // TODO - fix this up later
|
throw new UserException.CommandLineException("Something is wrong with the prior that was entered by the user: Prior = " + totalPrior); // TODO - fix this up later
|
||||||
}
|
}
|
||||||
|
|
||||||
final double pVar = theModel.evaluateVariant( vc );
|
final double pVar = theModel.evaluateVariant( vc );
|
||||||
|
|
@ -286,7 +284,7 @@ public class VariantRecalibrator extends RodWalker<ExpandingArrayList<VariantDat
|
||||||
PrintStream reportDatFilePrintStream = new PrintStream(REPORT_DAT_FILE);
|
PrintStream reportDatFilePrintStream = new PrintStream(REPORT_DAT_FILE);
|
||||||
theModel.outputOptimizationCurve( dataManager.data, reportDatFilePrintStream, TRANCHES_FILE, DESIRED_NUM_VARIANTS, FDR_TRANCHES, QUAL_STEP );
|
theModel.outputOptimizationCurve( dataManager.data, reportDatFilePrintStream, TRANCHES_FILE, DESIRED_NUM_VARIANTS, FDR_TRANCHES, QUAL_STEP );
|
||||||
} catch ( FileNotFoundException e ) {
|
} catch ( FileNotFoundException e ) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(REPORT_DAT_FILE, e);
|
throw new UserException.CouldNotCreateOutputFile(REPORT_DAT_FILE, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute Rscript command to plot the optimization curve
|
// Execute Rscript command to plot the optimization curve
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ import org.broadinstitute.sting.gatk.walkers.annotator.VariantAnnotatorEngine;
|
||||||
import org.broadinstitute.sting.utils.SampleUtils;
|
import org.broadinstitute.sting.utils.SampleUtils;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.commandline.Output;
|
import org.broadinstitute.sting.commandline.Output;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.vcf.VCFUtils;
|
import org.broadinstitute.sting.utils.vcf.VCFUtils;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -107,7 +107,7 @@ public class CombineVariants extends RodWalker<Integer, Integer> {
|
||||||
Set<String> rodNames = SampleUtils.getRodNamesWithVCFHeader(getToolkit(), null);
|
Set<String> rodNames = SampleUtils.getRodNamesWithVCFHeader(getToolkit(), null);
|
||||||
|
|
||||||
if ( genotypeMergeOption == VariantContextUtils.GenotypeMergeType.PRIORITIZE && PRIORITY_STRING == null )
|
if ( genotypeMergeOption == VariantContextUtils.GenotypeMergeType.PRIORITIZE && PRIORITY_STRING == null )
|
||||||
throw new UserError.MissingArgument("rod_priority_list", "Priority string must be provided if you want to prioritize genotypes");
|
throw new UserException.MissingArgument("rod_priority_list", "Priority string must be provided if you want to prioritize genotypes");
|
||||||
|
|
||||||
if ( genotypeMergeOption == VariantContextUtils.GenotypeMergeType.PRIORITIZE )
|
if ( genotypeMergeOption == VariantContextUtils.GenotypeMergeType.PRIORITIZE )
|
||||||
priority = new ArrayList<String>(Arrays.asList(PRIORITY_STRING.split(",")));
|
priority = new ArrayList<String>(Arrays.asList(PRIORITY_STRING.split(",")));
|
||||||
|
|
@ -115,10 +115,10 @@ public class CombineVariants extends RodWalker<Integer, Integer> {
|
||||||
priority = new ArrayList<String>(rodNames);
|
priority = new ArrayList<String>(rodNames);
|
||||||
|
|
||||||
if ( rodNames.size() != priority.size() )
|
if ( rodNames.size() != priority.size() )
|
||||||
throw new UserError.BadArgumentValue("rod_priority_list", "The priority list must contain exactly one rod binding per ROD provided to the GATK: rodNames=" + rodNames + " priority=" + priority);
|
throw new UserException.BadArgumentValue("rod_priority_list", "The priority list must contain exactly one rod binding per ROD provided to the GATK: rodNames=" + rodNames + " priority=" + priority);
|
||||||
|
|
||||||
if ( ! rodNames.containsAll(priority) )
|
if ( ! rodNames.containsAll(priority) )
|
||||||
throw new UserError.BadArgumentValue("rod_priority_list", "Not all priority elements provided as input RODs: " + PRIORITY_STRING);
|
throw new UserException.BadArgumentValue("rod_priority_list", "Not all priority elements provided as input RODs: " + PRIORITY_STRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,9 @@ import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.AnnotationType
|
||||||
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.GenotypeAnnotation;
|
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.GenotypeAnnotation;
|
||||||
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
|
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.utils.classloader.PackageUtils;
|
import org.broadinstitute.sting.utils.classloader.PackageUtils;
|
||||||
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
@ -92,7 +91,7 @@ public class AnnotationByAlleleFrequencyWalker extends RodWalker<Integer, Integ
|
||||||
if ( interfaceClass == null )
|
if ( interfaceClass == null )
|
||||||
interfaceClass = classMap.get(group + "Annotation");
|
interfaceClass = classMap.get(group + "Annotation");
|
||||||
if ( interfaceClass == null )
|
if ( interfaceClass == null )
|
||||||
throw new UserError.BadArgumentValue("group", "Class " + group + " is not found; please check that you have specified the class name correctly");
|
throw new UserException.BadArgumentValue("group", "Class " + group + " is not found; please check that you have specified the class name correctly");
|
||||||
classes.addAll(PackageUtils.getClassesImplementingInterface(interfaceClass));
|
classes.addAll(PackageUtils.getClassesImplementingInterface(interfaceClass));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -102,7 +101,7 @@ public class AnnotationByAlleleFrequencyWalker extends RodWalker<Integer, Integ
|
||||||
if ( annotationClass == null )
|
if ( annotationClass == null )
|
||||||
annotationClass = classMap.get(annotation + "Annotation");
|
annotationClass = classMap.get(annotation + "Annotation");
|
||||||
if ( annotationClass == null )
|
if ( annotationClass == null )
|
||||||
throw new UserError.BadArgumentValue("annotation", "Class " + annotation + " is not found; please check that you have specified the class name correctly");
|
throw new UserException.BadArgumentValue("annotation", "Class " + annotation + " is not found; please check that you have specified the class name correctly");
|
||||||
classes.add(annotationClass);
|
classes.add(annotationClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.commandline.Output;
|
import org.broadinstitute.sting.commandline.Output;
|
||||||
import org.broadinstitute.sting.utils.*;
|
import org.broadinstitute.sting.utils.*;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
|
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
@ -87,7 +87,7 @@ public class BaseTransitionTableCalculatorJavaWalker extends LocusWalker<Set<Bas
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
if ( nPreviousBases > 3 || ( nPreviousReadBases > 3 && readBasesMustMatchRef ) ) {
|
if ( nPreviousBases > 3 || ( nPreviousReadBases > 3 && readBasesMustMatchRef ) ) {
|
||||||
throw new UserError.CommandLineError("You have opted to use a number of previous bases in excess of 3. In order to do this you must change the reference window size in the walker itself.");
|
throw new UserException.CommandLineException("You have opted to use a number of previous bases in excess of 3. In order to do this you must change the reference window size in the walker itself.");
|
||||||
}
|
}
|
||||||
UnifiedArgumentCollection uac = new UnifiedArgumentCollection();
|
UnifiedArgumentCollection uac = new UnifiedArgumentCollection();
|
||||||
uac.baseModel = BaseMismatchModel.THREE_STATE;
|
uac.baseModel = BaseMismatchModel.THREE_STATE;
|
||||||
|
|
@ -151,7 +151,7 @@ public class BaseTransitionTableCalculatorJavaWalker extends LocusWalker<Set<Bas
|
||||||
String errMsg = "Parallelization cannot be used with UsePreviousBases due to the fact that internal walker data specifies whether a previous reference base is usable or not.";
|
String errMsg = "Parallelization cannot be used with UsePreviousBases due to the fact that internal walker data specifies whether a previous reference base is usable or not.";
|
||||||
String errMsg2 = " This can cause cause concurrency issues and unpredictable behavior when used with parallelization. Either do not specify -nt, or try a the conjunction of ";
|
String errMsg2 = " This can cause cause concurrency issues and unpredictable behavior when used with parallelization. Either do not specify -nt, or try a the conjunction of ";
|
||||||
String errMsg3 = "--usePreviousReadBases and --forcePreviousReadBasesToMatchRef.";
|
String errMsg3 = "--usePreviousReadBases and --forcePreviousReadBasesToMatchRef.";
|
||||||
throw new UserError.CommandLineError(errMsg+errMsg2+errMsg3);
|
throw new UserException.CommandLineException(errMsg+errMsg2+errMsg3);
|
||||||
}
|
}
|
||||||
return reduce(reduce1,reduce2);
|
return reduce(reduce1,reduce2);
|
||||||
}
|
}
|
||||||
|
|
@ -164,7 +164,7 @@ public class BaseTransitionTableCalculatorJavaWalker extends LocusWalker<Set<Bas
|
||||||
try {
|
try {
|
||||||
output = new PrintStream(outFilePath);
|
output = new PrintStream(outFilePath);
|
||||||
} catch ( FileNotFoundException e ) {
|
} catch ( FileNotFoundException e ) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(new File(outFilePath), e);
|
throw new UserException.CouldNotCreateOutputFile(new File(outFilePath), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
output.print(createHeaderFromConditions());
|
output.print(createHeaderFromConditions());
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.commandline.Output;
|
import org.broadinstitute.sting.commandline.Output;
|
||||||
import org.broadinstitute.sting.utils.*;
|
import org.broadinstitute.sting.utils.*;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
|
|
||||||
|
|
@ -391,7 +391,7 @@ public class DSBWalkerV3 extends ReadWalker<Integer,Integer> {
|
||||||
} else if ( controlReadGroups.contains( read.getReadGroup().getReadGroupId() )) {
|
} else if ( controlReadGroups.contains( read.getReadGroup().getReadGroupId() )) {
|
||||||
addControl(read);
|
addControl(read);
|
||||||
} else {
|
} else {
|
||||||
throw new UserError.MalformedBam(read, "Read "+read + " belongs to unrecognized read group");
|
throw new UserException.MalformedBam(read, "Read "+read + " belongs to unrecognized read group");
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
package org.broadinstitute.sting.oneoffprojects.walkers;
|
package org.broadinstitute.sting.oneoffprojects.walkers;
|
||||||
|
|
||||||
import net.sf.samtools.util.CloseableIterator;
|
|
||||||
import org.broad.tribble.FeatureIterator;
|
|
||||||
import org.broad.tribble.FeatureSource;
|
import org.broad.tribble.FeatureSource;
|
||||||
import org.broad.tribble.dbsnp.DbSNPCodec;
|
import org.broad.tribble.dbsnp.DbSNPCodec;
|
||||||
import org.broad.tribble.dbsnp.DbSNPFeature;
|
import org.broad.tribble.dbsnp.DbSNPFeature;
|
||||||
|
|
@ -16,11 +14,9 @@ import org.broadinstitute.sting.gatk.walkers.By;
|
||||||
import org.broadinstitute.sting.gatk.walkers.DataSource;
|
import org.broadinstitute.sting.gatk.walkers.DataSource;
|
||||||
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
|
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
|
||||||
import org.broadinstitute.sting.gatk.walkers.Requires;
|
import org.broadinstitute.sting.gatk.walkers.Requires;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
|
||||||
|
|
@ -69,7 +65,7 @@ public class DbSNPWindowCounter extends LocusWalker<Integer, Long> {
|
||||||
windowStart,
|
windowStart,
|
||||||
windowStop);
|
windowStop);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(myDbSNPFile, e);
|
throw new UserException.CouldNotReadInputFile(myDbSNPFile, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// count the number of dbSNPs we've seen
|
// count the number of dbSNPs we've seen
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,7 @@ import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||||
import org.broadinstitute.sting.utils.SampleUtils;
|
import org.broadinstitute.sting.utils.SampleUtils;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
import org.broadinstitute.sting.utils.vcf.VCFUtils;
|
import org.broadinstitute.sting.utils.vcf.VCFUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
@ -43,7 +42,7 @@ public class IndelAnnotator extends RodWalker<Integer,Long> {
|
||||||
try {
|
try {
|
||||||
refseqIterator = new SeekableRODIterator(new FeatureToGATKFeatureIterator(refseq.iterator(),"refseq"));
|
refseqIterator = new SeekableRODIterator(new FeatureToGATKFeatureIterator(refseq.iterator(),"refseq"));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(RefseqFileName, e);
|
throw new UserException.CouldNotReadInputFile(RefseqFileName, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("Using RefSeq annotations from " + RefseqFileName);
|
logger.info("Using RefSeq annotations from " + RefseqFileName);
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,8 @@ import org.broadinstitute.sting.gatk.walkers.Reference;
|
||||||
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
||||||
import org.broadinstitute.sting.gatk.walkers.Window;
|
import org.broadinstitute.sting.gatk.walkers.Window;
|
||||||
import org.broadinstitute.sting.utils.SampleUtils;
|
import org.broadinstitute.sting.utils.SampleUtils;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.utils.collections.ExpandingArrayList;
|
import org.broadinstitute.sting.utils.collections.ExpandingArrayList;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.vcf.VCFUtils;
|
import org.broadinstitute.sting.utils.vcf.VCFUtils;
|
||||||
|
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
|
@ -46,7 +45,7 @@ public class IndelDBRateWalker extends RodWalker<OverlapTable,OverlapTabulator>
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
if ( indelWindow > 40 ) {
|
if ( indelWindow > 40 ) {
|
||||||
throw new UserError.CommandLineError("Indel windows have a maximum size of 40");
|
throw new UserException.CommandLineException("Indel windows have a maximum size of 40");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( outVCF != null ) {
|
if ( outVCF != null ) {
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,7 @@ import java.io.IOException;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.QualityUtils;
|
import org.broadinstitute.sting.utils.QualityUtils;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
|
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
|
||||||
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
|
|
@ -170,7 +169,7 @@ public class QualityScoreByStrandWalker extends LocusWalker<StrandedCounts,Stran
|
||||||
pairOut.close();
|
pairOut.close();
|
||||||
}
|
}
|
||||||
} catch ( IOException e ) {
|
} catch ( IOException e ) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(new File(pairOutput), e);
|
throw new UserException.CouldNotCreateOutputFile(new File(pairOutput), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,10 +32,9 @@ import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.commandline.Output;
|
import org.broadinstitute.sting.commandline.Output;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
import net.sf.samtools.SAMFileWriter;
|
import net.sf.samtools.SAMFileWriter;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
|
|
@ -80,9 +79,9 @@ public class ReadQualityScoreWalker extends ReadWalker<SAMRecord, SAMFileWriter>
|
||||||
try {
|
try {
|
||||||
inputReader = new BufferedReader( new FileReader ( inputQualityFile ) );
|
inputReader = new BufferedReader( new FileReader ( inputQualityFile ) );
|
||||||
} catch ( FileNotFoundException e) {
|
} catch ( FileNotFoundException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(new File(inputQualityFile), e);
|
throw new UserException.CouldNotReadInputFile(new File(inputQualityFile), e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(new File(inputQualityFile), e);
|
throw new UserException.CouldNotReadInputFile(new File(inputQualityFile), e);
|
||||||
}
|
}
|
||||||
return outputBamFile;
|
return outputBamFile;
|
||||||
}
|
}
|
||||||
|
|
@ -104,13 +103,13 @@ public class ReadQualityScoreWalker extends ReadWalker<SAMRecord, SAMFileWriter>
|
||||||
try {
|
try {
|
||||||
if( line == null ) {
|
if( line == null ) {
|
||||||
line = inputReader.readLine();
|
line = inputReader.readLine();
|
||||||
if( line == null ) { throw new UserError.MalformedFile(new File(inputQualityFile), "Input file is empty" ); }
|
if( line == null ) { throw new UserException.MalformedFile(new File(inputQualityFile), "Input file is empty" ); }
|
||||||
}
|
}
|
||||||
String[] halves = line.split( " ", 2 );
|
String[] halves = line.split( " ", 2 );
|
||||||
GenomeLoc curLoc = GenomeLocParser.parseGenomeLoc( halves[0] );
|
GenomeLoc curLoc = GenomeLocParser.parseGenomeLoc( halves[0] );
|
||||||
while( curLoc.isBefore( readLoc ) ) { // Loop until the beginning of the read
|
while( curLoc.isBefore( readLoc ) ) { // Loop until the beginning of the read
|
||||||
line = inputReader.readLine();
|
line = inputReader.readLine();
|
||||||
if( line == null ) { throw new UserError.MalformedFile(new File(inputQualityFile), "Input file doesn't encompass all reads. Can't find beginning of read: " + readLoc ); }
|
if( line == null ) { throw new UserException.MalformedFile(new File(inputQualityFile), "Input file doesn't encompass all reads. Can't find beginning of read: " + readLoc ); }
|
||||||
halves = line.split( " ", 2 );
|
halves = line.split( " ", 2 );
|
||||||
curLoc = GenomeLocParser.parseGenomeLoc( halves[0] );
|
curLoc = GenomeLocParser.parseGenomeLoc( halves[0] );
|
||||||
}
|
}
|
||||||
|
|
@ -123,7 +122,7 @@ public class ReadQualityScoreWalker extends ReadWalker<SAMRecord, SAMFileWriter>
|
||||||
sumNeighborhoodQuality += Float.parseFloat( halves[1] );
|
sumNeighborhoodQuality += Float.parseFloat( halves[1] );
|
||||||
numLines++;
|
numLines++;
|
||||||
line = inputReader.readLine();
|
line = inputReader.readLine();
|
||||||
if( line == null ) { throw new UserError.MalformedFile(new File(inputQualityFile), "Input file doesn't encompass all reads. Can't find end of read: " + readLoc ); }
|
if( line == null ) { throw new UserException.MalformedFile(new File(inputQualityFile), "Input file doesn't encompass all reads. Can't find end of read: " + readLoc ); }
|
||||||
halves = line.split( " ", 2 );
|
halves = line.split( " ", 2 );
|
||||||
curLoc = GenomeLocParser.parseGenomeLoc( halves[0] );
|
curLoc = GenomeLocParser.parseGenomeLoc( halves[0] );
|
||||||
}
|
}
|
||||||
|
|
@ -133,9 +132,9 @@ public class ReadQualityScoreWalker extends ReadWalker<SAMRecord, SAMFileWriter>
|
||||||
line = savedLine;
|
line = savedLine;
|
||||||
|
|
||||||
} catch ( FileNotFoundException e ) {
|
} catch ( FileNotFoundException e ) {
|
||||||
throw new UserError.CouldNotReadInputFile(new File(inputQualityFile), e);
|
throw new UserException.CouldNotReadInputFile(new File(inputQualityFile), e);
|
||||||
} catch (IOException e ) {
|
} catch (IOException e ) {
|
||||||
throw new UserError.CouldNotReadInputFile(new File(inputQualityFile), e);
|
throw new UserException.CouldNotReadInputFile(new File(inputQualityFile), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
meanNeighborhoodQuality = sumNeighborhoodQuality / ((float) numLines);
|
meanNeighborhoodQuality = sumNeighborhoodQuality / ((float) numLines);
|
||||||
|
|
|
||||||
|
|
@ -35,14 +35,13 @@ import org.broadinstitute.sting.alignment.Alignment;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.commandline.Output;
|
import org.broadinstitute.sting.commandline.Output;
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
import net.sf.samtools.util.StringUtil;
|
import net.sf.samtools.util.StringUtil;
|
||||||
import net.sf.picard.reference.ReferenceSequence;
|
import net.sf.picard.reference.ReferenceSequence;
|
||||||
import net.sf.picard.reference.IndexedFastaSequenceFile;
|
import net.sf.picard.reference.IndexedFastaSequenceFile;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
|
@ -87,7 +86,7 @@ public class TestReadFishingWalker extends ReadWalker<Integer,Long> {
|
||||||
indelCallInputStream = new FileInputStream(indelCalls);
|
indelCallInputStream = new FileInputStream(indelCalls);
|
||||||
}
|
}
|
||||||
catch(IOException ex) {
|
catch(IOException ex) {
|
||||||
throw new UserError.CouldNotReadInputFile(indelCalls, ex);
|
throw new UserException.CouldNotReadInputFile(indelCalls, ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
Scanner indelCallReader = new Scanner(indelCallInputStream);
|
Scanner indelCallReader = new Scanner(indelCallInputStream);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package org.broadinstitute.sting.gatk.walkers.varianteval;
|
package org.broadinstitute.sting.gatk.walkers.varianteval;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
import org.broad.tribble.util.variantcontext.VariantContext;
|
import org.broad.tribble.util.variantcontext.VariantContext;
|
||||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
|
|
@ -9,12 +8,10 @@ import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||||
import org.broadinstitute.sting.playground.utils.report.tags.Analysis;
|
import org.broadinstitute.sting.playground.utils.report.tags.Analysis;
|
||||||
import org.broadinstitute.sting.playground.utils.report.tags.DataPoint;
|
import org.broadinstitute.sting.playground.utils.report.tags.DataPoint;
|
||||||
import org.broadinstitute.sting.playground.utils.report.utils.TableType;
|
import org.broadinstitute.sting.playground.utils.report.utils.TableType;
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.utils.analysis.AminoAcid;
|
import org.broadinstitute.sting.utils.analysis.AminoAcid;
|
||||||
import org.broadinstitute.sting.utils.analysis.AminoAcidTable;
|
import org.broadinstitute.sting.utils.analysis.AminoAcidTable;
|
||||||
import org.broadinstitute.sting.utils.analysis.AminoAcidUtils;
|
import org.broadinstitute.sting.utils.analysis.AminoAcidUtils;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010 The Broad Institute
|
* Copyright (c) 2010 The Broad Institute
|
||||||
|
|
@ -145,11 +142,11 @@ public class AminoAcidTransition extends VariantEvaluator {
|
||||||
infoValueSplit = parent.aminoAcidTransitionSplit;
|
infoValueSplit = parent.aminoAcidTransitionSplit;
|
||||||
useCodons = parent.aatUseCodons;
|
useCodons = parent.aatUseCodons;
|
||||||
if ( infoKey == null ) {
|
if ( infoKey == null ) {
|
||||||
throw new UserError.CommandLineError("No info-field key provided for amino acid tabulation. Please provide the appropriate key with -aatk.");
|
throw new UserException.CommandLineException("No info-field key provided for amino acid tabulation. Please provide the appropriate key with -aatk.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( infoValueSplit == null ) {
|
if ( infoValueSplit == null ) {
|
||||||
throw new UserError.CommandLineError("No split string provided for amino acid tabulation. Please provide the split string with -aats");
|
throw new UserException.CommandLineException("No split string provided for amino acid tabulation. Please provide the split string with -aats");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@ package org.broadinstitute.sting.playground.examples;
|
||||||
|
|
||||||
import org.apache.log4j.BasicConfigurator;
|
import org.apache.log4j.BasicConfigurator;
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
import org.simpleframework.xml.Element;
|
import org.simpleframework.xml.Element;
|
||||||
import org.simpleframework.xml.Root;
|
import org.simpleframework.xml.Root;
|
||||||
import org.simpleframework.xml.Serializer;
|
import org.simpleframework.xml.Serializer;
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,9 @@ import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
import net.sf.samtools.SAMReadGroupRecord;
|
import net.sf.samtools.SAMReadGroupRecord;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
@ -79,7 +78,7 @@ public class MatePairLibrarySize extends ReadWalker<Integer, Integer> {
|
||||||
pw.close();
|
pw.close();
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(file, e);
|
throw new UserException.CouldNotCreateOutputFile(file, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ import org.broad.tribble.FeatureSource;
|
||||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||||
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedData;
|
|
||||||
import org.broadinstitute.sting.gatk.refdata.SeekableRODIterator;
|
import org.broadinstitute.sting.gatk.refdata.SeekableRODIterator;
|
||||||
import org.broadinstitute.sting.gatk.refdata.features.refseq.RefSeqCodec;
|
import org.broadinstitute.sting.gatk.refdata.features.refseq.RefSeqCodec;
|
||||||
import org.broadinstitute.sting.gatk.refdata.features.refseq.RefSeqFeature;
|
import org.broadinstitute.sting.gatk.refdata.features.refseq.RefSeqFeature;
|
||||||
|
|
@ -47,11 +46,10 @@ import org.broadinstitute.sting.gatk.walkers.DataSource;
|
||||||
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
|
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
|
||||||
import org.broadinstitute.sting.gatk.walkers.TreeReducible;
|
import org.broadinstitute.sting.gatk.walkers.TreeReducible;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.utils.collections.Pair;
|
import org.broadinstitute.sting.utils.collections.Pair;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.commandline.Output;
|
import org.broadinstitute.sting.commandline.Output;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
@ -121,7 +119,7 @@ public class HybSelPerformanceWalker extends LocusWalker<Integer, HybSelPerforma
|
||||||
try {
|
try {
|
||||||
refseqIterator = new SeekableRODIterator(new FeatureToGATKFeatureIterator(refseq.iterator(), "refseq"));
|
refseqIterator = new SeekableRODIterator(new FeatureToGATKFeatureIterator(refseq.iterator(), "refseq"));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(REFSEQ_FILE, e);
|
throw new UserException.CouldNotReadInputFile(REFSEQ_FILE, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("Using RefSeq annotations from "+REFSEQ_FILE);
|
logger.info("Using RefSeq annotations from "+REFSEQ_FILE);
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ import net.sf.samtools.SAMRecord;
|
||||||
|
|
||||||
import org.broadinstitute.sting.gatk.iterators.PushbackIterator;
|
import org.broadinstitute.sting.gatk.iterators.PushbackIterator;
|
||||||
import org.broadinstitute.sting.utils.*;
|
import org.broadinstitute.sting.utils.*;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
||||||
import org.broadinstitute.sting.utils.collections.Pair;
|
import org.broadinstitute.sting.utils.collections.Pair;
|
||||||
|
|
||||||
|
|
@ -103,7 +103,7 @@ public class GenomicMap implements Iterable<Map.Entry<String, Collection<GenomeL
|
||||||
while( ( line = reader.readLine() ) != null ) {
|
while( ( line = reader.readLine() ) != null ) {
|
||||||
String[] halves = line.split("#",2);
|
String[] halves = line.split("#",2);
|
||||||
if ( halves.length < 2 )
|
if ( halves.length < 2 )
|
||||||
throw new UserError.MalformedFile(f, "Line: "+line+"\nin map file "+f+"\n does not contain contig name");
|
throw new UserException.MalformedFile(f, "Line: "+line+"\nin map file "+f+"\n does not contain contig name");
|
||||||
|
|
||||||
int p1 = 0;
|
int p1 = 0;
|
||||||
for ( ; p1 < halves[1].length() && Character.isWhitespace(halves[1].charAt(p1) ); p1++ );
|
for ( ; p1 < halves[1].length() && Character.isWhitespace(halves[1].charAt(p1) ); p1++ );
|
||||||
|
|
@ -113,13 +113,13 @@ public class GenomicMap implements Iterable<Map.Entry<String, Collection<GenomeL
|
||||||
// p2 is index of first whitespace after first word
|
// p2 is index of first whitespace after first word
|
||||||
|
|
||||||
if ( p1 == p2 )
|
if ( p1 == p2 )
|
||||||
throw new UserError.MalformedFile(f, "Line: "+line+"\n in map file "+f+"\nNo contig name found after '#'");
|
throw new UserException.MalformedFile(f, "Line: "+line+"\n in map file "+f+"\nNo contig name found after '#'");
|
||||||
|
|
||||||
String name = halves[1].substring(p1, p2);
|
String name = halves[1].substring(p1, p2);
|
||||||
|
|
||||||
String[] coord_parts = halves[0].split("\\s");
|
String[] coord_parts = halves[0].split("\\s");
|
||||||
if ( coord_parts.length % 3 != 0 )
|
if ( coord_parts.length % 3 != 0 )
|
||||||
throw new UserError.MalformedFile(f, "Line: "+line+"\n in map file "+f+"\nNumber of coordinate fields is not a multiple of 3");
|
throw new UserException.MalformedFile(f, "Line: "+line+"\n in map file "+f+"\nNumber of coordinate fields is not a multiple of 3");
|
||||||
|
|
||||||
List<GenomeLoc> segments = new ArrayList<GenomeLoc>( coord_parts.length / 3 );
|
List<GenomeLoc> segments = new ArrayList<GenomeLoc>( coord_parts.length / 3 );
|
||||||
|
|
||||||
|
|
@ -136,9 +136,9 @@ public class GenomicMap implements Iterable<Map.Entry<String, Collection<GenomeL
|
||||||
}
|
}
|
||||||
reader.close();
|
reader.close();
|
||||||
} catch ( FileNotFoundException e) {
|
} catch ( FileNotFoundException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(f, e);
|
throw new UserException.CouldNotReadInputFile(f, e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(f, e);
|
throw new UserException.CouldNotReadInputFile(f, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -188,9 +188,9 @@ public class GenomicMap implements Iterable<Map.Entry<String, Collection<GenomeL
|
||||||
}
|
}
|
||||||
reader.close();
|
reader.close();
|
||||||
} catch ( FileNotFoundException e) {
|
} catch ( FileNotFoundException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(f, e);
|
throw new UserException.CouldNotReadInputFile(f, e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(f, e);
|
throw new UserException.CouldNotReadInputFile(f, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -209,7 +209,7 @@ public class GenomicMap implements Iterable<Map.Entry<String, Collection<GenomeL
|
||||||
}
|
}
|
||||||
writer.close();
|
writer.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(f, e);
|
throw new UserException.CouldNotCreateOutputFile(f, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -242,7 +242,7 @@ public class GenomicMap implements Iterable<Map.Entry<String, Collection<GenomeL
|
||||||
|
|
||||||
// get mapping from read's contig onto a "global" contig (as a list of intervals on the latter):
|
// get mapping from read's contig onto a "global" contig (as a list of intervals on the latter):
|
||||||
Collection<GenomeLoc> segments = getContigMapping(r.getReferenceName());
|
Collection<GenomeLoc> segments = getContigMapping(r.getReferenceName());
|
||||||
if ( segments == null ) throw new UserError.MalformedBam(r, "Can not remap a record: unknown custom contig name "+r.getReferenceName());
|
if ( segments == null ) throw new UserException.MalformedBam(r, "Can not remap a record: unknown custom contig name "+r.getReferenceName());
|
||||||
|
|
||||||
// scroll the list of intervals until we find the interval that the alignment start falls into:
|
// scroll the list of intervals until we find the interval that the alignment start falls into:
|
||||||
Pair<? extends Iterator<GenomeLoc>, Integer> p = seekForward(segments,customStart);
|
Pair<? extends Iterator<GenomeLoc>, Integer> p = seekForward(segments,customStart);
|
||||||
|
|
@ -316,7 +316,7 @@ public class GenomicMap implements Iterable<Map.Entry<String, Collection<GenomeL
|
||||||
if ( discardCrossContig ) {
|
if ( discardCrossContig ) {
|
||||||
// System.out.println("WARNING: ALIGNMENT DISCARDED: "+message);
|
// System.out.println("WARNING: ALIGNMENT DISCARDED: "+message);
|
||||||
return null;
|
return null;
|
||||||
} else throw new UserError.MalformedBam(r, message);
|
} else throw new UserException.MalformedBam(r, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
gl = iter.next(); // advance to next segment
|
gl = iter.next(); // advance to next segment
|
||||||
|
|
@ -324,11 +324,11 @@ public class GenomicMap implements Iterable<Map.Entry<String, Collection<GenomeL
|
||||||
refPos = (int)gl.getStart(); // we jump to the start of next segment on the master ref
|
refPos = (int)gl.getStart(); // we jump to the start of next segment on the master ref
|
||||||
|
|
||||||
if ( gl.getContigIndex() != r.getReferenceIndex() )
|
if ( gl.getContigIndex() != r.getReferenceIndex() )
|
||||||
throw new UserError.MalformedBam(r, "Contig "+oldRefName+
|
throw new UserException.MalformedBam(r, "Contig "+oldRefName+
|
||||||
" has segments on different master contigs: currently unsupported");
|
" has segments on different master contigs: currently unsupported");
|
||||||
|
|
||||||
if ( refPos < currStop + 1 )
|
if ( refPos < currStop + 1 )
|
||||||
throw new UserError.MalformedBam(r, "Contig "+oldRefName+
|
throw new UserException.MalformedBam(r, "Contig "+oldRefName+
|
||||||
" has segments that are out of order or strictly adjacent: currently unsupported");
|
" has segments that are out of order or strictly adjacent: currently unsupported");
|
||||||
if ( len > 0 && refPos > currStop + 1 ) {
|
if ( len > 0 && refPos > currStop + 1 ) {
|
||||||
// add "panning" N's w/respect to the master ref over the region between adjacent segments
|
// add "panning" N's w/respect to the master ref over the region between adjacent segments
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
package org.broadinstitute.sting.playground.utils.report.templates;
|
package org.broadinstitute.sting.playground.utils.report.templates;
|
||||||
|
|
||||||
import org.broadinstitute.sting.playground.utils.report.utils.Node;
|
import org.broadinstitute.sting.playground.utils.report.utils.Node;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
|
@ -32,7 +31,7 @@ public class GrepFormat implements ReportFormat {
|
||||||
try {
|
try {
|
||||||
stream = new PrintWriter(baseFile);
|
stream = new PrintWriter(baseFile);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(baseFile, e);
|
throw new UserException.CouldNotCreateOutputFile(baseFile, e);
|
||||||
}
|
}
|
||||||
privateWrite(baseNode);
|
privateWrite(baseNode);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
package org.broadinstitute.sting.playground.utils.report.templates;
|
package org.broadinstitute.sting.playground.utils.report.templates;
|
||||||
|
|
||||||
import org.broadinstitute.sting.playground.utils.report.utils.Node;
|
import org.broadinstitute.sting.playground.utils.report.utils.Node;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -37,7 +36,7 @@ public abstract class TableBasedFormat implements ReportFormat {
|
||||||
* @param baseNode the root node
|
* @param baseNode the root node
|
||||||
*/
|
*/
|
||||||
public void write(Writer writeLocation, Node baseNode) {
|
public void write(Writer writeLocation, Node baseNode) {
|
||||||
if (splitFilesByAnalysis()) throw new UserError.CommandLineError("Unable to write output report, we require a file input for multi-file formats");
|
if (splitFilesByAnalysis()) throw new UserException.CommandLineException("Unable to write output report, we require a file input for multi-file formats");
|
||||||
// if there is only a single output file, create it
|
// if there is only a single output file, create it
|
||||||
stream = new PrintWriter(writeLocation);
|
stream = new PrintWriter(writeLocation);
|
||||||
traverseAnalysisNodes(baseNode);
|
traverseAnalysisNodes(baseNode);
|
||||||
|
|
@ -229,7 +228,7 @@ public abstract class TableBasedFormat implements ReportFormat {
|
||||||
try {
|
try {
|
||||||
stream = new PrintWriter(file);
|
stream = new PrintWriter(file);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(file, e);
|
throw new UserException.CouldNotCreateOutputFile(file, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package org.broadinstitute.sting.playground.utils.report.templates;
|
package org.broadinstitute.sting.playground.utils.report.templates;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
|
|
@ -104,7 +103,7 @@ class TextTable {
|
||||||
try {
|
try {
|
||||||
writer.append("\n");
|
writer.append("\n");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(writer.toString(), "Unable to write to the Writer", e);
|
throw new UserException.CouldNotCreateOutputFile(writer.toString(), "Unable to write to the Writer", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -129,7 +128,7 @@ class TextTable {
|
||||||
if (y != rows.size() - 1)
|
if (y != rows.size() - 1)
|
||||||
writer.append(seperator);
|
writer.append(seperator);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(writer.toString(), "Unable to write to the Writer", e);
|
throw new UserException.CouldNotCreateOutputFile(writer.toString(), "Unable to write to the Writer", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
package org.broadinstitute.sting.utils;
|
package org.broadinstitute.sting.utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Temp class to track split from Sting exception to UserError
|
* Temp class to track split from Sting exception to UserException
|
||||||
*/
|
*/
|
||||||
public class GATKException extends StingException {
|
public class GATKException extends StingException {
|
||||||
public GATKException(String msg) {
|
public GATKException(String msg) {
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ import org.apache.log4j.Logger;
|
||||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||||
import org.broadinstitute.sting.gatk.arguments.ValidationExclusion;
|
import org.broadinstitute.sting.gatk.arguments.ValidationExclusion;
|
||||||
import org.broadinstitute.sting.utils.bed.BedParser;
|
import org.broadinstitute.sting.utils.bed.BedParser;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.interval.IntervalMergingRule;
|
import org.broadinstitute.sting.utils.interval.IntervalMergingRule;
|
||||||
import org.broadinstitute.sting.utils.text.XReadLines;
|
import org.broadinstitute.sting.utils.text.XReadLines;
|
||||||
|
|
||||||
|
|
@ -97,7 +97,7 @@ public class GenomeLocParser {
|
||||||
*/
|
*/
|
||||||
public static int getContigIndex(final String contig, boolean exceptionOut) {
|
public static int getContigIndex(final String contig, boolean exceptionOut) {
|
||||||
if (contigInfo.getSequenceIndex(contig) == -1 && exceptionOut)
|
if (contigInfo.getSequenceIndex(contig) == -1 && exceptionOut)
|
||||||
throw new UserError.CommandLineError(String.format("Contig %s given as location, but this contig isn't present in the Fasta sequence dictionary", contig));
|
throw new UserException.CommandLineException(String.format("Contig %s given as location, but this contig isn't present in the Fasta sequence dictionary", contig));
|
||||||
|
|
||||||
return contigInfo.getSequenceIndex(contig);
|
return contigInfo.getSequenceIndex(contig);
|
||||||
}
|
}
|
||||||
|
|
@ -123,7 +123,7 @@ public class GenomeLocParser {
|
||||||
public static boolean setupRefContigOrdering(final SAMSequenceDictionary seqDict) {
|
public static boolean setupRefContigOrdering(final SAMSequenceDictionary seqDict) {
|
||||||
if (seqDict == null) { // we couldn't load the reference dictionary
|
if (seqDict == null) { // we couldn't load the reference dictionary
|
||||||
//logger.info("Failed to load reference dictionary, falling back to lexicographic order for contigs");
|
//logger.info("Failed to load reference dictionary, falling back to lexicographic order for contigs");
|
||||||
throw new UserError.CommandLineError("Failed to load reference dictionary");
|
throw new UserException.CommandLineException("Failed to load reference dictionary");
|
||||||
} else if (contigInfo == null) {
|
} else if (contigInfo == null) {
|
||||||
contigInfo = seqDict;
|
contigInfo = seqDict;
|
||||||
logger.debug(String.format("Prepared reference sequence contig dictionary"));
|
logger.debug(String.format("Prepared reference sequence contig dictionary"));
|
||||||
|
|
@ -193,13 +193,13 @@ public class GenomeLocParser {
|
||||||
stop = parsePosition(str.substring(dashIndex + 1));
|
stop = parsePosition(str.substring(dashIndex + 1));
|
||||||
}
|
}
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
throw new UserError("Failed to parse Genome Location string: " + str, e);
|
throw new UserException("Failed to parse Genome Location string: " + str, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// is the contig valid?
|
// is the contig valid?
|
||||||
if (!isContigValid(contig))
|
if (!isContigValid(contig))
|
||||||
throw new UserError("Contig '" + contig + "' does not match any contig in the GATK sequence dictionary derived from the reference; are you sure you are using the correct reference fasta file?");
|
throw new UserException("Contig '" + contig + "' does not match any contig in the GATK sequence dictionary derived from the reference; are you sure you are using the correct reference fasta file?");
|
||||||
|
|
||||||
if (stop == Integer.MAX_VALUE && hasKnownContigOrdering())
|
if (stop == Integer.MAX_VALUE && hasKnownContigOrdering())
|
||||||
// lookup the actually stop position!
|
// lookup the actually stop position!
|
||||||
|
|
@ -371,7 +371,7 @@ public class GenomeLocParser {
|
||||||
return ret.isEmpty() ? null : ret;
|
return ret.isEmpty() ? null : ret;
|
||||||
}
|
}
|
||||||
catch (IOException e2) {
|
catch (IOException e2) {
|
||||||
throw new UserError.CouldNotReadInputFile(new File(file_name), e);
|
throw new UserException.CouldNotReadInputFile(new File(file_name), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,312 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010, The Broad Institute
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person
|
||||||
|
* obtaining a copy of this software and associated documentation
|
||||||
|
* files (the "Software"), to deal in the Software without
|
||||||
|
* restriction, including without limitation the rights to use,
|
||||||
|
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the
|
||||||
|
* Software is furnished to do so, subject to the following
|
||||||
|
* conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be
|
||||||
|
* included in all copies or substantial portions of the Software.
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
|
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
* OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.broadinstitute.sting.utils;
|
||||||
|
|
||||||
|
import net.sf.samtools.SAMSequenceDictionary;
|
||||||
|
import net.sf.samtools.SAMSequenceRecord;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||||
|
import org.broadinstitute.sting.gatk.arguments.ValidationExclusion;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by IntelliJ IDEA.
|
||||||
|
* User: depristo
|
||||||
|
* Date: Sep 10, 2010
|
||||||
|
* Time: 1:56:24 PM
|
||||||
|
*
|
||||||
|
* A series of utility functions that enable the GATK to compare two sequence dictionaries -- from the reference,
|
||||||
|
* from BAMs, or from RODs -- for consistency. The system supports two basic modes: get an enum state that
|
||||||
|
* describes at a high level the consistency between two dictionaries, or a validateDictionaries that will
|
||||||
|
* blow up with a UserException if the dicts are too incompatible.
|
||||||
|
*
|
||||||
|
* Dictionaries are tested for contig name overlaps, consistency in ordering in these overlap set, and length,
|
||||||
|
* if available. Examines the Engine arguments to decided if the -U option to allow danger seq dict inconsistency
|
||||||
|
* is enabled before it blows up.
|
||||||
|
*/
|
||||||
|
public class SequenceDictionaryUtils {
|
||||||
|
public enum SequenceDictionaryCompatability {
|
||||||
|
IDENTICAL, // the dictionaries are identical
|
||||||
|
COMMON_SUBSET, // there exists a common subset of equivalent contigs
|
||||||
|
NO_COMMON_CONTIGS, // no overlap between dictionaries
|
||||||
|
UNEQUAL_COMMON_CONTIGS, // common subset has contigs that have the same name but aren't equivalent
|
||||||
|
NON_CANONICAL_HUMAN_ORDER, // human reference detected but the order of the contigs is non-standard (lexicographic, for examine)
|
||||||
|
OUT_OF_ORDER // the two dictionaries overlap but the contigs occur out of order w.r.t each other
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Returns true if the engine is in tolerant mode and we'll let through dangerous but not fatal dictionary inconsistency
|
||||||
|
*/
|
||||||
|
public static boolean allowNonFatalIncompabilities() {
|
||||||
|
return GenomeAnalysisEngine.instance != null &&
|
||||||
|
( GenomeAnalysisEngine.instance.getArguments().unsafe == ValidationExclusion.TYPE.ALLOW_SEQ_DICT_INCOMPATIBILITY ||
|
||||||
|
GenomeAnalysisEngine.instance.getArguments().unsafe == ValidationExclusion.TYPE.ALL );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Testings for compatbility between dict1 and dict2. If the dictionaries are incompatible, then UserExceptions are
|
||||||
|
* thrown with detailed error messages. If the engine is in permissive mode, then logger.warnings of generated instead
|
||||||
|
*
|
||||||
|
* @param logger for warnings
|
||||||
|
* @param name1 name associated with dict1
|
||||||
|
* @param dict1 the sequence dictionary dict1
|
||||||
|
* @param name2 name associated with dict2
|
||||||
|
* @param dict2 the sequence dictionary dict2
|
||||||
|
*/
|
||||||
|
public static void validateDictionaries(Logger logger, String name1, SAMSequenceDictionary dict1, String name2, SAMSequenceDictionary dict2) {
|
||||||
|
switch ( compareDictionaries(dict1, dict2) ) {
|
||||||
|
case IDENTICAL:
|
||||||
|
return;
|
||||||
|
case COMMON_SUBSET:
|
||||||
|
return;
|
||||||
|
case NO_COMMON_CONTIGS:
|
||||||
|
throw new UserException.IncompatibleSequenceDictionaries("No overlapping contigs found", name1, dict1, name2, dict2);
|
||||||
|
case UNEQUAL_COMMON_CONTIGS: {
|
||||||
|
List<SAMSequenceRecord> x = findDisequalCommonContigs(getCommonContigsByName(dict1, dict2), dict1, dict2);
|
||||||
|
SAMSequenceRecord elt1 = x.get(0);
|
||||||
|
SAMSequenceRecord elt2 = x.get(1);
|
||||||
|
|
||||||
|
// todo -- replace with toString when SAMSequenceRecord has a nice toString routine
|
||||||
|
UserException ex = new UserException.IncompatibleSequenceDictionaries(String.format("Found contigs with the same name but different lengths:\n contig %s = %s / %d\n contig %s = %s / %d",
|
||||||
|
name1, elt1.getSequenceName(), elt1.getSequenceLength(),
|
||||||
|
name2, elt2.getSequenceName(), elt2.getSequenceLength()),
|
||||||
|
name1, dict1, name2, dict2);
|
||||||
|
|
||||||
|
if ( allowNonFatalIncompabilities() )
|
||||||
|
logger.warn(ex.getMessage());
|
||||||
|
else
|
||||||
|
throw ex;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case NON_CANONICAL_HUMAN_ORDER:
|
||||||
|
UserException ex = new UserException.IncompatibleSequenceDictionaries("Human genome sequence provided in non-canonical ordering. For safety's sake the GATK requires contigs in karyotypic order: 1, 2, ..., 10, 11, ..., 20, 21, 22, X, Y with M either leading or trailing these contigs",
|
||||||
|
name1, dict1, name2, dict2);
|
||||||
|
|
||||||
|
if ( allowNonFatalIncompabilities() )
|
||||||
|
logger.warn(ex.getMessage());
|
||||||
|
else
|
||||||
|
throw ex;
|
||||||
|
|
||||||
|
case OUT_OF_ORDER:
|
||||||
|
throw new UserException.IncompatibleSequenceDictionaries("Order of contigs differences, which is unsafe", name1, dict1, name2, dict2);
|
||||||
|
default:
|
||||||
|
throw new GATKException("Unexpected SequenceDictionaryComparison type");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Workhorse routine that takes two dictionaries and returns their compatibility.
|
||||||
|
*
|
||||||
|
* @param dict1
|
||||||
|
* @param dict2
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static SequenceDictionaryCompatability compareDictionaries(SAMSequenceDictionary dict1, SAMSequenceDictionary dict2) {
|
||||||
|
// If there's no overlap between reads and reference, data will be bogus. Throw an exception.
|
||||||
|
Set<String> commonContigs = getCommonContigsByName(dict1, dict2);
|
||||||
|
|
||||||
|
if (commonContigs.size() == 0)
|
||||||
|
return SequenceDictionaryCompatability.NO_COMMON_CONTIGS;
|
||||||
|
else if ( ! commonContigsAreEquivalent( commonContigs, dict1, dict2 ) )
|
||||||
|
return SequenceDictionaryCompatability.UNEQUAL_COMMON_CONTIGS;
|
||||||
|
else if ( nonCanonicalHumanContigOrder( commonContigs, dict1, dict2 ) )
|
||||||
|
return SequenceDictionaryCompatability.NON_CANONICAL_HUMAN_ORDER;
|
||||||
|
else if ( ! commonContigsAreInOrder( commonContigs, dict1, dict2 ) )
|
||||||
|
return SequenceDictionaryCompatability.OUT_OF_ORDER;
|
||||||
|
else if ( commonContigs.size() == dict1.size() && commonContigs.size() == dict2.size() )
|
||||||
|
return SequenceDictionaryCompatability.IDENTICAL;
|
||||||
|
else {
|
||||||
|
return SequenceDictionaryCompatability.COMMON_SUBSET;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility function that tests whether the commonContigs in both dicts are equivalent. Equivalece means
|
||||||
|
* that the seq records have the same length, if both are non-zero.
|
||||||
|
*
|
||||||
|
* @param commonContigs
|
||||||
|
* @param dict1
|
||||||
|
* @param dict2
|
||||||
|
* @return true if all of the common contigs are equivalent
|
||||||
|
*/
|
||||||
|
private static boolean commonContigsAreEquivalent(Set<String> commonContigs, SAMSequenceDictionary dict1, SAMSequenceDictionary dict2) {
|
||||||
|
return findDisequalCommonContigs(commonContigs, dict1, dict2) == null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a List(x,y) that contains two disequal sequence records among the common contigs in both dicts. Returns
|
||||||
|
* null if all common contigs are equivalent
|
||||||
|
*
|
||||||
|
* @param commonContigs
|
||||||
|
* @param dict1
|
||||||
|
* @param dict2
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static List<SAMSequenceRecord> findDisequalCommonContigs(Set<String> commonContigs, SAMSequenceDictionary dict1, SAMSequenceDictionary dict2) {
|
||||||
|
for ( String name : commonContigs ) {
|
||||||
|
SAMSequenceRecord elt1 = dict1.getSequence(name);
|
||||||
|
SAMSequenceRecord elt2 = dict2.getSequence(name);
|
||||||
|
if ( ! SequenceRecordsAreEquivalent(elt1, elt2) )
|
||||||
|
return Arrays.asList(elt1,elt2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper routine that returns two sequence records are equivalent, defined as having the same name and
|
||||||
|
* lengths, if both are non-zero
|
||||||
|
*
|
||||||
|
* @param me
|
||||||
|
* @param that
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static boolean SequenceRecordsAreEquivalent(final SAMSequenceRecord me, final SAMSequenceRecord that) {
|
||||||
|
if (me == that) return true;
|
||||||
|
if (that == null) return false;
|
||||||
|
|
||||||
|
// I don't care if the indices are difference
|
||||||
|
//if (me.getSequenceIndex() != that.getSequenceIndex()) return false;
|
||||||
|
if (me.getSequenceLength() != 0 && that.getSequenceLength() != 0 && me.getSequenceLength() != that.getSequenceLength())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// todo -- reenable if we want to be really strict here
|
||||||
|
// if (me.getAttribute(SAMSequenceRecord.MD5_TAG) != null && that.getAttribute(SAMSequenceRecord.MD5_TAG) != null) {
|
||||||
|
// final BigInteger thisMd5 = new BigInteger((String)me.getAttribute(SAMSequenceRecord.MD5_TAG), 16);
|
||||||
|
// final BigInteger thatMd5 = new BigInteger((String)that.getAttribute(SAMSequenceRecord.MD5_TAG), 16);
|
||||||
|
// if (!thisMd5.equals(thatMd5)) {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
if (me.getSequenceName() != that.getSequenceName())
|
||||||
|
return false; // Compare using == since we intern() the Strings
|
||||||
|
// }
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Placeholder for function that determines if the dicts come from the human genome that's been sorted in a
|
||||||
|
* non-canonical order. Returns just returns false (function not enabled).
|
||||||
|
*
|
||||||
|
* @param commonContigs
|
||||||
|
* @param dict1
|
||||||
|
* @param dict2
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static boolean nonCanonicalHumanContigOrder(Set<String> commonContigs, SAMSequenceDictionary dict1, SAMSequenceDictionary dict2) {
|
||||||
|
// todo -- implement me if we decide to detect this case
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the common contigs in dict1 and dict2 are in the same order. This is accomplished by getting the
|
||||||
|
* common contigs in both dictionaries, sorting these according to their indices, and the walking through
|
||||||
|
* the sorted list to ensure that each ordered contig is equivalent
|
||||||
|
*
|
||||||
|
* @param commonContigs
|
||||||
|
* @param dict1
|
||||||
|
* @param dict2
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean commonContigsAreInOrder(Set<String> commonContigs, SAMSequenceDictionary dict1, SAMSequenceDictionary dict2) {
|
||||||
|
List<SAMSequenceRecord> list1 = sortSequenceListByIndex(getSequencesOfName(commonContigs, dict1));
|
||||||
|
List<SAMSequenceRecord> list2 = sortSequenceListByIndex(getSequencesOfName(commonContigs, dict2));
|
||||||
|
|
||||||
|
for ( int i = 0; i < list1.size(); i++ ) {
|
||||||
|
SAMSequenceRecord elt1 = list1.get(i);
|
||||||
|
SAMSequenceRecord elt2 = list2.get(i);
|
||||||
|
if ( ! elt1.getSequenceName().equals(elt2.getSequenceName()) )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the subset of SAMSequenceRecords in commonContigs in dict
|
||||||
|
*
|
||||||
|
* @param commonContigs
|
||||||
|
* @param dict
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static List<SAMSequenceRecord> getSequencesOfName(Set<String> commonContigs, SAMSequenceDictionary dict) {
|
||||||
|
List<SAMSequenceRecord> l = new ArrayList<SAMSequenceRecord>(commonContigs.size());
|
||||||
|
for ( String name : commonContigs ) {
|
||||||
|
l.add(dict.getSequence(name) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------
|
||||||
|
// Utilities for comparing the order of sequence records
|
||||||
|
// --------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares sequence records by their order
|
||||||
|
*/
|
||||||
|
private static class CompareSequenceRecordsByIndex implements Comparator<SAMSequenceRecord> {
|
||||||
|
public int compare(SAMSequenceRecord x, SAMSequenceRecord y) {
|
||||||
|
return new Integer(x.getSequenceIndex()).compareTo(y.getSequenceIndex());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a sorted list of SAMSequenceRecords sorted by their indices. Note that the
|
||||||
|
* list is modified in place, so the returned list is == to the unsorted list.
|
||||||
|
*
|
||||||
|
* @param unsorted
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static List<SAMSequenceRecord> sortSequenceListByIndex(List<SAMSequenceRecord> unsorted) {
|
||||||
|
Collections.sort(unsorted, new CompareSequenceRecordsByIndex());
|
||||||
|
return unsorted;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the set of contig names found in both dicts.
|
||||||
|
* @param dict1
|
||||||
|
* @param dict2
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Set<String> getCommonContigsByName(SAMSequenceDictionary dict1, SAMSequenceDictionary dict2) {
|
||||||
|
Set<String> intersectingSequenceNames = new HashSet<String>(getContigNames(dict1));
|
||||||
|
intersectingSequenceNames.retainAll(getContigNames(dict2));
|
||||||
|
return intersectingSequenceNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<String> getContigNames(SAMSequenceDictionary dict) {
|
||||||
|
List<String> contigNames = new ArrayList<String>();
|
||||||
|
for (SAMSequenceRecord dictionaryEntry : dict.getSequences())
|
||||||
|
contigNames.add(dictionaryEntry.getSequenceName());
|
||||||
|
return contigNames;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
package org.broadinstitute.sting.utils.bed;
|
package org.broadinstitute.sting.utils.bed;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.interval.IntervalMergingRule;
|
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||||
|
|
||||||
|
|
@ -34,7 +32,7 @@ public class BedParser {
|
||||||
try {
|
try {
|
||||||
mIn = new BufferedReader(new FileReader(fl));
|
mIn = new BufferedReader(new FileReader(fl));
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(fl, e);
|
throw new UserException.CouldNotReadInputFile(fl, e);
|
||||||
}
|
}
|
||||||
mLocations = parseLocations();
|
mLocations = parseLocations();
|
||||||
}
|
}
|
||||||
|
|
@ -62,7 +60,7 @@ public class BedParser {
|
||||||
locArray.add(parseLocation(line));
|
locArray.add(parseLocation(line));
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.MalformedFile("Unable to parse line in BED file.");
|
throw new UserException.MalformedFile("Unable to parse line in BED file.");
|
||||||
}
|
}
|
||||||
return locArray;
|
return locArray;
|
||||||
}
|
}
|
||||||
|
|
@ -83,7 +81,7 @@ public class BedParser {
|
||||||
start = Integer.valueOf(parts[1]) + TO_ONE_BASED_ADDITION;
|
start = Integer.valueOf(parts[1]) + TO_ONE_BASED_ADDITION;
|
||||||
stop = Integer.valueOf(parts[2]); // the ending point is an open interval
|
stop = Integer.valueOf(parts[2]); // the ending point is an open interval
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new UserError.MalformedFile("Unable to process bed file line = " + line, e);
|
throw new UserException.MalformedFile("Unable to process bed file line = " + line, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// we currently drop the rest of the bed record, which can contain names, scores, etc
|
// we currently drop the rest of the bed record, which can contain names, scores, etc
|
||||||
|
|
|
||||||
|
|
@ -24,13 +24,6 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.utils.exceptions;
|
package org.broadinstitute.sting.utils.exceptions;
|
||||||
|
|
||||||
import net.sf.samtools.SAMFileHeader;
|
|
||||||
import net.sf.samtools.SAMRecord;
|
|
||||||
import net.sf.samtools.SAMSequenceDictionary;
|
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -40,7 +33,7 @@ import java.lang.reflect.InvocationTargetException;
|
||||||
* Date: Sep 3, 2010
|
* Date: Sep 3, 2010
|
||||||
* Time: 2:24:09 PM
|
* Time: 2:24:09 PM
|
||||||
*/
|
*/
|
||||||
public class DynamicClassResolutionException extends UserError {
|
public class DynamicClassResolutionException extends UserException {
|
||||||
public DynamicClassResolutionException(Class c, Exception ex) {
|
public DynamicClassResolutionException(Class c, Exception ex) {
|
||||||
super(String.format("Could not create module %s because %s caused by exception %s",
|
super(String.format("Could not create module %s because %s caused by exception %s",
|
||||||
c.getSimpleName(), moreInfo(ex), ex.getMessage()));
|
c.getSimpleName(), moreInfo(ex), ex.getMessage()));
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,11 @@ package org.broadinstitute.sting.utils.exceptions;
|
||||||
import net.sf.samtools.SAMFileHeader;
|
import net.sf.samtools.SAMFileHeader;
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
import net.sf.samtools.SAMSequenceDictionary;
|
import net.sf.samtools.SAMSequenceDictionary;
|
||||||
|
import net.sf.samtools.SAMSequenceRecord;
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the common user errors detected by Sting / GATK
|
* Represents the common user errors detected by Sting / GATK
|
||||||
|
|
@ -42,43 +42,43 @@ import java.lang.reflect.InvocationTargetException;
|
||||||
* Date: Sep 3, 2010
|
* Date: Sep 3, 2010
|
||||||
* Time: 2:24:09 PM
|
* Time: 2:24:09 PM
|
||||||
*/
|
*/
|
||||||
public class UserError extends GATKException {
|
public class UserException extends GATKException {
|
||||||
public UserError(String msg) { super(msg); }
|
public UserException(String msg) { super(msg); }
|
||||||
public UserError(String msg, Throwable e) { super(msg, e); }
|
public UserException(String msg, Throwable e) { super(msg, e); }
|
||||||
private UserError(Throwable e) { super("", e); } // cannot be called, private access
|
private UserException(Throwable e) { super("", e); } // cannot be called, private access
|
||||||
|
|
||||||
public static class CommandLineError extends UserError {
|
public static class CommandLineException extends UserException {
|
||||||
public CommandLineError(String message) {
|
public CommandLineException(String message) {
|
||||||
super(String.format("Invalid command line: %s", message));
|
super(String.format("Invalid command line: %s", message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BadInput extends UserError {
|
public static class BadInput extends UserException {
|
||||||
public BadInput(String message) {
|
public BadInput(String message) {
|
||||||
super(String.format("Bad input: %s", message));
|
super(String.format("Bad input: %s", message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo -- fix up exception cause passing
|
// todo -- fix up exception cause passing
|
||||||
public static class MissingArgument extends CommandLineError {
|
public static class MissingArgument extends CommandLineException {
|
||||||
public MissingArgument(String arg, String message) {
|
public MissingArgument(String arg, String message) {
|
||||||
super(String.format("Argument %s was missing: %s", arg, message));
|
super(String.format("Argument %s was missing: %s", arg, message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BadArgumentValue extends CommandLineError {
|
public static class BadArgumentValue extends CommandLineException {
|
||||||
public BadArgumentValue(String arg, String message) {
|
public BadArgumentValue(String arg, String message) {
|
||||||
super(String.format("Argument %s has a bad value: %s", arg, message));
|
super(String.format("Argument %s has a bad value: %s", arg, message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BadTmpDir extends UserError {
|
public static class BadTmpDir extends UserException {
|
||||||
public BadTmpDir(String message) {
|
public BadTmpDir(String message) {
|
||||||
super(String.format("Failure working with the tmp directory %s. Override with -Djava.io.tmpdir=X on the command line to a bigger/better file system. Exact error was %s", System.getProperties().get("java.io. tmpdir"), message));
|
super(String.format("Failure working with the tmp directory %s. Override with -Djava.io.tmpdir=X on the command line to a bigger/better file system. Exact error was %s", System.getProperties().get("java.io. tmpdir"), message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class CouldNotReadInputFile extends UserError {
|
public static class CouldNotReadInputFile extends UserException {
|
||||||
public CouldNotReadInputFile(String message, Exception e) {
|
public CouldNotReadInputFile(String message, Exception e) {
|
||||||
super(String.format("Couldn't read file because %s caused by %s", message, e.getMessage()));
|
super(String.format("Couldn't read file because %s caused by %s", message, e.getMessage()));
|
||||||
}
|
}
|
||||||
|
|
@ -97,7 +97,7 @@ public class UserError extends GATKException {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class CouldNotCreateOutputFile extends UserError {
|
public static class CouldNotCreateOutputFile extends UserException {
|
||||||
public CouldNotCreateOutputFile(File file, String message, Exception e) {
|
public CouldNotCreateOutputFile(File file, String message, Exception e) {
|
||||||
super(String.format("Couldn't write file %s because %s with exception %s", file.getAbsolutePath(), message, e.getMessage()));
|
super(String.format("Couldn't write file %s because %s with exception %s", file.getAbsolutePath(), message, e.getMessage()));
|
||||||
}
|
}
|
||||||
|
|
@ -111,7 +111,7 @@ public class UserError extends GATKException {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MalformedBam extends UserError {
|
public static class MalformedBam extends UserException {
|
||||||
public MalformedBam(SAMRecord read, String message) {
|
public MalformedBam(SAMRecord read, String message) {
|
||||||
super(String.format("SAM/BAM file %s is malformed: %s", read.getFileSource(), message));
|
super(String.format("SAM/BAM file %s is malformed: %s", read.getFileSource(), message));
|
||||||
}
|
}
|
||||||
|
|
@ -123,7 +123,7 @@ public class UserError extends GATKException {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MissortedBAM extends UserError {
|
public static class MissortedBAM extends UserException {
|
||||||
public MissortedBAM(SAMFileHeader.SortOrder order, File file, SAMFileHeader header) {
|
public MissortedBAM(SAMFileHeader.SortOrder order, File file, SAMFileHeader header) {
|
||||||
super(String.format("Missorted Input SAM/BAM files: %s is must be sorted in %s order but order was: %s", file, order, header.getSortOrder()));
|
super(String.format("Missorted Input SAM/BAM files: %s is must be sorted in %s order but order was: %s", file, order, header.getSortOrder()));
|
||||||
}
|
}
|
||||||
|
|
@ -142,13 +142,13 @@ public class UserError extends GATKException {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MissortedFile extends UserError {
|
public static class MissortedFile extends UserException {
|
||||||
public MissortedFile(File file, String message, Exception e) {
|
public MissortedFile(File file, String message, Exception e) {
|
||||||
super(String.format("Missorted Input file: %s is must be sorted in coordinate order. %s and got error %s", file, message, e.getMessage()));
|
super(String.format("Missorted Input file: %s is must be sorted in coordinate order. %s and got error %s", file, message, e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MalformedFile extends UserError {
|
public static class MalformedFile extends UserException {
|
||||||
public MalformedFile(String message) {
|
public MalformedFile(String message) {
|
||||||
super(String.format("Unknown file is malformed: %s", message));
|
super(String.format("Unknown file is malformed: %s", message));
|
||||||
}
|
}
|
||||||
|
|
@ -170,27 +170,35 @@ public class UserError extends GATKException {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class CannotExecuteRScript extends UserError {
|
public static class CannotExecuteRScript extends UserException {
|
||||||
public CannotExecuteRScript(String message, Exception e) {
|
public CannotExecuteRScript(String message, Exception e) {
|
||||||
super(String.format("Unable to execute RScript command: " + message), e);
|
super(String.format("Unable to execute RScript command: " + message), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class DeprecatedArgument extends CommandLineError {
|
public static class DeprecatedArgument extends CommandLineException {
|
||||||
public DeprecatedArgument(String param, String doc) {
|
public DeprecatedArgument(String param, String doc) {
|
||||||
super(String.format("The parameter %s is deprecated. %s",param,doc));
|
super(String.format("The parameter %s is deprecated. %s",param,doc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class IncompatibleSequenceDictionaries extends UserError {
|
public static class IncompatibleSequenceDictionaries extends UserException {
|
||||||
public IncompatibleSequenceDictionaries(SAMSequenceDictionary ref, SAMSequenceDictionary alt, String altName) {
|
public IncompatibleSequenceDictionaries(String message, String name1, SAMSequenceDictionary dict1, String name2, SAMSequenceDictionary dict2) {
|
||||||
// todo -- enumerate all elements in ref and alt
|
super(String.format("Input files %s and %s have incompatible contigs: %s.\n %s contigs = %s\n %s contigs = %s",
|
||||||
super(String.format("Incompatible input files: no overlap exists between contigs in " + altName + " and the reference."));
|
name1, name2, message, name1, prettyPrintSequenceRecords(dict1), name2, prettyPrintSequenceRecords(dict2)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String prettyPrintSequenceRecords(SAMSequenceDictionary sequenceDictionary) {
|
||||||
|
String[] sequenceRecordNames = new String[sequenceDictionary.size()];
|
||||||
|
int sequenceRecordIndex = 0;
|
||||||
|
for (SAMSequenceRecord sequenceRecord : sequenceDictionary.getSequences())
|
||||||
|
sequenceRecordNames[sequenceRecordIndex++] = sequenceRecord.getSequenceName();
|
||||||
|
return Arrays.deepToString(sequenceRecordNames);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MissingWalker extends UserError {
|
public static class MissingWalker extends UserException {
|
||||||
public MissingWalker(String walkerName, String message) {
|
public MissingWalker(String walkerName, String message) {
|
||||||
super(String.format("Walker %s is not available: %s", walkerName, message));
|
super(String.format("Walker %s is not available: %s", walkerName, message));
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package org.broadinstitute.sting.utils.fastq;
|
package org.broadinstitute.sting.utils.fastq;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
@ -24,7 +23,7 @@ public class FastqReader implements Iterator<FastqRecord>, Iterable<FastqRecord>
|
||||||
|
|
||||||
nextRecord = readNextRecord();
|
nextRecord = readNextRecord();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(file, String.format("Error opening '%s'", fastqFile.getAbsolutePath()));
|
throw new UserException.CouldNotReadInputFile(file, String.format("Error opening '%s'", fastqFile.getAbsolutePath()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -37,7 +36,7 @@ public class FastqReader implements Iterator<FastqRecord>, Iterable<FastqRecord>
|
||||||
|
|
||||||
return new FastqRecord(seqHeader, seqLine, qualHeader, qualLine);
|
return new FastqRecord(seqHeader, seqLine, qualHeader, qualLine);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(fastqFile, e);
|
throw new UserException.CouldNotReadInputFile(fastqFile, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -53,7 +52,7 @@ public class FastqReader implements Iterator<FastqRecord>, Iterable<FastqRecord>
|
||||||
nextRecord = null;
|
nextRecord = null;
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(fastqFile, e);
|
throw new UserException.CouldNotReadInputFile(fastqFile, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rec;
|
return rec;
|
||||||
|
|
@ -67,7 +66,7 @@ public class FastqReader implements Iterator<FastqRecord>, Iterable<FastqRecord>
|
||||||
try {
|
try {
|
||||||
in.close();
|
in.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(fastqFile, e);
|
throw new UserException.CouldNotReadInputFile(fastqFile, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,7 @@ import net.sf.samtools.util.BinaryCodec;
|
||||||
import net.sf.samtools.util.BlockCompressedInputStream;
|
import net.sf.samtools.util.BlockCompressedInputStream;
|
||||||
import net.sf.samtools.util.RuntimeEOFException;
|
import net.sf.samtools.util.RuntimeEOFException;
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
import org.broadinstitute.sting.utils.genotype.LikelihoodObject;
|
import org.broadinstitute.sting.utils.genotype.LikelihoodObject;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
|
@ -78,7 +77,7 @@ public class GLFReader implements Iterator<GLFRecord> {
|
||||||
try {
|
try {
|
||||||
inputBinaryCodec = new BinaryCodec(new DataInputStream(new BlockCompressedInputStream(readFrom)));
|
inputBinaryCodec = new BinaryCodec(new DataInputStream(new BlockCompressedInputStream(readFrom)));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotReadInputFile(myFile, e);
|
throw new UserException.CouldNotReadInputFile(myFile, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
inputBinaryCodec.setInputFileName(readFrom.getName());
|
inputBinaryCodec.setInputFileName(readFrom.getName());
|
||||||
|
|
@ -86,7 +85,7 @@ public class GLFReader implements Iterator<GLFRecord> {
|
||||||
// first verify that it's a valid GLF
|
// first verify that it's a valid GLF
|
||||||
for (short s : glfMagic) {
|
for (short s : glfMagic) {
|
||||||
if (inputBinaryCodec.readUByte() != s)
|
if (inputBinaryCodec.readUByte() != s)
|
||||||
throw new UserError.MalformedFile(myFile, "Verification of GLF format failed: magic string doesn't match)");
|
throw new UserException.MalformedFile(myFile, "Verification of GLF format failed: magic string doesn't match)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the header string
|
// get the header string
|
||||||
|
|
@ -177,7 +176,7 @@ public class GLFReader implements Iterator<GLFRecord> {
|
||||||
}
|
}
|
||||||
//nextRecord = null;
|
//nextRecord = null;
|
||||||
} else {
|
} else {
|
||||||
throw new UserError.MalformedFile(myFile, "Unknown GLF record type (type = " + recordType + ")");
|
throw new UserException.MalformedFile(myFile, "Unknown GLF record type (type = " + recordType + ")");
|
||||||
}
|
}
|
||||||
if (nextRecord != null) currentLocation = nextRecord.getPosition();
|
if (nextRecord != null) currentLocation = nextRecord.getPosition();
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,7 @@
|
||||||
package org.broadinstitute.sting.utils.interval;
|
package org.broadinstitute.sting.utils.interval;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
import org.broadinstitute.sting.utils.text.XReadLines;
|
import org.broadinstitute.sting.utils.text.XReadLines;
|
||||||
import org.broadinstitute.sting.gatk.iterators.PushbackIterator;
|
import org.broadinstitute.sting.gatk.iterators.PushbackIterator;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.StringToGenomeLocIteratorAdapter;
|
import org.broadinstitute.sting.gatk.refdata.utils.StringToGenomeLocIteratorAdapter;
|
||||||
|
|
@ -71,7 +70,7 @@ public class IntervalFileMergingIterator implements Iterator<GenomeLoc> {
|
||||||
StringToGenomeLocIteratorAdapter.FORMAT.GATK ) ) ;
|
StringToGenomeLocIteratorAdapter.FORMAT.GATK ) ) ;
|
||||||
}
|
}
|
||||||
} catch ( FileNotFoundException e ) {
|
} catch ( FileNotFoundException e ) {
|
||||||
throw new UserError.CouldNotReadInputFile(f, e);
|
throw new UserException.CouldNotReadInputFile(f, e);
|
||||||
}
|
}
|
||||||
myRule = rule;
|
myRule = rule;
|
||||||
}
|
}
|
||||||
|
|
@ -94,7 +93,7 @@ public class IntervalFileMergingIterator implements Iterator<GenomeLoc> {
|
||||||
GenomeLoc next = it.next();
|
GenomeLoc next = it.next();
|
||||||
|
|
||||||
if ( next.isBefore(current)) {
|
if ( next.isBefore(current)) {
|
||||||
throw new UserError.MalformedFile(myFile, "Interval "+next+" in the interval file is out of order.");
|
throw new UserException.MalformedFile(myFile, "Interval "+next+" in the interval file is out of order.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current.overlapsP(next)) {
|
if (current.overlapsP(next)) {
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,8 @@ package org.broadinstitute.sting.utils.interval;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.GenomeLocSortedSet;
|
import org.broadinstitute.sting.utils.GenomeLocSortedSet;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -40,7 +39,7 @@ public class IntervalUtils {
|
||||||
if (argument.equals("all")) {
|
if (argument.equals("all")) {
|
||||||
if (argList.size() != 1) {
|
if (argList.size() != 1) {
|
||||||
// throw error if '-L all' is not only interval - potentially conflicting commands
|
// throw error if '-L all' is not only interval - potentially conflicting commands
|
||||||
throw new UserError.CommandLineError(String.format("Conflicting arguments: Intervals given along with \"-L all\""));
|
throw new UserException.CommandLineException(String.format("Conflicting arguments: Intervals given along with \"-L all\""));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -54,7 +53,7 @@ public class IntervalUtils {
|
||||||
rawIntervals.addAll(GenomeLocParser.intervalFileToList(fileOrInterval));
|
rawIntervals.addAll(GenomeLocParser.intervalFileToList(fileOrInterval));
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
throw new UserError.MalformedFile(fileOrInterval, "Interval file could not be parsed in either format.", e);
|
throw new UserException.MalformedFile(fileOrInterval, "Interval file could not be parsed in either format.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -146,11 +145,11 @@ public class IntervalUtils {
|
||||||
if (file.exists())
|
if (file.exists())
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
throw new UserError.CouldNotReadInputFile(file, "The interval file does not exist.");
|
throw new UserException.CouldNotReadInputFile(file, "The interval file does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(file.exists())
|
if(file.exists())
|
||||||
throw new UserError.CouldNotReadInputFile(file, String.format("The interval file %s does not have one of " +
|
throw new UserException.CouldNotReadInputFile(file, String.format("The interval file %s does not have one of " +
|
||||||
"the supported extensions (.bed, .list, .picard, .interval_list, or .intervals). " +
|
"the supported extensions (.bed, .list, .picard, .interval_list, or .intervals). " +
|
||||||
"Please rename your file with the appropriate extension. If %s is NOT supposed to be a file, " +
|
"Please rename your file with the appropriate extension. If %s is NOT supposed to be a file, " +
|
||||||
"please move or rename the file at location %s", str, str, file.getAbsolutePath()));
|
"please move or rename the file at location %s", str, str, file.getAbsolutePath()));
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,8 @@ package org.broadinstitute.sting.utils.sam;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import net.sf.samtools.*;
|
import net.sf.samtools.*;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ebanks
|
* @author ebanks
|
||||||
|
|
@ -65,7 +64,7 @@ public class GATKSAMRecord extends SAMRecord {
|
||||||
|
|
||||||
// sanity check that the lengths of the base and quality strings are equal
|
// sanity check that the lengths of the base and quality strings are equal
|
||||||
if ( getBaseQualities().length != getReadLength() )
|
if ( getBaseQualities().length != getReadLength() )
|
||||||
throw new UserError.MalformedBam(this, String.format("Error: the number of base qualities does not match the number of bases in %s (and the GATK does not currently support '*' for the quals)", mRecord.getReadName()));
|
throw new UserException.MalformedBam(this, String.format("Error: the number of base qualities does not match the number of bases in %s (and the GATK does not currently support '*' for the quals)", mRecord.getReadName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,7 @@ package org.broadinstitute.sting.utils.wiggle;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.GATKException;
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
|
|
@ -50,7 +49,7 @@ public class WiggleWriter {
|
||||||
try {
|
try {
|
||||||
outputStream = new FileOutputStream(outputFile);
|
outputStream = new FileOutputStream(outputFile);
|
||||||
} catch ( FileNotFoundException e ) {
|
} catch ( FileNotFoundException e ) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(outputFile, "Unable to create a wiggle file ", e);
|
throw new UserException.CouldNotCreateOutputFile(outputFile, "Unable to create a wiggle file ", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
wWriter = new BufferedWriter(new OutputStreamWriter(outputStream));
|
wWriter = new BufferedWriter(new OutputStreamWriter(outputStream));
|
||||||
|
|
@ -87,7 +86,7 @@ public class WiggleWriter {
|
||||||
w.flush();
|
w.flush();
|
||||||
// flush required so writing to output stream will work
|
// flush required so writing to output stream will work
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UserError.CouldNotCreateOutputFile(myFile, String.format("Error writing the wiggle line %s", s), e);
|
throw new UserException.CouldNotCreateOutputFile(myFile, String.format("Error writing the wiggle line %s", s), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package org.broadinstitute.sting;
|
||||||
|
|
||||||
import org.apache.log4j.*;
|
import org.apache.log4j.*;
|
||||||
import org.apache.log4j.spi.LoggingEvent;
|
import org.apache.log4j.spi.LoggingEvent;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
|
|
@ -45,6 +46,7 @@ public abstract class BaseTest {
|
||||||
protected static String hg18Reference = "/seq/references/Homo_sapiens_assembly18/v0/Homo_sapiens_assembly18.fasta";
|
protected static String hg18Reference = "/seq/references/Homo_sapiens_assembly18/v0/Homo_sapiens_assembly18.fasta";
|
||||||
protected static String hg19Reference = "/seq/references/Homo_sapiens_assembly19/v0/Homo_sapiens_assembly19.fasta";
|
protected static String hg19Reference = "/seq/references/Homo_sapiens_assembly19/v0/Homo_sapiens_assembly19.fasta";
|
||||||
protected static String b36KGReference = "/humgen/1kg/reference/human_b36_both.fasta";
|
protected static String b36KGReference = "/humgen/1kg/reference/human_b36_both.fasta";
|
||||||
|
protected static String b37KGReference = "/humgen/1kg/reference/human_g1k_v37.fasta";
|
||||||
protected static String GATKDataLocation = "/humgen/gsa-hpprojects/GATK/data/";
|
protected static String GATKDataLocation = "/humgen/gsa-hpprojects/GATK/data/";
|
||||||
protected static String validationDataLocation = GATKDataLocation + "Validation_Data/";
|
protected static String validationDataLocation = GATKDataLocation + "Validation_Data/";
|
||||||
protected static String evaluationDataLocation = GATKDataLocation + "Evaluation_Data/";
|
protected static String evaluationDataLocation = GATKDataLocation + "Evaluation_Data/";
|
||||||
|
|
@ -140,13 +142,13 @@ public abstract class BaseTest {
|
||||||
try {
|
try {
|
||||||
digest = MessageDigest.getInstance("MD5");
|
digest = MessageDigest.getInstance("MD5");
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (NoSuchAlgorithmException e) {
|
||||||
throw new StingException("Unable to find MD5 digest");
|
throw new GATKException("Unable to find MD5 digest");
|
||||||
}
|
}
|
||||||
InputStream is;
|
InputStream is;
|
||||||
try {
|
try {
|
||||||
is = new FileInputStream(file);
|
is = new FileInputStream(file);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
throw new StingException("Unable to open file " + file);
|
throw new GATKException("Unable to open file " + file);
|
||||||
}
|
}
|
||||||
byte[] buffer = new byte[8192];
|
byte[] buffer = new byte[8192];
|
||||||
int read;
|
int read;
|
||||||
|
|
@ -160,14 +162,14 @@ public abstract class BaseTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
throw new StingException("Unable to process file for MD5", e);
|
throw new GATKException("Unable to process file for MD5", e);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
try {
|
try {
|
||||||
is.close();
|
is.close();
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
throw new StingException("Unable to close input stream for MD5 calculation", e);
|
throw new GATKException("Unable to close input stream for MD5 calculation", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ package org.broadinstitute.sting;
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
import org.broadinstitute.sting.gatk.CommandLineExecutable;
|
import org.broadinstitute.sting.gatk.CommandLineExecutable;
|
||||||
import org.broadinstitute.sting.gatk.CommandLineGATK;
|
import org.broadinstitute.sting.gatk.CommandLineGATK;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.collections.Pair;
|
import org.broadinstitute.sting.utils.collections.Pair;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
import org.broadinstitute.sting.utils.Utils;
|
||||||
|
|
@ -62,7 +63,7 @@ public class WalkerTest extends BaseTest {
|
||||||
if ( ! dir.exists() ) {
|
if ( ! dir.exists() ) {
|
||||||
System.out.printf("##### Creating MD5 db %s%n", MD5_FILE_DB_SUBDIR);
|
System.out.printf("##### Creating MD5 db %s%n", MD5_FILE_DB_SUBDIR);
|
||||||
if ( ! dir.mkdir() ) {
|
if ( ! dir.mkdir() ) {
|
||||||
throw new StingException("Infrastructure failure: failed to create md5 directory " + MD5_FILE_DB_SUBDIR);
|
throw new GATKException("Infrastructure failure: failed to create md5 directory " + MD5_FILE_DB_SUBDIR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -81,7 +82,7 @@ public class WalkerTest extends BaseTest {
|
||||||
try {
|
try {
|
||||||
FileUtils.copyFile(resultsFile, dbFile);
|
FileUtils.copyFile(resultsFile, dbFile);
|
||||||
} catch ( IOException e ) {
|
} catch ( IOException e ) {
|
||||||
throw new StingException(e.getMessage());
|
throw new GATKException(e.getMessage());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
System.out.printf("##### MD5 file is up to date: %s%n", dbFile.getPath());
|
System.out.printf("##### MD5 file is up to date: %s%n", dbFile.getPath());
|
||||||
|
|
@ -185,6 +186,7 @@ public class WalkerTest extends BaseTest {
|
||||||
int nOutputFiles = -1;
|
int nOutputFiles = -1;
|
||||||
List<String> md5s = null;
|
List<String> md5s = null;
|
||||||
List<String> exts = null;
|
List<String> exts = null;
|
||||||
|
Class expectedException = null;
|
||||||
|
|
||||||
protected Map<String, File> auxillaryFiles = new HashMap<String, File>();
|
protected Map<String, File> auxillaryFiles = new HashMap<String, File>();
|
||||||
|
|
||||||
|
|
@ -201,6 +203,21 @@ public class WalkerTest extends BaseTest {
|
||||||
this.exts = exts;
|
this.exts = exts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WalkerTestSpec(String args, int nOutputFiles, Class expectedException) {
|
||||||
|
this.args = args;
|
||||||
|
this.nOutputFiles = nOutputFiles;
|
||||||
|
this.expectedException = expectedException;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean expectsException() {
|
||||||
|
return expectedException != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Class getExpectedException() {
|
||||||
|
if ( ! expectsException() ) throw new GATKException("Tried to get expection for walker test that doesn't expect one");
|
||||||
|
return expectedException;
|
||||||
|
}
|
||||||
|
|
||||||
public void addAuxFile(String expectededMD5sum, File outputfile) {
|
public void addAuxFile(String expectededMD5sum, File outputfile) {
|
||||||
auxillaryFiles.put(expectededMD5sum, outputfile);
|
auxillaryFiles.put(expectededMD5sum, outputfile);
|
||||||
}
|
}
|
||||||
|
|
@ -223,6 +240,10 @@ public class WalkerTest extends BaseTest {
|
||||||
final String args = String.format(spec.args, tmpFiles.toArray());
|
final String args = String.format(spec.args, tmpFiles.toArray());
|
||||||
System.out.println(Utils.dupString('-', 80));
|
System.out.println(Utils.dupString('-', 80));
|
||||||
|
|
||||||
|
if ( spec.expectsException() ) {
|
||||||
|
// this branch handles the case were we are testing that a walker will fail as expected
|
||||||
|
return executeTest(name, null, tmpFiles, args, spec.getExpectedException());
|
||||||
|
} else {
|
||||||
List<String> md5s = new LinkedList<String>();
|
List<String> md5s = new LinkedList<String>();
|
||||||
md5s.addAll(spec.md5s);
|
md5s.addAll(spec.md5s);
|
||||||
|
|
||||||
|
|
@ -231,8 +252,8 @@ public class WalkerTest extends BaseTest {
|
||||||
md5s.add(md5);
|
md5s.add(md5);
|
||||||
tmpFiles.add(spec.auxillaryFiles.get(md5));
|
tmpFiles.add(spec.auxillaryFiles.get(md5));
|
||||||
}
|
}
|
||||||
|
return executeTest(name, md5s, tmpFiles, args, null);
|
||||||
return executeTest(name, md5s, tmpFiles, args);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public File createTempFile(String name, String extension) {
|
public File createTempFile(String name, String extension) {
|
||||||
|
|
@ -241,7 +262,7 @@ public class WalkerTest extends BaseTest {
|
||||||
fl.deleteOnExit();
|
fl.deleteOnExit();
|
||||||
return fl;
|
return fl;
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
throw new StingException("Cannot create temp file: " + ex.getMessage(), ex);
|
throw new GATKException("Cannot create temp file: " + ex.getMessage(), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -253,7 +274,7 @@ public class WalkerTest extends BaseTest {
|
||||||
* @param args the argument list
|
* @param args the argument list
|
||||||
* @return a pair of file and string lists
|
* @return a pair of file and string lists
|
||||||
*/
|
*/
|
||||||
private Pair<List<File>, List<String>> executeTest(String name, List<String> md5s, List<File> tmpFiles, String args) {
|
private Pair<List<File>, List<String>> executeTest(String name, List<String> md5s, List<File> tmpFiles, String args, Class expectedException) {
|
||||||
CommandLineGATK instance = new CommandLineGATK();
|
CommandLineGATK instance = new CommandLineGATK();
|
||||||
String[] command;
|
String[] command;
|
||||||
|
|
||||||
|
|
@ -271,7 +292,6 @@ public class WalkerTest extends BaseTest {
|
||||||
cmd2[command.length + 1] = this.outputFileLocation.getAbsolutePath();
|
cmd2[command.length + 1] = this.outputFileLocation.getAbsolutePath();
|
||||||
command = cmd2;
|
command = cmd2;
|
||||||
}
|
}
|
||||||
System.out.println(String.format("Executing test %s with GATK arguments: %s", name, Utils.join(" ",command)));
|
|
||||||
|
|
||||||
// add the logging level to each of the integration test commands
|
// add the logging level to each of the integration test commands
|
||||||
String[] cmd2 = Arrays.copyOf(command, command.length + 4);
|
String[] cmd2 = Arrays.copyOf(command, command.length + 4);
|
||||||
|
|
@ -281,21 +301,48 @@ public class WalkerTest extends BaseTest {
|
||||||
cmd2[command.length+3] = ENABLE_REPORTING ? "STANDARD" : "NO_ET";
|
cmd2[command.length+3] = ENABLE_REPORTING ? "STANDARD" : "NO_ET";
|
||||||
|
|
||||||
// run the executable
|
// run the executable
|
||||||
|
boolean gotAnException = false;
|
||||||
try {
|
try {
|
||||||
|
System.out.println(String.format("Executing test %s with GATK arguments: %s", name, Utils.join(" ",cmd2)));
|
||||||
CommandLineExecutable.start(instance, cmd2);
|
CommandLineExecutable.start(instance, cmd2);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
gotAnException = true;
|
||||||
|
if ( expectedException != null ) {
|
||||||
|
// we expect an exception
|
||||||
|
System.out.println(String.format("Wanted exception %s, saw %s", expectedException, e.getClass()));
|
||||||
|
if ( expectedException.isInstance(e) ) {
|
||||||
|
// it's the type we expected
|
||||||
|
System.out.println(String.format(" => %s PASSED", name));
|
||||||
|
} else {
|
||||||
|
e.printStackTrace();
|
||||||
|
Assert.fail(String.format("Test %s expected exception %s but got %s instead",
|
||||||
|
name, expectedException, e.getClass()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// we didn't expect an exception but we got one :-(
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// catch failures from the integration test
|
// catch failures from the integration test
|
||||||
if (CommandLineExecutable.result != 0) {
|
if ( expectedException != null ) {
|
||||||
|
if ( ! gotAnException )
|
||||||
|
// we expected an exception but didn't see it
|
||||||
|
Assert.fail(String.format("Test %s expected exception %s but none was thrown", name, expectedException.toString()));
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
if ( CommandLineExecutable.result != 0) {
|
||||||
throw new RuntimeException("Error running the GATK with arguments: " + args);
|
throw new RuntimeException("Error running the GATK with arguments: " + args);
|
||||||
}
|
}
|
||||||
|
|
||||||
// clean up some memory
|
// clean up some memory
|
||||||
instance = null;
|
instance = null;
|
||||||
cmd2 = null;
|
cmd2 = null;
|
||||||
|
|
||||||
|
// we need to check MD5s
|
||||||
return new Pair<List<File>, List<String>>(tmpFiles, assertMatchingMD5s(name, tmpFiles, md5s));
|
return new Pair<List<File>, List<String>>(tmpFiles, assertMatchingMD5s(name, tmpFiles, md5s));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static String[] escapeExpressions(String args, String delimiter) {
|
private static String[] escapeExpressions(String args, String delimiter) {
|
||||||
String[] command = {};
|
String[] command = {};
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
package org.broadinstitute.sting.commandline;
|
package org.broadinstitute.sting.commandline;
|
||||||
|
|
||||||
import org.broadinstitute.sting.BaseTest;
|
import org.broadinstitute.sting.BaseTest;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
|
@ -355,7 +356,7 @@ public class ParsingEngineUnitTest extends BaseTest {
|
||||||
parsingEngine.validate();
|
parsingEngine.validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected=StingException.class)
|
@Test(expected= GATKException.class)
|
||||||
public void duplicateLongNameTest() {
|
public void duplicateLongNameTest() {
|
||||||
parsingEngine.addArgumentSource( DuplicateLongNameProvider.class );
|
parsingEngine.addArgumentSource( DuplicateLongNameProvider.class );
|
||||||
}
|
}
|
||||||
|
|
@ -368,7 +369,7 @@ public class ParsingEngineUnitTest extends BaseTest {
|
||||||
public Integer bar;
|
public Integer bar;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected=StingException.class)
|
@Test(expected=GATKException.class)
|
||||||
public void duplicateShortNameTest() {
|
public void duplicateShortNameTest() {
|
||||||
parsingEngine.addArgumentSource( DuplicateShortNameProvider.class );
|
parsingEngine.addArgumentSource( DuplicateShortNameProvider.class );
|
||||||
}
|
}
|
||||||
|
|
@ -593,7 +594,7 @@ public class ParsingEngineUnitTest extends BaseTest {
|
||||||
RequiredArgProvider rap = new RequiredArgProvider();
|
RequiredArgProvider rap = new RequiredArgProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected=StingException.class)
|
@Test(expected=GATKException.class)
|
||||||
public void multipleArgumentCollectionTest() {
|
public void multipleArgumentCollectionTest() {
|
||||||
parsingEngine.addArgumentSource( MultipleArgumentCollectionProvider.class );
|
parsingEngine.addArgumentSource( MultipleArgumentCollectionProvider.class );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.broadinstitute.sting.gatk.datasources.providers;
|
package org.broadinstitute.sting.gatk.datasources.providers;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
@ -66,7 +67,7 @@ public class ShardDataProviderUnitTest extends BaseTest {
|
||||||
/**
|
/**
|
||||||
* Try adding a view which conflicts with some other view that's already been registered.
|
* Try adding a view which conflicts with some other view that's already been registered.
|
||||||
*/
|
*/
|
||||||
@Test(expected=StingException.class)
|
@Test(expected= GATKException.class)
|
||||||
public void testAddViewWithExistingConflict() {
|
public void testAddViewWithExistingConflict() {
|
||||||
View initial = new ConflictingTestView( provider );
|
View initial = new ConflictingTestView( provider );
|
||||||
View conflictsWithInitial = new TestView( provider );
|
View conflictsWithInitial = new TestView( provider );
|
||||||
|
|
@ -75,7 +76,7 @@ public class ShardDataProviderUnitTest extends BaseTest {
|
||||||
/**
|
/**
|
||||||
* Try adding a view which has a conflict with a previously registered view.
|
* Try adding a view which has a conflict with a previously registered view.
|
||||||
*/
|
*/
|
||||||
@Test(expected=StingException.class)
|
@Test(expected=GATKException.class)
|
||||||
public void testAddViewWithNewConflict() {
|
public void testAddViewWithNewConflict() {
|
||||||
View conflictsWithInitial = new TestView( provider );
|
View conflictsWithInitial = new TestView( provider );
|
||||||
View initial = new ConflictingTestView( provider );
|
View initial = new ConflictingTestView( provider );
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue