All exceptions thrown by the GATK have been reviewed and UserErrors replaced where appropriate. Shazam. Another check-in will remove the GATKException and restore the StingException.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4252 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
cf33614ddc
commit
8f1a32acae
|
|
@ -230,7 +230,7 @@ public class BWTFiles {
|
|||
* Convert the given reference sequence into a form suitable for building into
|
||||
* on-the-fly sequences.
|
||||
* @param referenceSequence The reference sequence to normalize.
|
||||
* @throws StingException if normalized sequence cannot be generated.
|
||||
* @throws GATKException if normalized sequence cannot be generated.
|
||||
*/
|
||||
private static void normalizeReferenceSequence(byte[] referenceSequence) {
|
||||
StringUtil.toUpperCase(referenceSequence);
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ public class BWTReader {
|
|||
}
|
||||
}
|
||||
catch( IOException ex ) {
|
||||
throw new StingException("Unable to read BWT from input stream.", ex);
|
||||
throw new GATKException("Unable to read BWT from input stream.", ex);
|
||||
}
|
||||
|
||||
return new BWT(inverseSA0, new Counts(count,true), sequenceBlocks);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ package org.broadinstitute.sting.analyzecovariates;
|
|||
import org.broadinstitute.sting.commandline.Input;
|
||||
import org.broadinstitute.sting.gatk.walkers.recalibration.*;
|
||||
import org.broadinstitute.sting.utils.classloader.PackageUtils;
|
||||
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
||||
import org.broadinstitute.sting.utils.text.XReadLines;
|
||||
import org.broadinstitute.sting.commandline.CommandLineProgram;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
|
|
@ -140,11 +141,8 @@ class AnalyzeCovariatesCLP extends CommandLineProgram {
|
|||
try {
|
||||
Covariate covariate = (Covariate)covClass.newInstance();
|
||||
requestedCovariates.add( covariate );
|
||||
|
||||
} catch ( InstantiationException e ) {
|
||||
throw new RuntimeException( String.format("Can not instantiate covariate class '%s': must be concrete class.", covClass.getSimpleName()) );
|
||||
} catch ( IllegalAccessException e ) {
|
||||
throw new RuntimeException( String.format("Can not instantiate covariate class '%s': must have no-arg constructor.", covClass.getSimpleName()) );
|
||||
} catch (Exception e) {
|
||||
throw new DynamicClassResolutionException(covClass, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import org.broadinstitute.sting.utils.classloader.JVMUtils;
|
|||
import org.broadinstitute.sting.gatk.walkers.Multiplex;
|
||||
import org.broadinstitute.sting.gatk.walkers.Multiplexer;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
|
@ -348,16 +349,13 @@ class SimpleArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
|||
Constructor ctor = type.getConstructor(String.class);
|
||||
result = ctor.newInstance(value);
|
||||
}
|
||||
}
|
||||
catch (NoSuchMethodException e) {
|
||||
throw new GATKException("constructFromString:NoSuchMethodException: Failed conversion " + e.getMessage());
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new GATKException("constructFromString:IllegalAccessException: Failed conversion " + e.getMessage());
|
||||
} catch (InvocationTargetException e) {
|
||||
throw new GATKException("constructFromString:InvocationTargetException: Failed conversion - this is most likely caused by using an incorrect data type (e.g. a double when an int is required)");
|
||||
} catch (InstantiationException e) {
|
||||
throw new GATKException("constructFromString:InstantiationException: Failed conversion " + e.getMessage());
|
||||
} catch (Exception e) {
|
||||
throw new DynamicClassResolutionException(String.class, e);
|
||||
}
|
||||
|
||||
|
||||
// WARNING: Side effect!
|
||||
parsingEngine.addTags(result,tags);
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public abstract class CommandLineExecutable extends CommandLineProgram {
|
|||
*/
|
||||
private void generateGATKRunReport(Walker<?,?> mWalker, Exception e) {
|
||||
if ( getArgumentCollection().phoneHomeType != GATKRunReport.PhoneHomeOption.NO_ET ) {
|
||||
GATKRunReport report = new GATKRunReport(mWalker, e, GATKEngine);
|
||||
GATKRunReport report = new GATKRunReport(mWalker, e, GATKEngine, getArgumentCollection().phoneHomeType );
|
||||
if ( getArgumentCollection().phoneHomeType == GATKRunReport.PhoneHomeOption.STDOUT )
|
||||
report.postReport(System.out);
|
||||
else
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ public class AlignmentContext {
|
|||
}
|
||||
|
||||
public AlignmentContext(GenomeLoc loc, ReadBackedPileup basePileup, long skippedBases,boolean hasPileupBeenDownsampled ) {
|
||||
if ( loc == null ) throw new StingException("BUG: GenomeLoc in Alignment context is null");
|
||||
if ( loc == null ) throw new GATKException("BUG: GenomeLoc in Alignment context is null");
|
||||
if ( basePileup == null ) throw new GATKException("BUG: ReadBackedPileup in Alignment context is null");
|
||||
if ( skippedBases < 0 ) throw new GATKException("BUG: skippedBases is -1 in Alignment context");
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package org.broadinstitute.sting.gatk.datasources;
|
||||
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
|
||||
/**
|
||||
|
|
@ -20,7 +21,7 @@ import org.broadinstitute.sting.utils.StingException;
|
|||
* This exception is throw when we're unable to generate a data source,
|
||||
* most likely due to an incomplete input source list
|
||||
*/
|
||||
public class DataSourceGenerationException extends StingException {
|
||||
public class DataSourceGenerationException extends GATKException {
|
||||
public DataSourceGenerationException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ class ReferenceOrderedQueryDataPool extends ResourcePool<FeatureSource, Location
|
|||
return new SeekableRODIterator(new FeatureToGATKFeatureIterator(resource.iterator(),rod.getName()));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new StingException("Unable to create iterator for rod named " + rod.getName(),e);
|
||||
throw new GATKException("Unable to create iterator for rod named " + rod.getName(),e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package org.broadinstitute.sting.gatk.datasources.simpleDataSources;
|
||||
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
|
||||
/**
|
||||
|
|
@ -28,7 +29,7 @@ import org.broadinstitute.sting.utils.StingException;
|
|||
* <p/>
|
||||
* Generate this on a simple data source load exception
|
||||
*/
|
||||
public class SimpleDataSourceLoadException extends StingException {
|
||||
public class SimpleDataSourceLoadException extends GATKException {
|
||||
public SimpleDataSourceLoadException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.broadinstitute.sting.gatk.datasources.simpleDataSources;
|
|||
|
||||
|
||||
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
|
||||
|
||||
|
|
@ -39,7 +40,7 @@ import org.broadinstitute.sting.utils.StingException;
|
|||
* <p/>
|
||||
* an exception that get's thrown if we can't split up a data source appropriately
|
||||
*/
|
||||
public class SimpleDataSourceSplitException extends StingException {
|
||||
public class SimpleDataSourceSplitException extends GATKException {
|
||||
public SimpleDataSourceSplitException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ public class OutputStreamStorage extends OutputStream implements Storage<OutputS
|
|||
outputStream.close();
|
||||
}
|
||||
catch( IOException ex ) {
|
||||
throw new StingException( "Unable to close output stream" );
|
||||
throw new UserError.CouldNotCreateOutputFile(file, "Unable to close output stream", ex );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import org.broadinstitute.sting.commandline.*;
|
|||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.io.File;
|
||||
|
|
@ -116,15 +117,8 @@ public class OutputStreamArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
|||
private Object createInstanceOfClass(Class type,OutputStream outputStream) {
|
||||
try {
|
||||
return getConstructorForClass(type).newInstance(outputStream);
|
||||
}
|
||||
catch( InstantiationException ex ) {
|
||||
throw new GATKException("Could not instantiate class with OutputStream constructor: " + type.getName());
|
||||
}
|
||||
catch( IllegalAccessException ex ) {
|
||||
throw new GATKException("Could not access class with OutputStream constructor: " + type.getName());
|
||||
}
|
||||
catch( InvocationTargetException ex ) {
|
||||
throw new GATKException("Could not invoke constructor for class with OutputStream constructor: " + type.getName());
|
||||
} catch (Exception e) {
|
||||
throw new DynamicClassResolutionException(type, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,6 +155,7 @@ public class GATKRunReport {
|
|||
public enum PhoneHomeOption {
|
||||
NO_ET,
|
||||
STANDARD,
|
||||
DEV,
|
||||
STDOUT
|
||||
}
|
||||
|
||||
|
|
@ -167,7 +168,10 @@ public class GATKRunReport {
|
|||
* @param e the exception caused by running this walker, or null if we completed successfully
|
||||
* @param engine the GAE we used to run the walker, so we can fetch runtime, args, etc
|
||||
*/
|
||||
public GATKRunReport(Walker<?,?> walker, Exception e, GenomeAnalysisEngine engine) {
|
||||
public GATKRunReport(Walker<?,?> walker, Exception e, GenomeAnalysisEngine engine, PhoneHomeOption type) {
|
||||
if ( type == PhoneHomeOption.NO_ET )
|
||||
throw new GATKException("Trying to create a run report when type is NO_ET!");
|
||||
|
||||
mGATKHeader = CommandLineGATK.createApplicationHeader();
|
||||
currentPath = System.getProperty("user.dir");
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
package org.broadinstitute.sting.gatk.refdata;
|
||||
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
import org.broadinstitute.sting.utils.text.XReadLines;
|
||||
import org.broadinstitute.sting.utils.Utils;
|
||||
|
|
@ -232,12 +233,8 @@ public class RODRecordIterator<ROD extends ReferenceOrderedDatum> implements Ite
|
|||
private ROD instantiateROD(final String name) {
|
||||
try {
|
||||
return (ROD) named_constructor.newInstance(name);
|
||||
} catch (java.lang.InstantiationException e) {
|
||||
throw new GATKException("Failed to instantiate ROD object of class "+type.getName());
|
||||
} catch (java.lang.IllegalAccessException e) {
|
||||
throw new GATKException("Access violation attempt while instantiating ROD object of class "+type.getName());
|
||||
} catch (InvocationTargetException e) {
|
||||
throw new GATKException("InvocationTargetException: Failed to instantiate ROD object of class "+type.getName());
|
||||
} catch (Exception e) {
|
||||
throw new DynamicClassResolutionException(named_constructor.getDeclaringClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
package org.broadinstitute.sting.gatk.refdata.tracks;
|
||||
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
|
||||
|
||||
|
|
@ -34,7 +35,7 @@ import org.broadinstitute.sting.utils.StingException;
|
|||
*
|
||||
* if we fail for some reason to make a track, throw this exception
|
||||
*/
|
||||
public class RMDTrackCreationException extends StingException {
|
||||
public class RMDTrackCreationException extends GATKException {
|
||||
public RMDTrackCreationException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -333,7 +333,7 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
|
|||
do {
|
||||
currentInterval = intervals.hasNext() ? intervals.next() : null;
|
||||
} while ( currentInterval != null && (readLoc == null || currentInterval.isBefore(readLoc)) );
|
||||
} catch (StingException 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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ import org.broadinstitute.sting.utils.classloader.PackageUtils;
|
|||
import org.broadinstitute.sting.utils.collections.NestedHashMap;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.commandline.ArgumentCollection;
|
||||
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
||||
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
||||
|
|
@ -213,10 +214,8 @@ public class CovariateCounterWalker extends LocusWalker<CovariateCounterWalker.C
|
|||
try {
|
||||
final Covariate covariate = (Covariate)covClass.newInstance();
|
||||
requestedCovariates.add( covariate );
|
||||
} catch ( InstantiationException e ) {
|
||||
throw new UserError.CommandLineError( String.format("Can not instantiate covariate class '%s': must be concrete class.", covClass.getSimpleName()) );
|
||||
} catch ( IllegalAccessException e ) {
|
||||
throw new UserError.CommandLineError( String.format("Can not instantiate covariate class '%s': must have no-arg constructor.", covClass.getSimpleName()) );
|
||||
} catch (Exception e) {
|
||||
throw new DynamicClassResolutionException(covClass, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -234,10 +233,8 @@ public class CovariateCounterWalker extends LocusWalker<CovariateCounterWalker.C
|
|||
// Now that we've found a matching class, try to instantiate it
|
||||
final Covariate covariate = (Covariate)covClass.newInstance();
|
||||
requestedCovariates.add( covariate );
|
||||
} catch ( InstantiationException e ) {
|
||||
throw new UserError.CommandLineError( String.format("Can not instantiate covariate class '%s': must be concrete class.", covClass.getSimpleName()) );
|
||||
} catch ( IllegalAccessException e ) {
|
||||
throw new UserError.CommandLineError( String.format("Can not instantiate covariate class '%s': must have no-arg constructor.", covClass.getSimpleName()) );
|
||||
} catch (Exception e) {
|
||||
throw new DynamicClassResolutionException(covClass, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ public class RecalDataManager {
|
|||
if( attr instanceof String ) {
|
||||
colorSpace = ((String)attr).getBytes();
|
||||
} else {
|
||||
throw new StingException(String.format("Value encoded by %s in %s isn't a string!", RecalDataManager.COLOR_SPACE_ATTRIBUTE_TAG, read.getReadName()));
|
||||
throw new UserError.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
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ import org.broadinstitute.sting.utils.classloader.PackageUtils;
|
|||
import org.broadinstitute.sting.utils.collections.NestedHashMap;
|
||||
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.UserError;
|
||||
import org.broadinstitute.sting.utils.text.TextFormattingUtils;
|
||||
import org.broadinstitute.sting.utils.Utils;
|
||||
|
|
@ -191,12 +192,10 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
|
|||
try {
|
||||
Covariate covariate = (Covariate)covClass.newInstance();
|
||||
requestedCovariates.add( covariate );
|
||||
|
||||
} catch ( InstantiationException e ) {
|
||||
throw new UserError.CommandLineError( String.format("Can not instantiate covariate class '%s': must be concrete class.", covClass.getSimpleName()) );
|
||||
} catch ( IllegalAccessException e ) {
|
||||
throw new UserError.CommandLineError( String.format("Can not instantiate covariate class '%s': must have no-arg constructor.", covClass.getSimpleName()) );
|
||||
} catch (Exception e) {
|
||||
throw new DynamicClassResolutionException(covClass, e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ import org.broadinstitute.sting.utils.StingException;
|
|||
import org.broadinstitute.sting.utils.Utils;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.commandline.Output;
|
||||
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
import org.broadinstitute.sting.utils.text.XReadLines;
|
||||
|
||||
|
|
@ -478,14 +479,8 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> {
|
|||
Constructor constructor = c.getConstructor(argTypes);
|
||||
VariantEvaluator eval = (VariantEvaluator)constructor.newInstance(args);
|
||||
evals.add(eval);
|
||||
} catch (InstantiationException e) {
|
||||
throw new StingException(String.format("Cannot instantiate class '%s': must be concrete class", c.getSimpleName()));
|
||||
} catch (NoSuchMethodException e) {
|
||||
throw new StingException(String.format("Cannot find expected constructor for class '%s': must have constructor accepting a single VariantEval2Walker object", c.getSimpleName()));
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new StingException(String.format("Cannot instantiate class '%s' (Illegal Access):", c.getSimpleName()));
|
||||
} catch (InvocationTargetException e) {
|
||||
throw new StingException(String.format("Cannot instantiate class '%s' (Invocation): %s", c.getSimpleName(), e.getMessage()));
|
||||
} catch (Exception e) {
|
||||
throw new DynamicClassResolutionException(c, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -565,7 +560,7 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> {
|
|||
if ( interesting != null ) interestingReasons.add(interesting);
|
||||
break;
|
||||
default:
|
||||
throw new StingException("BUG: Unexpected evaluation order " + evaluation);
|
||||
throw new GATKException("BUG: Unexpected evaluation order " + evaluation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
|||
import org.broadinstitute.sting.utils.*;
|
||||
import org.broadinstitute.sting.utils.collections.ExpandingArrayList;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
import org.broadinstitute.sting.utils.vcf.VCFUtils;
|
||||
import org.broadinstitute.sting.utils.text.XReadLines;
|
||||
|
||||
|
|
@ -127,7 +128,7 @@ public class ApplyVariantCuts extends RodWalker<Integer, Integer> {
|
|||
|
||||
return tranches;
|
||||
} catch( FileNotFoundException e ) {
|
||||
throw new StingException("Can not find input file: " + f);
|
||||
throw new UserError.CouldNotCreateOutputFile(f, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -155,7 +156,7 @@ public class ApplyVariantCuts extends RodWalker<Integer, Integer> {
|
|||
firstLine = false;
|
||||
}
|
||||
} catch( FileNotFoundException e ) {
|
||||
throw new StingException("Can not find input file: " + TRANCHES_FILE);
|
||||
throw new UserError.CouldNotCreateOutputFile(TRANCHES_FILE, e);
|
||||
}
|
||||
|
||||
// setup the header fields
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ 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.utils.exceptions.UserError;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
|
@ -147,7 +148,7 @@ public class GenerateVariantClustersWalker extends RodWalker<ExpandingArrayList<
|
|||
}
|
||||
|
||||
if(!foundDBSNP) {
|
||||
throw new StingException("dbSNP track is required. This calculation is critically dependent on being able to distinguish known and novel sites.");
|
||||
throw new UserError.CommandLineError("dbSNP track is required. This calculation is critically dependent on being able to distinguish known and novel sites.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -239,7 +240,7 @@ public class GenerateVariantClustersWalker extends RodWalker<ExpandingArrayList<
|
|||
// theModel = new VariantNearestNeighborsModel( dataManager, TARGET_TITV, NUM_KNN );
|
||||
// break;
|
||||
default:
|
||||
throw new StingException( "Variant Optimization Model is unrecognized. Implemented options are GAUSSIAN_MIXTURE_MODEL and K_NEAREST_NEIGHBORS" );
|
||||
throw new UserError.BadArgumentValue("OPTIMIZATION_MODEL", "Variant Optimization Model is unrecognized. Implemented options are GAUSSIAN_MIXTURE_MODEL and K_NEAREST_NEIGHBORS" );
|
||||
}
|
||||
|
||||
theModel.run( CLUSTER_FILE );
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ package org.broadinstitute.sting.gatk.walkers.variantrecalibration;
|
|||
import org.apache.log4j.Logger;
|
||||
import org.broadinstitute.sting.utils.collections.ExpandingArrayList;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
|
||||
import java.io.PrintStream;
|
||||
|
||||
|
|
@ -53,7 +54,7 @@ public class VariantDataManager {
|
|||
numVariants = dataList.size();
|
||||
data = dataList.toArray( new VariantDatum[numVariants] );
|
||||
if( numVariants <= 0 ) {
|
||||
throw new StingException( "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 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" );
|
||||
}
|
||||
if( _annotationKeys == null ) {
|
||||
numAnnotations = 0;
|
||||
|
|
@ -62,7 +63,7 @@ public class VariantDataManager {
|
|||
} else {
|
||||
numAnnotations = _annotationKeys.size();
|
||||
if( numAnnotations <= 0 ) {
|
||||
throw new StingException( "There are zero annotations!" );
|
||||
throw new UserError.BadInput("There are zero annotations. At least one annotation must be provided to use this walker!" );
|
||||
}
|
||||
meanVector = new double[numAnnotations];
|
||||
varianceVector = new double[numAnnotations];
|
||||
|
|
@ -110,7 +111,7 @@ public class VariantDataManager {
|
|||
}
|
||||
isNormalized = true; // Each data point is now [ (x - mean) / standard deviation ]
|
||||
if( foundZeroVarianceAnnotation ) {
|
||||
throw new StingException("Found annotations with zero variance. They must be excluded before proceeding.");
|
||||
throw new UserError.BadInput("Found annotations with zero variance. They must be excluded before proceeding.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,9 +28,11 @@ package org.broadinstitute.sting.gatk.walkers.variantrecalibration;
|
|||
import org.apache.log4j.Logger;
|
||||
import org.broad.tribble.util.variantcontext.VariantContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.MathUtils;
|
||||
import org.broadinstitute.sting.utils.collections.ExpandingArrayList;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
import org.broadinstitute.sting.utils.text.XReadLines;
|
||||
|
||||
import Jama.*;
|
||||
|
|
@ -130,11 +132,11 @@ public final class VariantGaussianMixtureModel extends VariantOptimizationModel
|
|||
} else if( CLUSTER_PATTERN.matcher(line).matches() ) {
|
||||
clusterLines.add(line);
|
||||
} else {
|
||||
throw new StingException("Malformed input file: " + clusterFile);
|
||||
throw new UserError.MalformedFile(clusterFile, "Could not parse line: " + line);
|
||||
}
|
||||
}
|
||||
} catch ( FileNotFoundException e ) {
|
||||
throw new StingException("Can not find input file: " + clusterFile);
|
||||
throw new UserError.CouldNotReadInputFile(clusterFile, e);
|
||||
}
|
||||
|
||||
dataManager = new VariantDataManager( annotationLines );
|
||||
|
|
@ -427,9 +429,8 @@ public final class VariantGaussianMixtureModel extends VariantOptimizationModel
|
|||
} else {
|
||||
try {
|
||||
value = Double.parseDouble( (String)vc.getAttribute( annotationKey ) );
|
||||
} catch( Exception e ) {
|
||||
throw new StingException("No double value detected for annotation = " + annotationKey +
|
||||
" in variant at " + VariantContextUtils.getLocation(vc) + ", reported annotation value = " + vc.getAttribute( annotationKey ) );
|
||||
} 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 );
|
||||
}
|
||||
}
|
||||
return value;
|
||||
|
|
@ -488,10 +489,11 @@ public final class VariantGaussianMixtureModel extends VariantOptimizationModel
|
|||
int annIndex = 0;
|
||||
for( final String annotation : dataManager.annotationKeys ) {
|
||||
PrintStream outputFile;
|
||||
File file = new File(outputPrefix + "." + annotation + ".dat");
|
||||
try {
|
||||
outputFile = new PrintStream( outputPrefix + "." + annotation + ".dat" );
|
||||
} catch (Exception e) {
|
||||
throw new StingException( "Unable to create output file: " + outputPrefix + ".dat" );
|
||||
outputFile = new PrintStream( file );
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new UserError.CouldNotCreateOutputFile( file, e );
|
||||
}
|
||||
|
||||
outputFile.println("annotationValue,knownDist,novelDist");
|
||||
|
|
@ -506,7 +508,7 @@ public final class VariantGaussianMixtureModel extends VariantOptimizationModel
|
|||
}
|
||||
}
|
||||
|
||||
public final void outputOptimizationCurve( final VariantDatum[] data, final PrintStream outputReportDatFile, final PrintStream outputTranchesFile,
|
||||
public final void outputOptimizationCurve( final VariantDatum[] data, final PrintStream outputReportDatFile, final PrintStream tranchesOutputFile,
|
||||
final int desiredNumVariants, final Double[] FDRtranches, final double QUAL_STEP ) {
|
||||
|
||||
final int numVariants = data.length;
|
||||
|
|
@ -530,19 +532,7 @@ public final class VariantGaussianMixtureModel extends VariantOptimizationModel
|
|||
markedVariant[iii] = false;
|
||||
}
|
||||
|
||||
PrintStream outputFile;
|
||||
try {
|
||||
outputFile = new PrintStream( outputReportDatFile );
|
||||
} catch (Exception e) {
|
||||
throw new StingException( "Unable to create output file: " + outputReportDatFile );
|
||||
}
|
||||
PrintStream tranchesOutputFile;
|
||||
try {
|
||||
tranchesOutputFile = new PrintStream( outputTranchesFile );
|
||||
tranchesOutputFile.println("FDRtranche,novelTITV,pCut,numNovel,filterName");
|
||||
} catch (Exception e) {
|
||||
throw new StingException( "Unable to create output file: " + outputTranchesFile );
|
||||
}
|
||||
tranchesOutputFile.println("FDRtranche,novelTITV,pCut,numNovel,filterName");
|
||||
|
||||
int numKnown = 0;
|
||||
int numNovel = 0;
|
||||
|
|
@ -552,7 +542,7 @@ public final class VariantGaussianMixtureModel extends VariantOptimizationModel
|
|||
int numNovelTv = 0;
|
||||
boolean foundDesiredNumVariants = false;
|
||||
int jjj = 0;
|
||||
outputFile.println("pCut,numKnown,numNovel,knownTITV,novelTITV");
|
||||
outputReportDatFile.println("pCut,numKnown,numNovel,knownTITV,novelTITV");
|
||||
for( double qCut = MAX_QUAL; qCut >= -0.001; qCut -= QUAL_STEP ) {
|
||||
for( int iii = 0; iii < numVariants; iii++ ) {
|
||||
if( !markedVariant[iii] ) {
|
||||
|
|
@ -584,7 +574,7 @@ public final class VariantGaussianMixtureModel extends VariantOptimizationModel
|
|||
logger.info("\t" + String.format("%.4f novel Ti/Tv ratio", ((double)numNovelTi) / ((double)numNovelTv)));
|
||||
foundDesiredNumVariants = true;
|
||||
}
|
||||
outputFile.println( qCut + "," + numKnown + "," + numNovel + "," +
|
||||
outputReportDatFile.println( qCut + "," + numKnown + "," + numNovel + "," +
|
||||
( numKnownTi == 0 || numKnownTv == 0 ? "NaN" : ( ((double)numKnownTi) / ((double)numKnownTv) ) ) + "," +
|
||||
( numNovelTi == 0 || numNovelTv == 0 ? "NaN" : ( ((double)numNovelTi) / ((double)numNovelTv) ) ));
|
||||
|
||||
|
|
@ -710,7 +700,7 @@ public final class VariantGaussianMixtureModel extends VariantOptimizationModel
|
|||
|
||||
logger.warn("About to throw exception due to numerical instability. Try running with fewer annotations and then with fewer Gaussians. " +
|
||||
"It is best to only use the annotations which appear to be Gaussianly distributed for this Gaussian mixture model.");
|
||||
throw new StingException("Numerical Instability! Found NaN after performing log10: " + pVarInClusterLog10[kkk] + ", cluster = " + kkk + ", variant index = " + iii);
|
||||
throw new GATKException("Numerical Instability! Found NaN after performing log10: " + pVarInClusterLog10[kkk] + ", cluster = " + kkk + ", variant index = " + iii);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -720,7 +710,7 @@ public final class VariantGaussianMixtureModel extends VariantOptimizationModel
|
|||
if( Double.isNaN(pVarInCluster[kkk][iii]) ) {
|
||||
logger.warn("About to throw exception due to numerical instability. Try running with fewer annotations and then with fewer Gaussians. " +
|
||||
"It is best to only use the annotations which appear to be Gaussianly distributed for this Gaussian mixture model.");
|
||||
throw new StingException("Numerical Instability! Found NaN after rescaling log10 values: " + pVarInCluster[kkk][iii] + ", cluster = " + kkk + ", variant index = " + iii);
|
||||
throw new GATKException("Numerical Instability! Found NaN after rescaling log10 values: " + pVarInCluster[kkk][iii] + ", cluster = " + kkk + ", variant index = " + iii);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -786,7 +776,7 @@ public final class VariantGaussianMixtureModel extends VariantOptimizationModel
|
|||
if( Double.isNaN(prob) ) {
|
||||
logger.warn("About to throw exception due to numerical instability. Try running with fewer annotations and then with fewer Gaussians. " +
|
||||
"It is best to only use the annotations which appear to be Gaussianly distributed for this Gaussian mixture model.");
|
||||
throw new StingException("Numerical Instability! Found NaN in M-step: " + pVarInCluster[kkk][iii] + ", cluster = " + kkk + ", variant index = " + iii);
|
||||
throw new GATKException("Numerical Instability! Found NaN in M-step: " + pVarInCluster[kkk][iii] + ", cluster = " + kkk + ", variant index = " + iii);
|
||||
}
|
||||
sumProb += prob;
|
||||
for( int jjj = 0; jjj < numAnnotations; jjj++ ) {
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
|||
import org.broadinstitute.sting.utils.*;
|
||||
import org.broadinstitute.sting.utils.collections.ExpandingArrayList;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
import org.broadinstitute.sting.utils.vcf.VCFUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
|
@ -143,7 +144,7 @@ public class VariantRecalibrator extends RodWalker<ExpandingArrayList<VariantDat
|
|||
// theModel = new VariantNearestNeighborsModel( dataManager, TARGET_TITV, NUM_KNN );
|
||||
// break;
|
||||
default:
|
||||
throw new StingException( "Variant Optimization Model is unrecognized. Implemented options are GAUSSIAN_MIXTURE_MODEL and K_NEAREST_NEIGHBORS" );
|
||||
throw new UserError.BadArgumentValue("OPTIMIZATION_MODEL", "Variant Optimization Model is unrecognized. Implemented options are GAUSSIAN_MIXTURE_MODEL and K_NEAREST_NEIGHBORS" );
|
||||
}
|
||||
|
||||
boolean foundDBSNP = false;
|
||||
|
|
@ -166,7 +167,7 @@ public class VariantRecalibrator extends RodWalker<ExpandingArrayList<VariantDat
|
|||
}
|
||||
|
||||
if(!foundDBSNP) {
|
||||
throw new StingException("dbSNP track is required. This calculation is critically dependent on being able to distinguish known and novel sites.");
|
||||
throw new UserError.CommandLineError("dbSNP track is required. This calculation is critically dependent on being able to distinguish known and novel sites.");
|
||||
}
|
||||
|
||||
// setup the header fields
|
||||
|
|
@ -232,7 +233,7 @@ public class VariantRecalibrator extends RodWalker<ExpandingArrayList<VariantDat
|
|||
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 ) {
|
||||
throw new StingException("Something is wrong with the prior that was entered by the user: Prior = " + totalPrior); // TODO - fix this up later
|
||||
throw new UserError.CommandLineError("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 );
|
||||
|
|
@ -285,7 +286,7 @@ public class VariantRecalibrator extends RodWalker<ExpandingArrayList<VariantDat
|
|||
PrintStream reportDatFilePrintStream = new PrintStream(REPORT_DAT_FILE);
|
||||
theModel.outputOptimizationCurve( dataManager.data, reportDatFilePrintStream, TRANCHES_FILE, DESIRED_NUM_VARIANTS, FDR_TRANCHES, QUAL_STEP );
|
||||
} catch ( FileNotFoundException e ) {
|
||||
throw new StingException("Can't create report dat file: " + REPORT_DAT_FILE.getName());
|
||||
throw new UserError.CouldNotCreateOutputFile(REPORT_DAT_FILE, e);
|
||||
}
|
||||
|
||||
// Execute Rscript command to plot the optimization curve
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnot
|
|||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.classloader.PackageUtils;
|
||||
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
@ -90,7 +92,7 @@ public class AnnotationByAlleleFrequencyWalker extends RodWalker<Integer, Integ
|
|||
if ( interfaceClass == null )
|
||||
interfaceClass = classMap.get(group + "Annotation");
|
||||
if ( interfaceClass == null )
|
||||
throw new StingException("Class " + group + " is not found; please check that you have specified the class name correctly");
|
||||
throw new UserError.BadArgumentValue("group", "Class " + group + " is not found; please check that you have specified the class name correctly");
|
||||
classes.addAll(PackageUtils.getClassesImplementingInterface(interfaceClass));
|
||||
}
|
||||
|
||||
|
|
@ -100,7 +102,7 @@ public class AnnotationByAlleleFrequencyWalker extends RodWalker<Integer, Integ
|
|||
if ( annotationClass == null )
|
||||
annotationClass = classMap.get(annotation + "Annotation");
|
||||
if ( annotationClass == null )
|
||||
throw new StingException("Class " + annotation + " is not found; please check that you have specified the class name correctly");
|
||||
throw new UserError.BadArgumentValue("annotation", "Class " + annotation + " is not found; please check that you have specified the class name correctly");
|
||||
classes.add(annotationClass);
|
||||
}
|
||||
|
||||
|
|
@ -128,10 +130,8 @@ public class AnnotationByAlleleFrequencyWalker extends RodWalker<Integer, Integ
|
|||
private static <T> T getInstance(Class<T> c) {
|
||||
try {
|
||||
return c.newInstance();
|
||||
} catch (InstantiationException e) {
|
||||
throw new StingException(String.format("Cannot instantiate annotation class '%s': must be concrete class", c.getSimpleName()));
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new StingException(String.format("Cannot instantiate annotation class '%s': must have no-arg constructor", c.getSimpleName()));
|
||||
} catch (Exception e) {
|
||||
throw new DynamicClassResolutionException(c, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,8 +33,10 @@ import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
|||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.commandline.Output;
|
||||
import org.broadinstitute.sting.utils.*;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.io.PrintStream;
|
||||
import java.io.FileNotFoundException;
|
||||
|
|
@ -85,7 +87,7 @@ public class BaseTransitionTableCalculatorJavaWalker extends LocusWalker<Set<Bas
|
|||
|
||||
public void initialize() {
|
||||
if ( nPreviousBases > 3 || ( nPreviousReadBases > 3 && readBasesMustMatchRef ) ) {
|
||||
throw new StingException("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 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.");
|
||||
}
|
||||
UnifiedArgumentCollection uac = new UnifiedArgumentCollection();
|
||||
uac.baseModel = BaseMismatchModel.THREE_STATE;
|
||||
|
|
@ -149,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 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.";
|
||||
throw new StingException(errMsg+errMsg2+errMsg3);
|
||||
throw new UserError.CommandLineError(errMsg+errMsg2+errMsg3);
|
||||
}
|
||||
return reduce(reduce1,reduce2);
|
||||
}
|
||||
|
|
@ -162,7 +164,7 @@ public class BaseTransitionTableCalculatorJavaWalker extends LocusWalker<Set<Bas
|
|||
try {
|
||||
output = new PrintStream(outFilePath);
|
||||
} catch ( FileNotFoundException e ) {
|
||||
throw new StingException("File given as input to -of, "+outFilePath+" could not be opened.",e);
|
||||
throw new UserError.CouldNotCreateOutputFile(new File(outFilePath), e);
|
||||
}
|
||||
}
|
||||
output.print(createHeaderFromConditions());
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
|||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
|
||||
|
|
@ -156,7 +157,7 @@ public class BeagleOutputByDepthWalker extends RodWalker<Integer, Integer> {
|
|||
else if (compGenotype.isHomVar())
|
||||
hg = 2;
|
||||
else
|
||||
throw new StingException("Bug! invalid genotype!");
|
||||
throw new GATKException("Bug! invalid genotype!");
|
||||
|
||||
if (postbglGenotype.isNoCall())
|
||||
bg = -1;
|
||||
|
|
@ -167,7 +168,7 @@ public class BeagleOutputByDepthWalker extends RodWalker<Integer, Integer> {
|
|||
else if (postbglGenotype.isHomVar())
|
||||
bg = 2;
|
||||
else
|
||||
throw new StingException("Bug! invalid genotype!");
|
||||
throw new GATKException("Bug! invalid genotype!");
|
||||
|
||||
|
||||
if (prebglGenotype.isNoCall())
|
||||
|
|
@ -179,7 +180,7 @@ public class BeagleOutputByDepthWalker extends RodWalker<Integer, Integer> {
|
|||
else if (prebglGenotype.isHomVar())
|
||||
pg = 2;
|
||||
else
|
||||
throw new StingException("Bug! invalid genotype!");
|
||||
throw new GATKException("Bug! invalid genotype!");
|
||||
|
||||
outputWriter.format("%d %d %d %d\n",dp, hg, pg, bg);
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
|||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.commandline.Output;
|
||||
import org.broadinstitute.sting.utils.*;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
||||
import net.sf.samtools.SAMRecord;
|
||||
|
||||
|
|
@ -390,7 +391,7 @@ public class DSBWalkerV3 extends ReadWalker<Integer,Integer> {
|
|||
} else if ( controlReadGroups.contains( read.getReadGroup().getReadGroupId() )) {
|
||||
addControl(read);
|
||||
} else {
|
||||
throw new StingException("Read "+read + " belongs to unrecognized read group");
|
||||
throw new UserError.MalformedBam(read, "Read "+read + " belongs to unrecognized read group");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import org.broadinstitute.sting.gatk.walkers.DataSource;
|
|||
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
|
||||
import org.broadinstitute.sting.gatk.walkers.Requires;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
|
|
@ -68,7 +69,7 @@ public class DbSNPWindowCounter extends LocusWalker<Integer, Long> {
|
|||
windowStart,
|
||||
windowStop);
|
||||
} catch (IOException e) {
|
||||
throw new StingException("Unable to query dbSNP track due to IO Exception",e);
|
||||
throw new UserError.CouldNotReadInputFile(myDbSNPFile, e);
|
||||
}
|
||||
|
||||
// count the number of dbSNPs we've seen
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import org.broadinstitute.sting.gatk.refdata.*;
|
|||
import org.broadinstitute.sting.gatk.refdata.features.refseq.RefSeqFeature;
|
||||
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
||||
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
|
|
@ -196,7 +197,7 @@ class IntervalInfoBuilder {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
throw new StingException("Attempting to update an IntervalInfoBuilder twice with the same (non-TCGA) gene: "+gene);
|
||||
throw new GATKException("Attempting to update an IntervalInfoBuilder twice with the same (non-TCGA) gene: "+gene);
|
||||
}
|
||||
} else {
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import org.broadinstitute.sting.gatk.refdata.features.samread.SAMReadFeature;
|
|||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
|
|
@ -71,7 +72,7 @@ public class DownsamplingValidationWalker extends LocusWalker<Integer,Long> {
|
|||
int matchingReadsFound = 0;
|
||||
if(unsampledReadsStartingAtThisLocus.isEmpty()) {
|
||||
if(!sampledReadsStartingAtThisLocus.isEmpty())
|
||||
throw new StingException("Downsampler hallucinated a read starting at locus "+ref.getLocus());
|
||||
throw new GATKException("Downsampler hallucinated a read starting at locus "+ref.getLocus());
|
||||
}
|
||||
else {
|
||||
boolean foundMatch = false;
|
||||
|
|
@ -86,10 +87,10 @@ public class DownsamplingValidationWalker extends LocusWalker<Integer,Long> {
|
|||
}
|
||||
|
||||
if(!foundMatch)
|
||||
throw new StingException("Downsampler failed to include any read starting at locus "+ref.getLocus());
|
||||
throw new GATKException("Downsampler failed to include any read starting at locus "+ref.getLocus());
|
||||
|
||||
if(matchingReadsFound > maxExpectedNumberOfReads)
|
||||
throw new StingException("Downsampler found too many reads starting at locus "+ref.getLocus());
|
||||
throw new GATKException("Downsampler found too many reads starting at locus "+ref.getLocus());
|
||||
}
|
||||
|
||||
return matchingReadsFound;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import org.broadinstitute.sting.utils.GenomeLoc;
|
|||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||
import org.broadinstitute.sting.utils.SampleUtils;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
import org.broadinstitute.sting.utils.vcf.VCFUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
|
@ -42,7 +43,7 @@ public class IndelAnnotator extends RodWalker<Integer,Long> {
|
|||
try {
|
||||
refseqIterator = new SeekableRODIterator(new FeatureToGATKFeatureIterator(refseq.iterator(),"refseq"));
|
||||
} catch (IOException e) {
|
||||
throw new StingException("Unable to open file " + RefseqFileName, e);
|
||||
throw new UserError.CouldNotReadInputFile(RefseqFileName, e);
|
||||
}
|
||||
|
||||
logger.info("Using RefSeq annotations from " + RefseqFileName);
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import org.broadinstitute.sting.gatk.walkers.Window;
|
|||
import org.broadinstitute.sting.utils.SampleUtils;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.collections.ExpandingArrayList;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
import org.broadinstitute.sting.utils.vcf.VCFUtils;
|
||||
|
||||
import java.io.PrintStream;
|
||||
|
|
@ -45,7 +46,7 @@ public class IndelDBRateWalker extends RodWalker<OverlapTable,OverlapTabulator>
|
|||
|
||||
public void initialize() {
|
||||
if ( indelWindow > 40 ) {
|
||||
throw new StingException("Indel windows have a maximum size of 40");
|
||||
throw new UserError.CommandLineError("Indel windows have a maximum size of 40");
|
||||
}
|
||||
|
||||
if ( outVCF != null ) {
|
||||
|
|
|
|||
|
|
@ -19,10 +19,7 @@ import org.broadinstitute.sting.gatk.walkers.genotyper.UnifiedArgumentCollection
|
|||
import org.broadinstitute.sting.gatk.walkers.genotyper.UnifiedGenotyperEngine;
|
||||
import org.broadinstitute.sting.gatk.walkers.genotyper.VariantCallContext;
|
||||
import org.broadinstitute.sting.gatk.walkers.varianteval.MendelianViolationEvaluator;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||
import org.broadinstitute.sting.utils.SampleUtils;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.*;
|
||||
import org.broadinstitute.sting.utils.collections.Pair;
|
||||
import org.broadinstitute.sting.utils.vcf.VCFUtils;
|
||||
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
||||
|
|
@ -422,7 +419,7 @@ public class MendelianViolationClassifier extends LocusWalker<MendelianViolation
|
|||
} else if ( isOppositeHomozygote(varContext) ) {
|
||||
violation = assessOppositeHomozygote(varContext,tracker,reference,context);
|
||||
} else {
|
||||
throw new StingException("Mendelian violation that is neither deNovo nor opposite homozygote. Should never see this.");
|
||||
throw new GATKException("Mendelian violation that is neither deNovo nor opposite homozygote. Should never see this.");
|
||||
}
|
||||
} else {
|
||||
violation = new MendelianViolation(varContext,MendelianViolationType.NONE);
|
||||
|
|
@ -466,7 +463,7 @@ public class MendelianViolationClassifier extends LocusWalker<MendelianViolation
|
|||
if ( ! trio.isFiltered() ) {
|
||||
Allele parental = trio.getGenotype(trioStructure.mom).getAllele(0); // guaranteed homozygous
|
||||
if ( parental.getBases().length < 1 ) {
|
||||
throw new StingException("Parental bases have length zero at "+trio.toString());
|
||||
throw new GATKException("Parental bases have length zero at "+trio.toString());
|
||||
}
|
||||
|
||||
Map<String,StratifiedAlignmentContext> splitContext = StratifiedAlignmentContext.splitContextBySample(context.getBasePileup());
|
||||
|
|
|
|||
|
|
@ -25,9 +25,13 @@
|
|||
|
||||
package org.broadinstitute.sting.oneoffprojects.walkers;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.QualityUtils;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
|
||||
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
|
|
@ -166,7 +170,7 @@ public class QualityScoreByStrandWalker extends LocusWalker<StrandedCounts,Stran
|
|||
pairOut.close();
|
||||
}
|
||||
} catch ( IOException e ) {
|
||||
throw new StingException("Outputfile could not be opened");
|
||||
throw new UserError.CouldNotCreateOutputFile(new File(pairOutput), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -207,7 +211,7 @@ class StrandedCounts {
|
|||
|
||||
public void updateReadPair( int fQual, int rQual, int fOff, int rOff ) { // hehe f Off
|
||||
if ( rOff < 0 || fOff < 0 )
|
||||
throw new StingException("Offset is negative. Should never happen.");
|
||||
throw new GATKException("Offset is negative. Should never happen.");
|
||||
forwardCountsByOffset[fOff][fQual < 0 ? 0 : fQual > 40 ? 40 : fQual]++;
|
||||
reverseCountsByOffset[rOff][rQual < 0 ? 0 : rQual > 40 ? 40 : rQual]++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import org.broadinstitute.sting.utils.GenomeLocParser;
|
|||
import org.broadinstitute.sting.utils.StingException;
|
||||
import net.sf.samtools.SAMRecord;
|
||||
import net.sf.samtools.SAMFileWriter;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
|
|
@ -79,9 +80,9 @@ public class ReadQualityScoreWalker extends ReadWalker<SAMRecord, SAMFileWriter>
|
|||
try {
|
||||
inputReader = new BufferedReader( new FileReader ( inputQualityFile ) );
|
||||
} catch ( FileNotFoundException e) {
|
||||
throw new StingException("Could not find required input file: " + inputQualityFile);
|
||||
throw new UserError.CouldNotReadInputFile(new File(inputQualityFile), e);
|
||||
} catch (IOException e) {
|
||||
throw new StingException("Failed while reading data from input file: " + inputQualityFile);
|
||||
throw new UserError.CouldNotReadInputFile(new File(inputQualityFile), e);
|
||||
}
|
||||
return outputBamFile;
|
||||
}
|
||||
|
|
@ -103,13 +104,13 @@ public class ReadQualityScoreWalker extends ReadWalker<SAMRecord, SAMFileWriter>
|
|||
try {
|
||||
if( line == null ) {
|
||||
line = inputReader.readLine();
|
||||
if( line == null ) { throw new StingException( "Input file is empty: " + inputQualityFile ); }
|
||||
if( line == null ) { throw new UserError.MalformedFile(new File(inputQualityFile), "Input file is empty" ); }
|
||||
}
|
||||
String[] halves = line.split( " ", 2 );
|
||||
GenomeLoc curLoc = GenomeLocParser.parseGenomeLoc( halves[0] );
|
||||
while( curLoc.isBefore( readLoc ) ) { // Loop until the beginning of the read
|
||||
line = inputReader.readLine();
|
||||
if( line == null ) { throw new StingException( "Input file doesn't encompass all reads. Can't find beginning of read: " + readLoc ); }
|
||||
if( line == null ) { throw new UserError.MalformedFile(new File(inputQualityFile), "Input file doesn't encompass all reads. Can't find beginning of read: " + readLoc ); }
|
||||
halves = line.split( " ", 2 );
|
||||
curLoc = GenomeLocParser.parseGenomeLoc( halves[0] );
|
||||
}
|
||||
|
|
@ -122,7 +123,7 @@ public class ReadQualityScoreWalker extends ReadWalker<SAMRecord, SAMFileWriter>
|
|||
sumNeighborhoodQuality += Float.parseFloat( halves[1] );
|
||||
numLines++;
|
||||
line = inputReader.readLine();
|
||||
if( line == null ) { throw new StingException( "Input file doesn't encompass all reads. Can't find end of read: " + readLoc ); }
|
||||
if( line == null ) { throw new UserError.MalformedFile(new File(inputQualityFile), "Input file doesn't encompass all reads. Can't find end of read: " + readLoc ); }
|
||||
halves = line.split( " ", 2 );
|
||||
curLoc = GenomeLocParser.parseGenomeLoc( halves[0] );
|
||||
}
|
||||
|
|
@ -132,9 +133,9 @@ public class ReadQualityScoreWalker extends ReadWalker<SAMRecord, SAMFileWriter>
|
|||
line = savedLine;
|
||||
|
||||
} catch ( FileNotFoundException e ) {
|
||||
throw new StingException( "Could not find required input file: " + inputQualityFile );
|
||||
throw new UserError.CouldNotReadInputFile(new File(inputQualityFile), e);
|
||||
} catch (IOException e ) {
|
||||
throw new StingException( "Failed while reading data from input file: " + inputQualityFile + " Also, " + e.getMessage() );
|
||||
throw new UserError.CouldNotReadInputFile(new File(inputQualityFile), e);
|
||||
}
|
||||
|
||||
meanNeighborhoodQuality = sumNeighborhoodQuality / ((float) numLines);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import org.broadinstitute.sting.alignment.bwa.c.BWACAligner;
|
|||
import org.broadinstitute.sting.alignment.Alignment;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.commandline.Output;
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||
|
|
@ -41,6 +42,7 @@ import net.sf.samtools.SAMRecord;
|
|||
import net.sf.samtools.util.StringUtil;
|
||||
import net.sf.picard.reference.ReferenceSequence;
|
||||
import net.sf.picard.reference.IndexedFastaSequenceFile;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
|
|
@ -85,7 +87,7 @@ public class TestReadFishingWalker extends ReadWalker<Integer,Long> {
|
|||
indelCallInputStream = new FileInputStream(indelCalls);
|
||||
}
|
||||
catch(IOException ex) {
|
||||
throw new StingException("Unable to load indel calls.");
|
||||
throw new UserError.CouldNotReadInputFile(indelCalls, ex);
|
||||
}
|
||||
|
||||
Scanner indelCallReader = new Scanner(indelCallInputStream);
|
||||
|
|
@ -127,7 +129,7 @@ public class TestReadFishingWalker extends ReadWalker<Integer,Long> {
|
|||
System.arraycopy(referenceSequence.getBases(),eventStart,revisedReference,eventStart+eventLength,bufferWidth);
|
||||
}
|
||||
else
|
||||
throw new StingException("Invalid indel type: " + type);
|
||||
throw new GATKException("Invalid indel type: " + type);
|
||||
|
||||
aligners.put(GenomeLocParser.createGenomeLoc(contig,start,stop),new BWACAligner(revisedReference,new BWAConfiguration()));
|
||||
if(++numAlignersCreated % 100 == 0)
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import org.broadinstitute.sting.gatk.datasources.simpleDataSources.ReferenceOrde
|
|||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrack;
|
||||
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.vcf.VCFUtils;
|
||||
|
|
@ -95,7 +96,7 @@ public class VCF4WriterTestWalker extends RodWalker<Integer, Integer> {
|
|||
out.printf("Read %d header lines%n", header.getMetaData().size());
|
||||
}
|
||||
catch (FileNotFoundException e ) {
|
||||
throw new StingException(e.getMessage());
|
||||
throw new GATKException(e.getMessage());
|
||||
}
|
||||
|
||||
final Set<String> vcfSamples = header.getGenotypeSamples();
|
||||
|
|
|
|||
|
|
@ -9,10 +9,12 @@ import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
|||
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.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.AminoAcidTable;
|
||||
import org.broadinstitute.sting.utils.analysis.AminoAcidUtils;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010 The Broad Institute
|
||||
|
|
@ -143,11 +145,11 @@ public class AminoAcidTransition extends VariantEvaluator {
|
|||
infoValueSplit = parent.aminoAcidTransitionSplit;
|
||||
useCodons = parent.aatUseCodons;
|
||||
if ( infoKey == null ) {
|
||||
throw new StingException("No info-field key provided for amino acid tabulation. Please provide the appropriate key with -aatk.");
|
||||
throw new UserError.CommandLineError("No info-field key provided for amino acid tabulation. Please provide the appropriate key with -aatk.");
|
||||
}
|
||||
|
||||
if ( infoValueSplit == null ) {
|
||||
throw new StingException("No split string provided for amino acid tabulation. Please provide the split string with -aats");
|
||||
throw new UserError.CommandLineError("No split string provided for amino acid tabulation. Please provide the split string with -aats");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ package org.broadinstitute.sting.playground.analyzeconcordance;
|
|||
|
||||
import org.broadinstitute.sting.commandline.CommandLineProgram;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.text.XReadLines;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.Utils;
|
||||
|
|
@ -91,11 +92,8 @@ public class AnalyzeConcordance extends CommandLineProgram {
|
|||
logger.info("Generating html report...");
|
||||
generateHtmlReport();
|
||||
logger.info("...Done!");
|
||||
|
||||
} catch (StingException se) {
|
||||
throw se;
|
||||
} catch (Exception e) {
|
||||
throw new StingException("Error analyzing concordance", e);
|
||||
throw new GATKException("Error analyzing concordance", e);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
@ -105,7 +103,7 @@ public class AnalyzeConcordance extends CommandLineProgram {
|
|||
// create the output directory where all the data tables and plots will go
|
||||
File outputDir = new File(this.outputDir);
|
||||
if (!outputDir.exists() && !outputDir.mkdirs()) {
|
||||
throw new StingException("Couldn't create directory: " + this.outputDir);
|
||||
throw new GATKException("Couldn't create directory: " + this.outputDir);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package org.broadinstitute.sting.playground.examples;
|
||||
|
||||
import org.apache.log4j.BasicConfigurator;
|
||||
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.Root;
|
||||
import org.simpleframework.xml.Serializer;
|
||||
|
|
@ -121,7 +123,7 @@ public class SampleXmlMarshaller {
|
|||
SampleXmlMarshaller example = serializer.read(SampleXmlMarshaller.class, source);
|
||||
return example;
|
||||
} catch (Exception e) {
|
||||
throw new StingException("Failed to marshal the data to file " + filename,e);
|
||||
throw new GATKException("Failed to marshal the data to file " + filename,e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import org.broadinstitute.sting.gatk.walkers.genotyper.UnifiedArgumentCollection
|
|||
import org.broadinstitute.sting.gatk.walkers.genotyper.UnifiedGenotyperEngine;
|
||||
import org.broadinstitute.sting.gatk.walkers.genotyper.VariantCallContext;
|
||||
import org.broadinstitute.sting.utils.BaseUtils;
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.commandline.Output;
|
||||
|
|
@ -155,7 +156,7 @@ public class LocusMismatchWalker extends LocusWalker<String,Integer> implements
|
|||
if ( g.isHomRef() ) return "HOM-REF";
|
||||
else if ( g.isHet() ) return "HET";
|
||||
else if ( g.isHom() ) return "HOM-NONREF";
|
||||
else throw new StingException("Unexpected genotype in getGenotypeClass " + g);
|
||||
else throw new GATKException("Unexpected genotype in getGenotypeClass " + g);
|
||||
}
|
||||
|
||||
public boolean useRead( PileupElement e ) {
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ public class ReadBackedPhasingWalker extends RodWalker<PhasingStatsAndOutput, Ph
|
|||
}
|
||||
}
|
||||
if (logger.isDebugEnabled() && (phasingSiteIndex == -1 || phasingSiteIndex == 0))
|
||||
throw new StingException("Internal error: could NOT find vr and/or prevVr!");
|
||||
throw new GATKException("Internal error: could NOT find vr and/or prevVr!");
|
||||
|
||||
if (sampleWindowVaList.size() > maxPhaseSites) {
|
||||
logger.warn("Trying to phase sample " + samp + " at locus " + VariantContextUtils.getLocation(vc) + " within a window of " + cacheWindow + " bases yields " + sampleWindowVaList.size() + " heterozygous sites to phase:\n" + toStringVRL(sampleWindowVaList));
|
||||
|
|
@ -432,7 +432,7 @@ public class ReadBackedPhasingWalker extends RodWalker<PhasingStatsAndOutput, Ph
|
|||
|
||||
public static void ensurePhasing(BialleleSNP curBiall, BialleleSNP prevBiall, Haplotype hap) {
|
||||
if (hap.size() < 2)
|
||||
throw new StingException("LOGICAL ERROR: Only considering haplotypes of length > 2!");
|
||||
throw new GATKException("LOGICAL ERROR: Only considering haplotypes of length > 2!");
|
||||
|
||||
byte prevBase = hap.getBase(0); // The 1st base in the haplotype
|
||||
byte curBase = hap.getBase(1); // The 2nd base in the haplotype
|
||||
|
|
@ -745,7 +745,7 @@ public class ReadBackedPhasingWalker extends RodWalker<PhasingStatsAndOutput, Ph
|
|||
private Haplotype complement(Haplotype hap) {
|
||||
int numSites = bialleleSNPs.length;
|
||||
if (hap.size() != numSites)
|
||||
throw new StingException("INTERNAL ERROR: hap.size() != numSites");
|
||||
throw new GATKException("INTERNAL ERROR: hap.size() != numSites");
|
||||
|
||||
// Take the other base at EACH position of the Haplotype:
|
||||
byte[] complementBases = new byte[numSites];
|
||||
|
|
@ -953,7 +953,7 @@ class Haplotype extends BaseArray implements Cloneable {
|
|||
|
||||
public void updateBase(int index, Byte base) {
|
||||
if (base == null) {
|
||||
throw new StingException("Internal error: CANNOT have null for a missing Haplotype base!");
|
||||
throw new GATKException("Internal error: CANNOT have null for a missing Haplotype base!");
|
||||
}
|
||||
super.updateBase(index, base);
|
||||
}
|
||||
|
|
@ -1053,7 +1053,7 @@ class Read extends BaseArray {
|
|||
|
||||
int sz = this.bases.length;
|
||||
if (sz != hap.bases.length)
|
||||
throw new StingException("Read and Haplotype should have same length to be compared!");
|
||||
throw new GATKException("Read and Haplotype should have same length to be compared!");
|
||||
|
||||
for (int i = 0; i < sz; i++) {
|
||||
Byte thisBase = this.getBase(i);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import org.broadinstitute.sting.commandline.Argument;
|
|||
import org.broadinstitute.sting.utils.StingException;
|
||||
import net.sf.samtools.SAMRecord;
|
||||
import net.sf.samtools.SAMReadGroupRecord;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.File;
|
||||
|
|
@ -59,11 +60,12 @@ public class MatePairLibrarySize extends ReadWalker<Integer, Integer> {
|
|||
String[] libraries = matePairSize.keySet().toArray(new String[1]);
|
||||
|
||||
for (String library : libraries) {
|
||||
File file = new File(String.format("%s/%s.pairdist", OUT_DIR.getAbsolutePath(), library));
|
||||
try {
|
||||
Integer[] sizes = matePairSize.get(library).keySet().toArray(new Integer[1]);
|
||||
|
||||
if (sizes != null && sizes.length > 1) {
|
||||
PrintWriter pw = new PrintWriter(String.format("%s/%s.pairdist", OUT_DIR.getAbsolutePath(), library));
|
||||
PrintWriter pw = new PrintWriter(file);
|
||||
Arrays.sort(sizes);
|
||||
|
||||
pw.printf("%s\t%s%n", "insert", "frequency");
|
||||
|
|
@ -77,7 +79,7 @@ public class MatePairLibrarySize extends ReadWalker<Integer, Integer> {
|
|||
pw.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new StingException("Unable to initialize output files.");
|
||||
throw new UserError.CouldNotCreateOutputFile(file, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
|||
import org.broadinstitute.sting.gatk.walkers.By;
|
||||
import org.broadinstitute.sting.gatk.walkers.DataSource;
|
||||
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.collections.Pair;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
|
|
@ -90,7 +91,7 @@ public class CoverageAcrossBaitsWalker extends LocusWalker<Pair<Integer, Integer
|
|||
IntervalRod intervalROD = tracker.lookup("interval",IntervalRod.class);
|
||||
|
||||
GenomeLoc interval = intervalROD == null ? null : intervalROD.getLocation();
|
||||
if (interval == null) { throw new StingException("No intervals at locus; should not happen"); }
|
||||
if (interval == null) { throw new GATKException("No intervals at locus; should not happen"); }
|
||||
int offset = (int)(context.getPosition() - interval.getStart());
|
||||
|
||||
int depth[] = new int[2];
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ import org.broadinstitute.sting.utils.StingException;
|
|||
import org.broadinstitute.sting.utils.collections.Pair;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.commandline.Output;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
|
@ -120,7 +121,7 @@ public class HybSelPerformanceWalker extends LocusWalker<Integer, HybSelPerforma
|
|||
try {
|
||||
refseqIterator = new SeekableRODIterator(new FeatureToGATKFeatureIterator(refseq.iterator(), "refseq"));
|
||||
} catch (IOException e) {
|
||||
throw new StingException("Unable to open file " + REFSEQ_FILE, e);
|
||||
throw new UserError.CouldNotReadInputFile(REFSEQ_FILE, e);
|
||||
}
|
||||
|
||||
logger.info("Using RefSeq annotations from "+REFSEQ_FILE);
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ package org.broadinstitute.sting.playground.gatk.walkers.phasing;
|
|||
|
||||
import org.broad.tribble.util.variantcontext.Allele;
|
||||
import org.broad.tribble.util.variantcontext.Genotype;
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -35,7 +36,7 @@ public class Biallele {
|
|||
|
||||
public Biallele(Genotype gt) {
|
||||
if (gt.getPloidy() != 2)
|
||||
throw new StingException("Biallele must have ploidy of 2!");
|
||||
throw new GATKException("Biallele must have ploidy of 2!");
|
||||
|
||||
this.top = gt.getAllele(0);
|
||||
this.bottom = gt.getAllele(1);
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ package org.broadinstitute.sting.playground.gatk.walkers.phasing;
|
|||
import org.broad.tribble.util.variantcontext.Allele;
|
||||
import org.broad.tribble.util.variantcontext.Genotype;
|
||||
import org.broadinstitute.sting.utils.BaseUtils;
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
|
||||
public class BialleleSNP extends Biallele {
|
||||
|
|
@ -34,9 +35,9 @@ public class BialleleSNP extends Biallele {
|
|||
super(gt);
|
||||
|
||||
if (getTopAllele().getBases().length != 1)
|
||||
throw new StingException("LOGICAL ERROR: BialleleSNP may not contain non-SNP site!");
|
||||
throw new GATKException("LOGICAL ERROR: BialleleSNP may not contain non-SNP site!");
|
||||
if (getBottomAllele().getBases().length != 1)
|
||||
throw new StingException("LOGICAL ERROR: BialleleSNP may not contain non-SNP site!");
|
||||
throw new GATKException("LOGICAL ERROR: BialleleSNP may not contain non-SNP site!");
|
||||
}
|
||||
|
||||
public byte getTopBase() {
|
||||
|
|
@ -62,7 +63,7 @@ public class BialleleSNP extends Biallele {
|
|||
else if (BaseUtils.basesAreEqual(base, botBase))
|
||||
return topBase;
|
||||
else
|
||||
throw new StingException("LOGICAL ERROR: base MUST match either TOP or BOTTOM!");
|
||||
throw new GATKException("LOGICAL ERROR: base MUST match either TOP or BOTTOM!");
|
||||
}
|
||||
|
||||
public static byte getSingleBase(byte[] bases) {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import org.broadinstitute.sting.gatk.datasources.simpleDataSources.ReferenceOrde
|
|||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
||||
import org.broadinstitute.sting.gatk.walkers.*;
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
|
||||
import java.io.*;
|
||||
|
|
@ -49,7 +50,7 @@ public class RodSystemValidationWalker extends RodWalker<Integer,Integer> {
|
|||
try {
|
||||
digest = MessageDigest.getInstance("MD5");
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new StingException("Unable to find MD5 checksumer");
|
||||
throw new GATKException("Unable to find MD5 checksumer");
|
||||
}
|
||||
out.println("Header:");
|
||||
// enumerate the list of ROD's we've loaded
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ import net.sf.samtools.SAMRecord;
|
|||
|
||||
import org.broadinstitute.sting.gatk.iterators.PushbackIterator;
|
||||
import org.broadinstitute.sting.utils.*;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
||||
import org.broadinstitute.sting.utils.collections.Pair;
|
||||
|
||||
|
|
@ -75,8 +76,8 @@ public class GenomicMap implements Iterable<Map.Entry<String, Collection<GenomeL
|
|||
* @param c mapping of the custom contig sequence onto intervals on the master reference
|
||||
*/
|
||||
public void addCustomContig(String name, Collection<GenomeLoc> c) {
|
||||
if ( name == null ) throw new StingException("Custom contig name can not be null");
|
||||
if ( map.containsKey(name)) throw new StingException("Custom contig "+name+" already exists");
|
||||
if ( name == null ) throw new GATKException("Custom contig name can not be null");
|
||||
if ( map.containsKey(name)) throw new GATKException("Custom contig "+name+" already exists");
|
||||
map.put(name, c);
|
||||
}
|
||||
|
||||
|
|
@ -102,7 +103,7 @@ public class GenomicMap implements Iterable<Map.Entry<String, Collection<GenomeL
|
|||
while( ( line = reader.readLine() ) != null ) {
|
||||
String[] halves = line.split("#",2);
|
||||
if ( halves.length < 2 )
|
||||
throw new StingException("Line: "+line+"\nin map file "+f+"\n does not contain contig name");
|
||||
throw new UserError.MalformedFile(f, "Line: "+line+"\nin map file "+f+"\n does not contain contig name");
|
||||
|
||||
int p1 = 0;
|
||||
for ( ; p1 < halves[1].length() && Character.isWhitespace(halves[1].charAt(p1) ); p1++ );
|
||||
|
|
@ -112,13 +113,13 @@ public class GenomicMap implements Iterable<Map.Entry<String, Collection<GenomeL
|
|||
// p2 is index of first whitespace after first word
|
||||
|
||||
if ( p1 == p2 )
|
||||
throw new StingException("Line: "+line+"\n in map file "+f+"\nNo contig name found after '#'");
|
||||
throw new UserError.MalformedFile(f, "Line: "+line+"\n in map file "+f+"\nNo contig name found after '#'");
|
||||
|
||||
String name = halves[1].substring(p1, p2);
|
||||
|
||||
String[] coord_parts = halves[0].split("\\s");
|
||||
if ( coord_parts.length % 3 != 0 )
|
||||
throw new StingException("Line: "+line+"\n in map file "+f+"\nNumber of coordinate fields is not a multiple of 3");
|
||||
throw new UserError.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 );
|
||||
|
||||
|
|
@ -135,9 +136,9 @@ public class GenomicMap implements Iterable<Map.Entry<String, Collection<GenomeL
|
|||
}
|
||||
reader.close();
|
||||
} catch ( FileNotFoundException e) {
|
||||
throw new StingException("Can not find map file "+f);
|
||||
throw new UserError.CouldNotReadInputFile(f, e);
|
||||
} catch (IOException e) {
|
||||
throw new StingException("Failed while reading data from map file "+f);
|
||||
throw new UserError.CouldNotReadInputFile(f, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -182,14 +183,14 @@ public class GenomicMap implements Iterable<Map.Entry<String, Collection<GenomeL
|
|||
p2 = p1;
|
||||
while ( p2 < line.length() && line.charAt(p2) != ',') p2++; // next comma or end-of-line
|
||||
}
|
||||
if ( segments.size() == 0 ) throw new StingException("Line "+line+" has no intervals specified");
|
||||
if ( segments.size() == 0 ) throw new GATKException("Line "+line+" has no intervals specified");
|
||||
addCustomContig(name, segments);
|
||||
}
|
||||
reader.close();
|
||||
} catch ( FileNotFoundException e) {
|
||||
throw new StingException("Can not find map file "+f);
|
||||
throw new UserError.CouldNotReadInputFile(f, e);
|
||||
} catch (IOException e) {
|
||||
throw new StingException("Failed while reading data from map file "+f);
|
||||
throw new UserError.CouldNotReadInputFile(f, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -208,7 +209,7 @@ public class GenomicMap implements Iterable<Map.Entry<String, Collection<GenomeL
|
|||
}
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
throw new StingException("Failed while writing data to map file "+f);
|
||||
throw new UserError.CouldNotCreateOutputFile(f, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -241,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):
|
||||
Collection<GenomeLoc> segments = getContigMapping(r.getReferenceName());
|
||||
if ( segments == null ) throw new StingException("Can not remap a record: unknown custom contig name "+r.getReferenceName());
|
||||
if ( segments == null ) throw new UserError.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:
|
||||
Pair<? extends Iterator<GenomeLoc>, Integer> p = seekForward(segments,customStart);
|
||||
|
|
@ -277,7 +278,7 @@ public class GenomicMap implements Iterable<Map.Entry<String, Collection<GenomeL
|
|||
case S: // soft clip
|
||||
case H: // or hard clip - these are not included in getAlignmentStart, so pass them through
|
||||
if ( k != 0 && k != N-1 ) // paranoid
|
||||
throw new StingException("Don't know what to do with S or N cigar element that is not at the either end of the cigar. Cigar: "+
|
||||
throw new GATKException("Don't know what to do with S or N cigar element that is not at the either end of the cigar. Cigar: "+
|
||||
r.getCigarString());
|
||||
case I: // insertions are passed through as well
|
||||
newCigar.add(new CigarElement(len,ce.getOperator()));
|
||||
|
|
@ -315,7 +316,7 @@ public class GenomicMap implements Iterable<Map.Entry<String, Collection<GenomeL
|
|||
if ( discardCrossContig ) {
|
||||
// System.out.println("WARNING: ALIGNMENT DISCARDED: "+message);
|
||||
return null;
|
||||
} else throw new StingException(message);
|
||||
} else throw new UserError.MalformedBam(r, message);
|
||||
}
|
||||
|
||||
gl = iter.next(); // advance to next segment
|
||||
|
|
@ -323,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
|
||||
|
||||
if ( gl.getContigIndex() != r.getReferenceIndex() )
|
||||
throw new StingException("Contig "+oldRefName+
|
||||
throw new UserError.MalformedBam(r, "Contig "+oldRefName+
|
||||
" has segments on different master contigs: currently unsupported");
|
||||
|
||||
if ( refPos < currStop + 1 )
|
||||
throw new StingException("Contig "+oldRefName+
|
||||
throw new UserError.MalformedBam(r, "Contig "+oldRefName+
|
||||
" has segments that are out of order or strictly adjacent: currently unsupported");
|
||||
if ( len > 0 && refPos > currStop + 1 ) {
|
||||
// add "panning" N's w/respect to the master ref over the region between adjacent segments
|
||||
|
|
@ -375,7 +376,7 @@ public class GenomicMap implements Iterable<Map.Entry<String, Collection<GenomeL
|
|||
*/
|
||||
private Pair<PushbackIterator<GenomeLoc>,Integer> seekForward(Collection<GenomeLoc> segments,int position) {
|
||||
|
||||
if ( position < 1 ) throw new StingException("Position "+position + " is outside of custom contig boundaries");
|
||||
if ( position < 1 ) throw new GATKException("Position "+position + " is outside of custom contig boundaries");
|
||||
|
||||
PushbackIterator<GenomeLoc> iter = new PushbackIterator<GenomeLoc>(segments.iterator());
|
||||
|
||||
|
|
@ -390,7 +391,7 @@ public class GenomicMap implements Iterable<Map.Entry<String, Collection<GenomeL
|
|||
position -= length;
|
||||
}
|
||||
// if we get here, position is to the right of the last segment; not good.
|
||||
throw new StingException("Position "+position + " is outside of custom contig boundaries");
|
||||
throw new GATKException("Position "+position + " is outside of custom contig boundaries");
|
||||
}
|
||||
|
||||
private long contigLength(Collection<GenomeLoc> segments) {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
package org.broadinstitute.sting.playground.utils;
|
||||
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.text.XReadLines;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -60,7 +61,7 @@ public class ProcessUtils {
|
|||
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
throw new StingException("Error running command:" + command, e);
|
||||
throw new GATKException("Error running command:" + command, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ package org.broadinstitute.sting.playground.utils.report;
|
|||
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.Param;
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
|
@ -74,7 +75,7 @@ public class AnalysisModuleScanner {
|
|||
/** scan the class and find all appropriate fields and tables */
|
||||
public void scan() {
|
||||
if (cls == null || !cls.isAnnotationPresent(Analysis.class))
|
||||
throw new StingException("The class passed in cannot be null, " + "" +
|
||||
throw new GATKException("The class passed in cannot be null, " + "" +
|
||||
"and must contain the @Analysis annotation, class " + cls + " was the input");
|
||||
|
||||
// get the annotation off of the class
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ package org.broadinstitute.sting.playground.utils.report;
|
|||
import org.broadinstitute.sting.playground.utils.report.templates.ReportFormat;
|
||||
import org.broadinstitute.sting.playground.utils.report.utils.ComplexDataUtils;
|
||||
import org.broadinstitute.sting.playground.utils.report.utils.Node;
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
|
||||
import java.io.*;
|
||||
|
|
@ -195,7 +196,7 @@ public class ReportMarshaller {
|
|||
else
|
||||
node.addAllChildren(nodes);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new StingException("Unable to access field " + f);
|
||||
throw new GATKException("Unable to access field " + f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package org.broadinstitute.sting.playground.utils.report;
|
|||
import org.broadinstitute.sting.playground.utils.report.templates.*;
|
||||
import org.broadinstitute.sting.playground.utils.report.utils.Node;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.List;
|
||||
|
|
@ -84,13 +85,8 @@ public class VE2ReportFactory {
|
|||
public static ReportFormat createByType(Class formatType) {
|
||||
try {
|
||||
return ((Class<? extends ReportFormat>) formatType).newInstance();
|
||||
}
|
||||
catch (InstantiationException ex) {
|
||||
throw new StingException(String.format("Unable to instantiate %s", formatType), ex);
|
||||
}
|
||||
catch (IllegalAccessException ex) {
|
||||
throw new StingException(String.format("Unable to access %s", formatType), ex);
|
||||
} catch (Exception e) {
|
||||
throw new DynamicClassResolutionException(formatType, e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.broadinstitute.sting.playground.utils.report.templates;
|
|||
|
||||
import org.broadinstitute.sting.playground.utils.report.utils.Node;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
|
|
@ -31,7 +32,7 @@ public class GrepFormat implements ReportFormat {
|
|||
try {
|
||||
stream = new PrintWriter(baseFile);
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new StingException("Unable to write to file " + baseFile, e);
|
||||
throw new UserError.CouldNotCreateOutputFile(baseFile, e);
|
||||
}
|
||||
privateWrite(baseNode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.broadinstitute.sting.playground.utils.report.templates;
|
|||
|
||||
import org.broadinstitute.sting.playground.utils.report.utils.Node;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
|
@ -36,7 +37,7 @@ public abstract class TableBasedFormat implements ReportFormat {
|
|||
* @param baseNode the root node
|
||||
*/
|
||||
public void write(Writer writeLocation, Node baseNode) {
|
||||
if (splitFilesByAnalysis()) throw new StingException("Unable to write output report, we require a file input for multi-file formats");
|
||||
if (splitFilesByAnalysis()) throw new UserError.CommandLineError("Unable to write output report, we require a file input for multi-file formats");
|
||||
// if there is only a single output file, create it
|
||||
stream = new PrintWriter(writeLocation);
|
||||
traverseAnalysisNodes(baseNode);
|
||||
|
|
@ -222,12 +223,13 @@ public abstract class TableBasedFormat implements ReportFormat {
|
|||
*/
|
||||
public void newStream(String analysisOrTableName) {
|
||||
String name = analysisOrTableName.replaceAll("\\s+","_").replaceAll("\\/","_slash_");
|
||||
File file = new File(this.baseLocation + "." + name + this.extension());
|
||||
if (stream == null || splitFilesByAnalysis()) {
|
||||
if (stream != null) stream.close();
|
||||
try {
|
||||
stream = new PrintWriter(this.baseLocation + "." + name + this.extension());
|
||||
stream = new PrintWriter(file);
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new StingException("Unable to create Report file at location " + this.baseLocation + "." + name + this.extension(), e);
|
||||
throw new UserError.CouldNotCreateOutputFile(file, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package org.broadinstitute.sting.playground.utils.report.templates;
|
||||
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
|
@ -103,7 +104,7 @@ class TextTable {
|
|||
try {
|
||||
writer.append("\n");
|
||||
} catch (IOException e) {
|
||||
throw new StingException("Unable to write to the Writer");
|
||||
throw new UserError.CouldNotCreateOutputFile(writer.toString(), "Unable to write to the Writer", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -128,7 +129,7 @@ class TextTable {
|
|||
if (y != rows.size() - 1)
|
||||
writer.append(seperator);
|
||||
} catch (IOException e) {
|
||||
throw new StingException("Unable to write to the Writer");
|
||||
throw new UserError.CouldNotCreateOutputFile(writer.toString(), "Unable to write to the Writer", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import org.broadinstitute.sting.gatk.io.stubs.SAMFileReaderArgumentTypeDescripto
|
|||
import org.broadinstitute.sting.gatk.io.stubs.SAMFileWriterArgumentTypeDescriptor;
|
||||
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrackManager;
|
||||
import org.broadinstitute.sting.gatk.walkers.Walker;
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
|
||||
import java.io.File;
|
||||
|
|
@ -94,7 +95,7 @@ public class GATKExtensionsGenerator extends CommandLineProgram {
|
|||
protected int execute() {
|
||||
try {
|
||||
if (!outputDirectory.isDirectory() && !outputDirectory.mkdirs())
|
||||
throw new StingException("Unable to create output directory: " + outputDirectory);
|
||||
throw new GATKException("Unable to create output directory: " + outputDirectory);
|
||||
|
||||
for (Class<? extends CommandLineProgram> clp: clpManager.getValues()) {
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class CardinalityCounter implements Iterator<int[]>, Iterable<int[]> {
|
|||
|
||||
public int[] next() {
|
||||
if (!hasNext())
|
||||
throw new StingException("CANNOT iterate past end!");
|
||||
throw new GATKException("CANNOT iterate past end!");
|
||||
|
||||
// Copy the assignment to be returned:
|
||||
int[] nextList = new int[valList.length];
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ public class GenomeLoc implements Comparable<GenomeLoc>, Cloneable, Serializable
|
|||
|
||||
public GenomeLoc merge( GenomeLoc that ) throws GATKException {
|
||||
if (!(this.contiguousP(that))) {
|
||||
throw new StingException("The two genome loc's need to be contigous");
|
||||
throw new GATKException("The two genome loc's need to be contigous");
|
||||
}
|
||||
|
||||
return new GenomeLoc(getContig(), this.contigIndex,
|
||||
|
|
@ -174,7 +174,7 @@ public class GenomeLoc implements Comparable<GenomeLoc>, Cloneable, Serializable
|
|||
|
||||
public GenomeLoc intersect( GenomeLoc that ) throws GATKException {
|
||||
if (!(this.overlapsP(that))) {
|
||||
throw new StingException("GenomeLoc::intersect(): The two genome loc's need to overlap");
|
||||
throw new GATKException("GenomeLoc::intersect(): The two genome loc's need to overlap");
|
||||
}
|
||||
|
||||
return new GenomeLoc(getContig(), this.contigIndex,
|
||||
|
|
|
|||
|
|
@ -193,13 +193,13 @@ public class GenomeLocParser {
|
|||
stop = parsePosition(str.substring(dashIndex + 1));
|
||||
}
|
||||
} catch(Exception e) {
|
||||
throw new StingException("Failed to parse Genome Location string: " + str, e);
|
||||
throw new UserError("Failed to parse Genome Location string: " + str, e);
|
||||
}
|
||||
}
|
||||
|
||||
// is the contig valid?
|
||||
if (!isContigValid(contig))
|
||||
throw new StingException("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 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?");
|
||||
|
||||
if (stop == Integer.MAX_VALUE && hasKnownContigOrdering())
|
||||
// lookup the actually stop position!
|
||||
|
|
@ -319,13 +319,7 @@ public class GenomeLocParser {
|
|||
*/
|
||||
public static List<GenomeLoc> intervalFileToList(final String file_name) {
|
||||
// try to open file
|
||||
File inputFile = null;
|
||||
try {
|
||||
inputFile = new File(file_name);
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new StingException("Could not open file", e);
|
||||
}
|
||||
File inputFile = new File(file_name);
|
||||
|
||||
// check if file is empty
|
||||
if (inputFile.exists() && inputFile.length() < 1) {
|
||||
|
|
@ -377,7 +371,7 @@ public class GenomeLocParser {
|
|||
return ret.isEmpty() ? null : ret;
|
||||
}
|
||||
catch (IOException e2) {
|
||||
throw new StingException("An I/O error occurred while reading the interval file.", e);
|
||||
throw new UserError.CouldNotReadInputFile(new File(file_name), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -433,10 +427,10 @@ public class GenomeLocParser {
|
|||
public static GenomeLoc createGenomeLoc(int contigIndex, final long start, final long stop) {
|
||||
checkSetup();
|
||||
if (start < 0) {
|
||||
throw new StingException("Bad start position " + start);
|
||||
throw new GATKException("Bad start position " + start);
|
||||
}
|
||||
if (stop < -1) {
|
||||
throw new StingException("Bad stop position " + stop);
|
||||
throw new GATKException("Bad stop position " + stop);
|
||||
} // a negative -1 indicates it's not a meaningful end position
|
||||
|
||||
|
||||
|
|
@ -503,16 +497,16 @@ public class GenomeLocParser {
|
|||
*/
|
||||
private static GenomeLoc exceptionOnInvalidGenomeLoc(GenomeLoc toReturn) {
|
||||
if (toReturn.getStart() < 0) {
|
||||
throw new StingException("Parameters to GenomeLocParser are incorrect: the start position is less than 0");
|
||||
throw new GATKException("Parameters to GenomeLocParser are incorrect: the start position is less than 0");
|
||||
}
|
||||
if ((toReturn.getStop() != -1) && (toReturn.getStop() < 0)) {
|
||||
throw new StingException("Parameters to GenomeLocParser are incorrect: the stop position is less than 0");
|
||||
throw new GATKException("Parameters to GenomeLocParser are incorrect: the stop position is less than 0");
|
||||
}
|
||||
if (toReturn.getContigIndex() < 0) {
|
||||
throw new StingException("Parameters to GenomeLocParser are incorrect: the contig index is less than 0");
|
||||
throw new GATKException("Parameters to GenomeLocParser are incorrect: the contig index is less than 0");
|
||||
}
|
||||
if (toReturn.getContigIndex() >= contigInfo.getSequences().size()) {
|
||||
throw new StingException("Parameters to GenomeLocParser are incorrect: the contig index is greater then the stored sequence count");
|
||||
throw new GATKException("Parameters to GenomeLocParser are incorrect: the contig index is greater then the stored sequence count");
|
||||
|
||||
}
|
||||
return toReturn;
|
||||
|
|
@ -533,11 +527,11 @@ public class GenomeLocParser {
|
|||
private static void exceptionOnInvalidGenomeLocBounds(GenomeLoc locus) {
|
||||
int contigSize = contigInfo.getSequence(locus.getContigIndex()).getSequenceLength();
|
||||
if(locus.getStart() > contigSize)
|
||||
throw new StingException(String.format("GenomeLoc is invalid: locus start %d is after the end of contig %s",locus.getStart(),locus.getContig()));
|
||||
throw new GATKException(String.format("GenomeLoc is invalid: locus start %d is after the end of contig %s",locus.getStart(),locus.getContig()));
|
||||
if(locus.getStop() > contigSize)
|
||||
throw new StingException(String.format("GenomeLoc is invalid: locus stop %d is after the end of contig %s",locus.getStop(),locus.getContig()));
|
||||
throw new GATKException(String.format("GenomeLoc is invalid: locus stop %d is after the end of contig %s",locus.getStop(),locus.getContig()));
|
||||
if (locus.getStart() > locus.getStop()) {
|
||||
throw new StingException("Parameters to GenomeLocParser are incorrect: the start position is greater than the end position");
|
||||
throw new GATKException("Parameters to GenomeLocParser are incorrect: the start position is greater than the end position");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -629,7 +623,7 @@ public class GenomeLocParser {
|
|||
|
||||
int index = -1;
|
||||
if ((index = contigInfo.getSequenceIndex(contig)) < 0) {
|
||||
throw new StingException("Contig name ( " + contig + " ) not in the set sequence dictionary.");
|
||||
throw new GATKException("Contig name ( " + contig + " ) not in the set sequence dictionary.");
|
||||
}
|
||||
return exceptionOnInvalidGenomeLoc(new GenomeLoc(contig, index, loc.start, loc.getStop()));
|
||||
}
|
||||
|
|
@ -642,7 +636,7 @@ public class GenomeLocParser {
|
|||
public static GenomeLoc setContigIndex(GenomeLoc loc, int contig) {
|
||||
checkSetup();
|
||||
if ((contig >= GenomeLocParser.contigInfo.getSequences().size()) || (contig < 0)) {
|
||||
throw new StingException("Contig index ( " + contig + " ) is not in the sequence dictionary set.");
|
||||
throw new GATKException("Contig index ( " + contig + " ) is not in the sequence dictionary set.");
|
||||
}
|
||||
return exceptionOnInvalidGenomeLoc(new GenomeLoc(GenomeLocParser.contigInfo.getSequence(contig).getSequenceName(), contig, loc.start, loc.getStop()));
|
||||
}
|
||||
|
|
@ -715,7 +709,7 @@ public class GenomeLocParser {
|
|||
/** check to make sure that we've setup the contig information */
|
||||
private static void checkSetup() {
|
||||
if (contigInfo == null) {
|
||||
throw new StingException("The GenomeLocParser hasn't been setup with a contig sequence yet");
|
||||
throw new GATKException("The GenomeLocParser hasn't been setup with a contig sequence yet");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ public class GenomeLocSortedSet extends AbstractSet<GenomeLoc> {
|
|||
} else {
|
||||
int loc = Collections.binarySearch(mArray,e);
|
||||
if (loc >= 0) {
|
||||
throw new StingException("Genome Loc Sorted Set already contains the GenomicLoc " + e.toString());
|
||||
throw new GATKException("Genome Loc Sorted Set already contains the GenomicLoc " + e.toString());
|
||||
} else {
|
||||
mArray.add((loc+1) * -1,e);
|
||||
return true;
|
||||
|
|
@ -193,7 +193,7 @@ public class GenomeLocSortedSet extends AbstractSet<GenomeLoc> {
|
|||
} else if ( e.getStop() < p.getStart() ) {
|
||||
toExclude.pop(); // p starts after e stops, e is done
|
||||
} else {
|
||||
throw new StingException("BUG: unexpected condition: p=" + p + ", e=" + e);
|
||||
throw new GATKException("BUG: unexpected condition: p=" + p + ", e=" + e);
|
||||
}
|
||||
|
||||
if ( i++ % 10000 == 0 )
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class HeapSizeMonitor {
|
|||
monitorThread.join();
|
||||
}
|
||||
catch(InterruptedException ex) {
|
||||
throw new StingException("Unable to connect to monitor thread");
|
||||
throw new GATKException("Unable to connect to monitor thread");
|
||||
}
|
||||
monitorThread = null;
|
||||
}
|
||||
|
|
@ -72,7 +72,7 @@ public class HeapSizeMonitor {
|
|||
Thread.sleep(monitorFrequencyMillis);
|
||||
}
|
||||
catch(InterruptedException ex) {
|
||||
throw new StingException("Unable to continue monitoring heap consumption",ex);
|
||||
throw new GATKException("Unable to continue monitoring heap consumption",ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ package org.broadinstitute.sting.utils;
|
|||
* bad sequence id out of bounds, etc.
|
||||
*/
|
||||
|
||||
public class MalformedGenomeLocException extends StingException {
|
||||
public class MalformedGenomeLocException extends GATKException {
|
||||
/**
|
||||
* Create a new MalformedGenomeLocException with the given message. Does not preserve the existing stack trace.
|
||||
* @param message The message.
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ public class PathUtils {
|
|||
}
|
||||
|
||||
if (dir.listFiles() == null) {
|
||||
throw new StingException("The volume '" + dir.getAbsolutePath() + "' could not be accessed.");
|
||||
throw new GATKException("The volume '" + dir.getAbsolutePath() + "' could not be accessed.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class ReservoirDownsampler<T> {
|
|||
*/
|
||||
public ReservoirDownsampler(final int maxElements) {
|
||||
if(maxElements < 0)
|
||||
throw new StingException("Unable to work with an negative size collection of elements");
|
||||
throw new GATKException("Unable to work with an negative size collection of elements");
|
||||
this.reservoir = new ArrayList<T>(maxElements);
|
||||
this.maxElements = maxElements;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ public class WilcoxonRankSum {
|
|||
U = n1 < n2 ? U1 : U2;
|
||||
break;
|
||||
default:
|
||||
throw new StingException("Unexpected WILCOXON H0: " + h0);
|
||||
throw new GATKException("Unexpected WILCOXON H0: " + h0);
|
||||
}
|
||||
|
||||
// data is nA nB then
|
||||
|
|
@ -232,7 +232,7 @@ public class WilcoxonRankSum {
|
|||
pvalue = NORMAL.cdf(z);
|
||||
break;
|
||||
default:
|
||||
throw new StingException("Unexpected WILCOXON H0: " + h0);
|
||||
throw new GATKException("Unexpected WILCOXON H0: " + h0);
|
||||
}
|
||||
|
||||
return pvalue;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package org.broadinstitute.sting.utils.bed;
|
||||
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
import org.broadinstitute.sting.utils.interval.IntervalMergingRule;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
|
|
@ -33,7 +34,7 @@ public class BedParser {
|
|||
try {
|
||||
mIn = new BufferedReader(new FileReader(fl));
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new StingException("Unable to open the bed file = " + fl);
|
||||
throw new UserError.CouldNotReadInputFile(fl, e);
|
||||
}
|
||||
mLocations = parseLocations();
|
||||
}
|
||||
|
|
@ -61,7 +62,7 @@ public class BedParser {
|
|||
locArray.add(parseLocation(line));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new StingException("Unable to parse line in BED file.");
|
||||
throw new UserError.MalformedFile("Unable to parse line in BED file.");
|
||||
}
|
||||
return locArray;
|
||||
}
|
||||
|
|
@ -82,7 +83,7 @@ public class BedParser {
|
|||
start = Integer.valueOf(parts[1]) + TO_ONE_BASED_ADDITION;
|
||||
stop = Integer.valueOf(parts[2]); // the ending point is an open interval
|
||||
} catch (Exception e) {
|
||||
throw new StingException("Unable to process bed file line = " + line);
|
||||
throw new UserError.MalformedFile("Unable to process bed file line = " + line, e);
|
||||
}
|
||||
|
||||
// we currently drop the rest of the bed record, which can contain names, scores, etc
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
package org.broadinstitute.sting.utils.classloader;
|
||||
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
|
|
@ -127,7 +128,7 @@ public class JVMUtils {
|
|||
field.set(instance, value);
|
||||
}
|
||||
catch( IllegalAccessException ex ) {
|
||||
throw new StingException(String.format("Could not set %s in instance %s to %s",field.getName(),instance.getClass().getName(),value.toString()));
|
||||
throw new GATKException(String.format("Could not set %s in instance %s to %s",field.getName(),instance.getClass().getName(),value.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -143,7 +144,7 @@ public class JVMUtils {
|
|||
return field.get(instance);
|
||||
}
|
||||
catch( IllegalAccessException ex ) {
|
||||
throw new StingException(String.format("Could not retrieve %s in instance %s",field.getName(),instance.getClass().getName()));
|
||||
throw new GATKException(String.format("Could not retrieve %s in instance %s",field.getName(),instance.getClass().getName()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,9 @@ package org.broadinstitute.sting.utils.classloader;
|
|||
import ch.qos.logback.classic.Level;
|
||||
import ch.qos.logback.classic.Logger;
|
||||
import ch.qos.logback.classic.LoggerContext;
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
||||
import org.reflections.Reflections;
|
||||
import org.reflections.scanners.SubTypesScanner;
|
||||
import org.reflections.util.ClasspathHelper;
|
||||
|
|
@ -95,10 +97,8 @@ public class PackageUtils {
|
|||
public static <T> T getSimpleInstance(Class<T> c) {
|
||||
try {
|
||||
return c.newInstance();
|
||||
} catch (InstantiationException e) {
|
||||
throw new StingException(String.format("Cannot instantiate class '%s': must be concrete class", c.getSimpleName()));
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new StingException(String.format("Cannot instantiate class '%s': must have no-arg constructor", c.getSimpleName()));
|
||||
} catch (Exception e) {
|
||||
throw new DynamicClassResolutionException(c, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ public class PackageUtils {
|
|||
method.invoke(ClassLoader.getSystemClassLoader(), url);
|
||||
resetReflections();
|
||||
} catch (Exception e) {
|
||||
throw new StingException("Error adding url to the current classloader.", e);
|
||||
throw new GATKException("Error adding url to the current classloader.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,10 @@
|
|||
|
||||
package org.broadinstitute.sting.utils.classloader;
|
||||
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.classloader.PackageUtils;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
|
@ -84,17 +86,13 @@ public abstract class PluginManager<PluginType> {
|
|||
* @return The plugin object if found; null otherwise.
|
||||
*/
|
||||
public PluginType createByName(String pluginName) {
|
||||
Class<? extends PluginType> plugin = pluginsByName.get(pluginName);
|
||||
try {
|
||||
Class<? extends PluginType> plugin = pluginsByName.get(pluginName);
|
||||
if( plugin == null )
|
||||
throw new StingException(String.format("Could not find %s with name: %s", pluginCategory,pluginName));
|
||||
throw new GATKException(String.format("Could not find %s with name: %s", pluginCategory,pluginName));
|
||||
return plugin.newInstance();
|
||||
}
|
||||
catch( InstantiationException ex ) {
|
||||
throw new StingException(String.format("Unable to instantiate %s %s",pluginCategory,pluginName), ex);
|
||||
}
|
||||
catch( IllegalAccessException ex ) {
|
||||
throw new StingException(String.format("Unable to access %s %s",pluginCategory,pluginName), ex);
|
||||
} catch (Exception e) {
|
||||
throw new DynamicClassResolutionException(plugin, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -107,12 +105,8 @@ public abstract class PluginManager<PluginType> {
|
|||
public PluginType createByType(Class pluginType) {
|
||||
try {
|
||||
return ((Class<? extends PluginType>) pluginType).newInstance();
|
||||
}
|
||||
catch( InstantiationException ex ) {
|
||||
throw new StingException(String.format("Unable to instantiate %s",pluginCategory), ex);
|
||||
}
|
||||
catch( IllegalAccessException ex ) {
|
||||
throw new StingException(String.format("Unable to access %s",pluginCategory), ex);
|
||||
} catch (Exception e) {
|
||||
throw new DynamicClassResolutionException(pluginType, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
package org.broadinstitute.sting.utils.collections;
|
||||
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
|
||||
|
||||
|
|
@ -69,7 +70,7 @@ public class CircularArray <T> {
|
|||
|
||||
/** Creates an array of fixed length */
|
||||
public CircularArray(int length) {
|
||||
if ( length <= 0 ) throw new StingException("CircularArray length must be positive. Passed: "+length);
|
||||
if ( length <= 0 ) throw new GATKException("CircularArray length must be positive. Passed: "+length);
|
||||
data = new Object[length];
|
||||
offset = 0;
|
||||
}
|
||||
|
|
@ -150,7 +151,7 @@ public class CircularArray <T> {
|
|||
|
||||
/** Creates an array of fixed length */
|
||||
public Int(int length) {
|
||||
if ( length <= 0 ) throw new StingException("CircularArray length must be positive. Passed: "+length);
|
||||
if ( length <= 0 ) throw new GATKException("CircularArray length must be positive. Passed: "+length);
|
||||
data = new int[length]; // automaticaly initialized to zeros
|
||||
offset = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ package org.broadinstitute.sting.utils.collections;
|
|||
|
||||
import org.broadinstitute.sting.gatk.refdata.utils.LocationAwareSeekableRODIterator;
|
||||
import org.broadinstitute.sting.gatk.refdata.utils.RODRecordList;
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
|
||||
|
|
@ -42,10 +43,10 @@ public class MergingIterator implements Iterator<RODRecordList>, Iterable<RODRec
|
|||
public Element(Iterator<RODRecordList> it) {
|
||||
if ( it instanceof LocationAwareSeekableRODIterator) {
|
||||
this.it = (LocationAwareSeekableRODIterator)it;
|
||||
if ( ! it.hasNext() ) throw new StingException("Iterator is empty");
|
||||
if ( ! it.hasNext() ) throw new GATKException("Iterator is empty");
|
||||
update();
|
||||
} else {
|
||||
throw new StingException("Iterator passed to MergingIterator is not LocationAwareSeekableRODIterator");
|
||||
throw new GATKException("Iterator passed to MergingIterator is not LocationAwareSeekableRODIterator");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class DupUtils {
|
|||
try {
|
||||
return (SAMRecord)read.clone();
|
||||
} catch ( CloneNotSupportedException e ) {
|
||||
throw new StingException("Unexpected Clone failure!");
|
||||
throw new GATKException("Unexpected Clone failure!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* 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.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;
|
||||
|
||||
/**
|
||||
* Class for handling common failures of dynamic class resolution
|
||||
*
|
||||
* User: depristo
|
||||
* Date: Sep 3, 2010
|
||||
* Time: 2:24:09 PM
|
||||
*/
|
||||
public class DynamicClassResolutionException extends UserError {
|
||||
public DynamicClassResolutionException(Class c, Exception ex) {
|
||||
super(String.format("Could not create module %s because %s caused by exception %s",
|
||||
c.getSimpleName(), moreInfo(ex), ex.getMessage()));
|
||||
}
|
||||
|
||||
private static String moreInfo(Exception ex) {
|
||||
try {
|
||||
throw ex;
|
||||
} catch (InstantiationException e) {
|
||||
return "BUG: cannot instantiate class: must be concrete class";
|
||||
} catch (NoSuchMethodException e) {
|
||||
return "BUG: Cannot find expected constructor for class";
|
||||
} catch (IllegalAccessException e) {
|
||||
return "Cannot instantiate class (Illegal Access)";
|
||||
} catch (InvocationTargetException e) {
|
||||
return "Cannot instantiate class (Invocation failure)";
|
||||
} catch ( Exception e ) {
|
||||
return "A general exception occurred";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -27,9 +27,11 @@ 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;
|
||||
|
||||
/**
|
||||
* Represents the common user errors detected by Sting / GATK
|
||||
|
|
@ -40,7 +42,7 @@ import java.io.File;
|
|||
* Date: Sep 3, 2010
|
||||
* Time: 2:24:09 PM
|
||||
*/
|
||||
public class UserError extends StingException {
|
||||
public class UserError extends GATKException {
|
||||
public UserError(String msg) { super(msg); }
|
||||
public UserError(String msg, Throwable e) { super(msg, e); }
|
||||
private UserError(Throwable e) { super("", e); } // cannot be called, private access
|
||||
|
|
@ -51,6 +53,12 @@ public class UserError extends StingException {
|
|||
}
|
||||
}
|
||||
|
||||
public static class BadInput extends UserError {
|
||||
public BadInput(String message) {
|
||||
super(String.format("Bad input: %s", message));
|
||||
}
|
||||
}
|
||||
|
||||
// todo -- fix up exception cause passing
|
||||
public static class MissingArgument extends CommandLineError {
|
||||
public MissingArgument(String arg, String message) {
|
||||
|
|
@ -156,7 +164,11 @@ public class UserError extends StingException {
|
|||
public MalformedFile(File f, String message, Exception e) {
|
||||
super(String.format("File %s is malformed: %s caused by %s", f.getAbsolutePath(), message, e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
public MalformedFile(String name, String message, Exception e) {
|
||||
super(String.format("File associated with name %s is malformed: %s caused by %s", name, message, e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
public static class CannotExecuteRScript extends UserError {
|
||||
public CannotExecuteRScript(String message, Exception e) {
|
||||
|
|
@ -183,5 +195,4 @@ public class UserError extends StingException {
|
|||
super(String.format("Walker %s is not available: %s", walkerName, message));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package org.broadinstitute.sting.utils.fasta;
|
||||
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
|
|
@ -34,7 +35,7 @@ public class ArtificialFastaUtils {
|
|||
try {
|
||||
s = new PrintStream(new FileOutputStream(fileName));
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new StingException("Filename " + fileName + " passed to the ArtificialFastaUtils generated a FileNotFound exception", e);
|
||||
throw new GATKException("Filename " + fileName + " passed to the ArtificialFastaUtils generated a FileNotFound exception", e);
|
||||
}
|
||||
generateFakeFasta(contigNames, contigSizes, pattern, s);
|
||||
}
|
||||
|
|
@ -58,7 +59,7 @@ public class ArtificialFastaUtils {
|
|||
*/
|
||||
private static void generateFakeFasta(List<String> contigNames, List<Integer> contigSizes, BASE_PATTERN pattern, PrintStream s) {
|
||||
if (contigNames.size() != contigSizes.size()) {
|
||||
throw new StingException("ArtificialContig name and size arrays are not equal sizes");
|
||||
throw new GATKException("ArtificialContig name and size arrays are not equal sizes");
|
||||
}
|
||||
for (int x = 0; x < contigNames.size(); x++) {
|
||||
ArtificialContig tig = new ArtificialContig(contigNames.get(x), contigSizes.get(x), pattern);
|
||||
|
|
@ -122,7 +123,7 @@ class ArtificialContig {
|
|||
case ALL_G:
|
||||
return "G";
|
||||
default:
|
||||
throw new StingException("Unknown base pattern");
|
||||
throw new GATKException("Unknown base pattern");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package org.broadinstitute.sting.utils.fastq;
|
||||
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
|
@ -23,7 +24,7 @@ public class FastqReader implements Iterator<FastqRecord>, Iterable<FastqRecord>
|
|||
|
||||
nextRecord = readNextRecord();
|
||||
} catch (IOException e) {
|
||||
throw new StingException(String.format("Error opening '%s'", fastqFile.getAbsolutePath()));
|
||||
throw new UserError.CouldNotReadInputFile(file, String.format("Error opening '%s'", fastqFile.getAbsolutePath()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -36,7 +37,7 @@ public class FastqReader implements Iterator<FastqRecord>, Iterable<FastqRecord>
|
|||
|
||||
return new FastqRecord(seqHeader, seqLine, qualHeader, qualLine);
|
||||
} catch (IOException e) {
|
||||
throw new StingException(String.format("Error reading '%s'", fastqFile.getAbsolutePath()));
|
||||
throw new UserError.CouldNotReadInputFile(fastqFile, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -52,7 +53,7 @@ public class FastqReader implements Iterator<FastqRecord>, Iterable<FastqRecord>
|
|||
nextRecord = null;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new StingException("IO problem");
|
||||
throw new UserError.CouldNotReadInputFile(fastqFile, e);
|
||||
}
|
||||
|
||||
return rec;
|
||||
|
|
@ -66,7 +67,7 @@ public class FastqReader implements Iterator<FastqRecord>, Iterable<FastqRecord>
|
|||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
|
||||
throw new UserError.CouldNotReadInputFile(fastqFile, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package org.broadinstitute.sting.utils.file;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
|
||||
import java.io.File;
|
||||
|
|
@ -143,7 +144,7 @@ public class FSLockWithShared {
|
|||
channel.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new StingException("An error occurred while unlocking file", e);
|
||||
throw new GATKException("An error occurred while unlocking file", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package org.broadinstitute.sting.utils.genotype;
|
|||
import edu.mit.broad.picard.genotype.DiploidGenotype;
|
||||
import edu.mit.broad.picard.genotype.geli.GenotypeLikelihoods;
|
||||
import net.sf.samtools.SAMFileHeader;
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
|
@ -234,15 +235,15 @@ public class LikelihoodObject {
|
|||
switch (mLikelihoodType) {
|
||||
case NEGATIVE_LOG:
|
||||
if (score < 0)
|
||||
throw new StingException("Likelikhood score of " + score + " is invalid, for NEGATIVE_LOG it must be greater than or equal to 0");
|
||||
throw new GATKException("Likelikhood score of " + score + " is invalid, for NEGATIVE_LOG it must be greater than or equal to 0");
|
||||
break;
|
||||
case LOG:
|
||||
if (score > 0)
|
||||
throw new StingException("Likelikhood score of " + score + " is invalid, for LOG it must be less than or equal to 0");
|
||||
throw new GATKException("Likelikhood score of " + score + " is invalid, for LOG it must be less than or equal to 0");
|
||||
break;
|
||||
case RAW:
|
||||
if (score < 0 || score > 1)
|
||||
throw new StingException("Likelikhood score of " + score + " is invalid, for RAW it must be [0,1]");
|
||||
throw new GATKException("Likelikhood score of " + score + " is invalid, for RAW it must be [0,1]");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@ package org.broadinstitute.sting.utils.genotype.glf;
|
|||
import net.sf.samtools.util.BinaryCodec;
|
||||
import net.sf.samtools.util.BlockCompressedInputStream;
|
||||
import net.sf.samtools.util.RuntimeEOFException;
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
import org.broadinstitute.sting.utils.genotype.LikelihoodObject;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
|
|
@ -63,23 +65,28 @@ public class GLFReader implements Iterator<GLFRecord> {
|
|||
// we have this variable becuase there is no eof for glf's
|
||||
private int lastRecordType = -1;
|
||||
|
||||
private File myFile;
|
||||
|
||||
/**
|
||||
* create a glf reader
|
||||
*
|
||||
* @param readFrom the file to read from
|
||||
*/
|
||||
public GLFReader(File readFrom) {
|
||||
myFile = readFrom;
|
||||
|
||||
try {
|
||||
inputBinaryCodec = new BinaryCodec(new DataInputStream(new BlockCompressedInputStream(readFrom)));
|
||||
} catch (IOException e) {
|
||||
throw new StingException("Unable to open " + readFrom.getName(), e);
|
||||
throw new UserError.CouldNotReadInputFile(myFile, e);
|
||||
}
|
||||
|
||||
inputBinaryCodec.setInputFileName(readFrom.getName());
|
||||
|
||||
// first verify that it's a valid GLF
|
||||
for (short s : glfMagic) {
|
||||
if (inputBinaryCodec.readUByte() != s)
|
||||
throw new StingException("Verification of GLF format failed: magic string doesn't match)");
|
||||
throw new UserError.MalformedFile(myFile, "Verification of GLF format failed: magic string doesn't match)");
|
||||
}
|
||||
|
||||
// get the header string
|
||||
|
|
@ -170,7 +177,7 @@ public class GLFReader implements Iterator<GLFRecord> {
|
|||
}
|
||||
//nextRecord = null;
|
||||
} else {
|
||||
throw new StingException("Unkonwn GLF record type (type = " + recordType + ")");
|
||||
throw new UserError.MalformedFile(myFile, "Unknown GLF record type (type = " + recordType + ")");
|
||||
}
|
||||
if (nextRecord != null) currentLocation = nextRecord.getPosition();
|
||||
return ret;
|
||||
|
|
@ -219,7 +226,7 @@ public class GLFReader implements Iterator<GLFRecord> {
|
|||
}
|
||||
|
||||
public void remove() {
|
||||
throw new StingException("GLFReader doesn't support remove()");
|
||||
throw new GATKException("GLFReader doesn't support remove()");
|
||||
}
|
||||
|
||||
public void close() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package org.broadinstitute.sting.utils.genotype.glf;
|
||||
|
||||
import net.sf.samtools.util.BinaryCodec;
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
|
||||
|
||||
|
|
@ -251,7 +252,7 @@ public abstract class GLFRecord {
|
|||
* @return the minimum value
|
||||
*/
|
||||
protected static double findMin(double vals[]) {
|
||||
if (vals.length < 1) throw new StingException("findMin: an array of size < 1 was passed in");
|
||||
if (vals.length < 1) throw new GATKException("findMin: an array of size < 1 was passed in");
|
||||
|
||||
double min = vals[0];
|
||||
for (double d : vals)
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
package org.broadinstitute.sting.utils.help;
|
||||
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.classloader.JVMUtils;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.commandline.CommandLineProgram;
|
||||
|
|
@ -80,7 +81,7 @@ public class ApplicationDetails {
|
|||
runningInstructions = JVMUtils.getLocationFor( application ).getName();
|
||||
}
|
||||
catch( IOException ex ) {
|
||||
throw new StingException("Unable to determine running instructions", ex);
|
||||
throw new GATKException("Unable to determine running instructions", ex);
|
||||
}
|
||||
|
||||
if( runningInstructions.endsWith(".jar") )
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import java.util.*;
|
|||
import java.io.PrintStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.classloader.JVMUtils;
|
||||
import org.broadinstitute.sting.utils.Utils;
|
||||
|
|
@ -181,7 +182,7 @@ public class ResourceBundleExtractorDoclet {
|
|||
for(Tag tag: element.tags()) {
|
||||
if(tag.name().equals("@"+DisplayNameTaglet.NAME)) {
|
||||
if(name != null)
|
||||
throw new StingException("Only one display name tag can be used per package / walker.");
|
||||
throw new GATKException("Only one display name tag can be used per package / walker.");
|
||||
name = tag.text();
|
||||
}
|
||||
else if(tag.name().equals("@"+VERSION_TAGLET_NAME))
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
package org.broadinstitute.sting.utils.instrumentation;
|
||||
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
|
||||
import java.lang.instrument.Instrumentation;
|
||||
|
|
@ -73,7 +74,7 @@ public class Sizeof {
|
|||
*/
|
||||
public static long getObjectSize(Object o) {
|
||||
if(!isEnabled())
|
||||
throw new StingException("Sizeof operator is currently disabled! To enable, review the documentation in Sizeof.java");
|
||||
throw new GATKException("Sizeof operator is currently disabled! To enable, review the documentation in Sizeof.java");
|
||||
return instrumentation.getObjectSize(o);
|
||||
}
|
||||
|
||||
|
|
@ -84,7 +85,7 @@ public class Sizeof {
|
|||
*/
|
||||
public static long getObjectGraphSize(Object o) {
|
||||
if(!isEnabled())
|
||||
throw new StingException("Sizeof operator is currently disabled! To enable, review the documentation in Sizeof.java");
|
||||
throw new GATKException("Sizeof operator is currently disabled! To enable, review the documentation in Sizeof.java");
|
||||
IdentityHashMap<Object,Object> objectsSeen = new IdentityHashMap<Object,Object>();
|
||||
return getObjectGraphSize(o,objectsSeen);
|
||||
}
|
||||
|
|
@ -134,7 +135,7 @@ public class Sizeof {
|
|||
fieldValue = field.get(o);
|
||||
}
|
||||
catch(IllegalAccessException ex) {
|
||||
throw new StingException("Unable to access field " + field.getName(),ex);
|
||||
throw new GATKException("Unable to access field " + field.getName(),ex);
|
||||
}
|
||||
totalSize += getObjectGraphSize(fieldValue,objectsSeen);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ package org.broadinstitute.sting.utils.interval;
|
|||
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
import org.broadinstitute.sting.utils.text.XReadLines;
|
||||
import org.broadinstitute.sting.gatk.iterators.PushbackIterator;
|
||||
import org.broadinstitute.sting.gatk.refdata.utils.StringToGenomeLocIteratorAdapter;
|
||||
|
|
@ -52,11 +53,13 @@ import java.io.FileNotFoundException;
|
|||
* iterator is a merging one).
|
||||
*/
|
||||
public class IntervalFileMergingIterator implements Iterator<GenomeLoc> {
|
||||
|
||||
private PushbackIterator<GenomeLoc> it ;
|
||||
private IntervalMergingRule myRule;
|
||||
private File myFile;
|
||||
|
||||
public IntervalFileMergingIterator(File f, IntervalMergingRule rule) {
|
||||
myFile = f;
|
||||
|
||||
try {
|
||||
XReadLines reader = new XReadLines(f);
|
||||
|
||||
|
|
@ -68,7 +71,7 @@ public class IntervalFileMergingIterator implements Iterator<GenomeLoc> {
|
|||
StringToGenomeLocIteratorAdapter.FORMAT.GATK ) ) ;
|
||||
}
|
||||
} catch ( FileNotFoundException e ) {
|
||||
throw new StingException("Can not open interval file "+f);
|
||||
throw new UserError.CouldNotReadInputFile(f, e);
|
||||
}
|
||||
myRule = rule;
|
||||
}
|
||||
|
|
@ -91,7 +94,7 @@ public class IntervalFileMergingIterator implements Iterator<GenomeLoc> {
|
|||
GenomeLoc next = it.next();
|
||||
|
||||
if ( next.isBefore(current)) {
|
||||
throw new StingException("Interval "+next+" in the interval file is out of order.");
|
||||
throw new UserError.MalformedFile(myFile, "Interval "+next+" in the interval file is out of order.");
|
||||
}
|
||||
|
||||
if (current.overlapsP(next)) {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import org.broadinstitute.sting.utils.GenomeLocSortedSet;
|
|||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
|
@ -39,7 +40,7 @@ public class IntervalUtils {
|
|||
if (argument.equals("all")) {
|
||||
if (argList.size() != 1) {
|
||||
// throw error if '-L all' is not only interval - potentially conflicting commands
|
||||
throw new StingException(String.format("Conflicting arguments: Intervals given along with \"-L all\""));
|
||||
throw new UserError.CommandLineError(String.format("Conflicting arguments: Intervals given along with \"-L all\""));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -53,9 +54,7 @@ public class IntervalUtils {
|
|||
rawIntervals.addAll(GenomeLocParser.intervalFileToList(fileOrInterval));
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new StingException(String.format("Interval file %s could not be parsed in either format. " +
|
||||
"The problem is:%n%s",
|
||||
fileOrInterval, e.getMessage()), e);
|
||||
throw new UserError.MalformedFile(fileOrInterval, "Interval file could not be parsed in either format.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -147,11 +146,11 @@ public class IntervalUtils {
|
|||
if (file.exists())
|
||||
return true;
|
||||
else
|
||||
throw new StingException(String.format("The interval file %s does not exist.", file.getAbsolutePath()));
|
||||
throw new UserError.CouldNotReadInputFile(file, "The interval file does not exist.");
|
||||
}
|
||||
|
||||
if(file.exists())
|
||||
throw new StingException(String.format("The interval file %s does not have one of " +
|
||||
throw new UserError.CouldNotReadInputFile(file, String.format("The interval file %s does not have one of " +
|
||||
"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 move or rename the file at location %s", str, str, file.getAbsolutePath()));
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
package org.broadinstitute.sting.utils.pileup;
|
||||
|
||||
import net.sf.samtools.SAMReadGroupRecord;
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.BaseUtils;
|
||||
|
|
@ -83,8 +84,8 @@ public abstract class AbstractReadBackedPileup<RBP extends AbstractReadBackedPil
|
|||
*
|
||||
*/
|
||||
public AbstractReadBackedPileup(GenomeLoc loc, List<PE> pileup) {
|
||||
if ( loc == null ) throw new StingException("Illegal null genomeloc in ReadBackedPileup");
|
||||
if ( pileup == null ) throw new StingException("Illegal null pileup in ReadBackedPileup");
|
||||
if ( loc == null ) throw new GATKException("Illegal null genomeloc in ReadBackedPileup");
|
||||
if ( pileup == null ) throw new GATKException("Illegal null pileup in ReadBackedPileup");
|
||||
|
||||
this.loc = loc;
|
||||
this.pileupElementTracker = new UnifiedPileupElementTracker<PE>(pileup);
|
||||
|
|
@ -97,8 +98,8 @@ public abstract class AbstractReadBackedPileup<RBP extends AbstractReadBackedPil
|
|||
* @param pileup
|
||||
*/
|
||||
public AbstractReadBackedPileup(GenomeLoc loc, List<PE> pileup, int size, int nDeletions, int nMQ0Reads) {
|
||||
if ( loc == null ) throw new StingException("Illegal null genomeloc in UnifiedReadBackedPileup");
|
||||
if ( pileup == null ) throw new StingException("Illegal null pileup in UnifiedReadBackedPileup");
|
||||
if ( loc == null ) throw new GATKException("Illegal null genomeloc in UnifiedReadBackedPileup");
|
||||
if ( pileup == null ) throw new GATKException("Illegal null pileup in UnifiedReadBackedPileup");
|
||||
|
||||
this.loc = loc;
|
||||
this.pileupElementTracker = new UnifiedPileupElementTracker<PE>(pileup);
|
||||
|
|
@ -159,9 +160,9 @@ public abstract class AbstractReadBackedPileup<RBP extends AbstractReadBackedPil
|
|||
* @return
|
||||
*/
|
||||
private PileupElementTracker<PE> readsOffsets2Pileup(List<SAMRecord> reads, List<Integer> offsets ) {
|
||||
if ( reads == null ) throw new StingException("Illegal null read list in UnifiedReadBackedPileup");
|
||||
if ( offsets == null ) throw new StingException("Illegal null offsets list in UnifiedReadBackedPileup");
|
||||
if ( reads.size() != offsets.size() ) throw new StingException("Reads and offset lists have different sizes!");
|
||||
if ( reads == null ) throw new GATKException("Illegal null read list in UnifiedReadBackedPileup");
|
||||
if ( offsets == null ) throw new GATKException("Illegal null offsets list in UnifiedReadBackedPileup");
|
||||
if ( reads.size() != offsets.size() ) throw new GATKException("Reads and offset lists have different sizes!");
|
||||
|
||||
UnifiedPileupElementTracker<PE> pileup = new UnifiedPileupElementTracker<PE>();
|
||||
for ( int i = 0; i < reads.size(); i++ ) {
|
||||
|
|
@ -179,8 +180,8 @@ public abstract class AbstractReadBackedPileup<RBP extends AbstractReadBackedPil
|
|||
* @return
|
||||
*/
|
||||
private PileupElementTracker<PE> readsOffsets2Pileup(List<SAMRecord> reads, int offset ) {
|
||||
if ( reads == null ) throw new StingException("Illegal null read list in UnifiedReadBackedPileup");
|
||||
if ( offset < 0 ) throw new StingException("Illegal offset < 0 UnifiedReadBackedPileup");
|
||||
if ( reads == null ) throw new GATKException("Illegal null read list in UnifiedReadBackedPileup");
|
||||
if ( offset < 0 ) throw new GATKException("Illegal offset < 0 UnifiedReadBackedPileup");
|
||||
|
||||
UnifiedPileupElementTracker<PE> pileup = new UnifiedPileupElementTracker<PE>();
|
||||
for ( int i = 0; i < reads.size(); i++ ) {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
package org.broadinstitute.sting.utils.pileup;
|
||||
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.collections.Pair;
|
||||
|
|
@ -140,7 +141,7 @@ public class ReadBackedExtendedEventPileupImpl extends AbstractReadBackedPileup<
|
|||
case INSERTION: v[i] = 'I'; break;
|
||||
case DELETION: v[i] = 'D'; break;
|
||||
case NOEVENT: v[i] = '.'; break;
|
||||
default: throw new StingException("Unknown event type encountered: "+e.getType());
|
||||
default: throw new GATKException("Unknown event type encountered: "+e.getType());
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
|
@ -190,7 +191,7 @@ public class ReadBackedExtendedEventPileupImpl extends AbstractReadBackedPileup<
|
|||
indel = getDeletionString(e.getEventLength(),refBases);
|
||||
break;
|
||||
case NOEVENT: continue;
|
||||
default: throw new StingException("Unknown event type encountered: "+e.getType());
|
||||
default: throw new GATKException("Unknown event type encountered: "+e.getType());
|
||||
}
|
||||
|
||||
cnt = events.get(indel);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import net.sf.samtools.Cigar;
|
|||
import net.sf.samtools.CigarElement;
|
||||
import net.sf.samtools.util.StringUtil;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.pileup.*;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.Utils;
|
||||
|
|
@ -146,7 +147,7 @@ public class AlignmentUtils {
|
|||
case H:
|
||||
case P:
|
||||
break;
|
||||
default: throw new StingException("The " + ce.getOperator() + " cigar element is not currently supported");
|
||||
default: throw new GATKException("The " + ce.getOperator() + " cigar element is not currently supported");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -298,7 +299,7 @@ public class AlignmentUtils {
|
|||
case P:
|
||||
break;
|
||||
default:
|
||||
throw new StingException( "Unsupported cigar operator: " + ce.getOperator() );
|
||||
throw new GATKException( "Unsupported cigar operator: " + ce.getOperator() );
|
||||
}
|
||||
}
|
||||
return alignment;
|
||||
|
|
@ -337,7 +338,7 @@ public class AlignmentUtils {
|
|||
case P:
|
||||
break;
|
||||
default:
|
||||
throw new StingException( "Unsupported cigar operator: " + ce.getOperator() );
|
||||
throw new GATKException( "Unsupported cigar operator: " + ce.getOperator() );
|
||||
}
|
||||
}
|
||||
return alignment;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import java.io.ByteArrayInputStream;
|
|||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.*;
|
||||
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||
|
|
@ -93,7 +94,7 @@ public class ArtificialSAMFileReader extends SAMFileReader {
|
|||
return new ByteArrayInputStream(byteArray);
|
||||
}
|
||||
catch( UnsupportedEncodingException ex ) {
|
||||
throw new StingException("Unable to build empty input stream",ex);
|
||||
throw new GATKException("Unable to build empty input stream",ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import net.sf.samtools.SAMRecord;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
|
||||
|
||||
|
|
@ -126,7 +127,7 @@ public class ArtificialSAMQueryIterator extends ArtificialSAMIterator {
|
|||
// sanity check that we have an actual matching read next
|
||||
SAMRecord rec = this.peek();
|
||||
if (rec == null) {
|
||||
throw new StingException("The next read doesn't match");
|
||||
throw new GATKException("The next read doesn't match");
|
||||
}
|
||||
// set the seeked variable to true
|
||||
seeked = true;
|
||||
|
|
@ -165,7 +166,7 @@ public class ArtificialSAMQueryIterator extends ArtificialSAMIterator {
|
|||
super.next();
|
||||
}
|
||||
if (!super.hasNext()) {
|
||||
throw new StingException("Unable to find the target chromosome");
|
||||
throw new GATKException("Unable to find the target chromosome");
|
||||
}
|
||||
while (super.hasNext() && this.peek().getAlignmentStart() < start) {
|
||||
super.next();
|
||||
|
|
@ -173,7 +174,7 @@ public class ArtificialSAMQueryIterator extends ArtificialSAMIterator {
|
|||
// sanity check that we have an actual matching read next
|
||||
SAMRecord rec = this.peek();
|
||||
if (!matches(rec)) {
|
||||
throw new StingException("The next read doesn't match");
|
||||
throw new GATKException("The next read doesn't match");
|
||||
}
|
||||
// set the seeked variable to true
|
||||
seeked = true;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.broadinstitute.sting.utils.sam;
|
|||
|
||||
import net.sf.samtools.*;
|
||||
import org.broadinstitute.sting.gatk.iterators.StingSAMIterator;
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
|
||||
import java.io.File;
|
||||
|
|
@ -115,7 +116,7 @@ public class ArtificialSAMUtils {
|
|||
*/
|
||||
public static SAMFileHeader createEnumeratedReadGroups( SAMFileHeader header, List<String> readGroupIDs, List<String> sampleNames ) {
|
||||
if (readGroupIDs.size() != sampleNames.size()) {
|
||||
throw new StingException("read group count and sample name count must be the same");
|
||||
throw new GATKException("read group count and sample name count must be the same");
|
||||
}
|
||||
|
||||
List<SAMReadGroupRecord> readGroups = new ArrayList<SAMReadGroupRecord>();
|
||||
|
|
@ -145,7 +146,7 @@ public class ArtificialSAMUtils {
|
|||
public static SAMRecord createArtificialRead( SAMFileHeader header, String name, int refIndex, int alignmentStart, int length ) {
|
||||
if( (refIndex == SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX && alignmentStart != SAMRecord.NO_ALIGNMENT_START) ||
|
||||
(refIndex != SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX && alignmentStart == SAMRecord.NO_ALIGNMENT_START) )
|
||||
throw new StingException("Invalid alignment start for artificial read, start = " + alignmentStart);
|
||||
throw new GATKException("Invalid alignment start for artificial read, start = " + alignmentStart);
|
||||
SAMRecord record = new SAMRecord(header);
|
||||
record.setReadName(name);
|
||||
record.setReferenceIndex(refIndex);
|
||||
|
|
@ -183,7 +184,7 @@ public class ArtificialSAMUtils {
|
|||
*/
|
||||
public static SAMRecord createArtificialRead( SAMFileHeader header, String name, int refIndex, int alignmentStart, byte[] bases, byte[] qual ) {
|
||||
if (bases.length != qual.length) {
|
||||
throw new StingException("Passed in read string is different length then the quality array");
|
||||
throw new GATKException("Passed in read string is different length then the quality array");
|
||||
}
|
||||
SAMRecord rec = createArtificialRead(header, name, refIndex, alignmentStart, bases.length);
|
||||
rec.setReadBases(bases);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import java.util.*;
|
|||
import net.sf.samtools.*;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
|
||||
/**
|
||||
* @author ebanks
|
||||
|
|
@ -64,7 +65,7 @@ public class GATKSAMRecord extends SAMRecord {
|
|||
|
||||
// sanity check that the lengths of the base and quality strings are equal
|
||||
if ( getBaseQualities().length != getReadLength() )
|
||||
throw new StingException(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 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()));
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import net.sf.samtools.SAMFileReader;
|
|||
|
||||
import java.io.File;
|
||||
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
|
||||
/**
|
||||
|
|
@ -72,9 +73,9 @@ public class SAMFileReaderBuilder {
|
|||
*/
|
||||
public SAMFileReader build() {
|
||||
if( samFile == null )
|
||||
throw new StingException( "Filename for output sam file must be supplied.");
|
||||
throw new GATKException( "Filename for output sam file must be supplied.");
|
||||
if( validationStringency == null )
|
||||
throw new StingException( "Header for output sam file must be supplied.");
|
||||
throw new GATKException( "Header for output sam file must be supplied.");
|
||||
|
||||
SAMFileReader reader = new SAMFileReader( samFile );
|
||||
reader.setValidationStringency( validationStringency );
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
package org.broadinstitute.sting.utils.text;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
|
||||
import java.util.*;
|
||||
|
|
@ -110,7 +111,7 @@ public class TextFormattingUtils {
|
|||
bundle = new PropertyResourceBundle(new StringReader(""));
|
||||
}
|
||||
catch(IOException ioe) {
|
||||
throw new StingException("No resource bundle found, and unable to create an empty placeholder.",ioe);
|
||||
throw new GATKException("No resource bundle found, and unable to create an empty placeholder.",ioe);
|
||||
}
|
||||
}
|
||||
return bundle;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package org.broadinstitute.sting.utils.wiggle;
|
||||
|
||||
import org.broadinstitute.sting.utils.GATKException;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
|
|
@ -40,12 +42,15 @@ public class WiggleWriter {
|
|||
private StepType type = StepType.variable;
|
||||
// the type of step for the wiggle file, todo -- allow this to change
|
||||
|
||||
private String myFile = "unknown";
|
||||
|
||||
public WiggleWriter(File outputFile) {
|
||||
myFile = outputFile.getAbsolutePath();
|
||||
FileOutputStream outputStream;
|
||||
try {
|
||||
outputStream = new FileOutputStream(outputFile);
|
||||
} catch ( FileNotFoundException e ) {
|
||||
throw new StingException("Unable to create a wiggle file at location: %s"+outputFile.getAbsolutePath(),e);
|
||||
throw new UserError.CouldNotCreateOutputFile(outputFile, "Unable to create a wiggle file ", e);
|
||||
}
|
||||
|
||||
wWriter = new BufferedWriter(new OutputStreamWriter(outputStream));
|
||||
|
|
@ -72,7 +77,7 @@ public class WiggleWriter {
|
|||
write(wWriter,String.format("%d\t%s",loc.getStart(),dataPoint.toString()));
|
||||
} else {
|
||||
// todo -- maybe allow this to open a new file for the new chromosome?
|
||||
throw new StingException("Attempting to write multiple contigs into wiggle file, first contig was "+firstLoc.getContig()+" most recent "+loc.getContig());
|
||||
throw new GATKException("Attempting to write multiple contigs into wiggle file, first contig was "+firstLoc.getContig()+" most recent "+loc.getContig());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -82,7 +87,7 @@ public class WiggleWriter {
|
|||
w.flush();
|
||||
// flush required so writing to output stream will work
|
||||
} catch (IOException e) {
|
||||
throw new StingException(String.format("Error writing the wiggle line %s",s),e);
|
||||
throw new UserError.CouldNotCreateOutputFile(myFile, String.format("Error writing the wiggle line %s", s), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue