Massive review of maybe 50% of the exceptions in the GATK. GATKException is a tmp. tracker so that I can tell which StingExceptions I've reviewed. Please don't use it. If you are working on new code and are considering throwing exceptions, it's either UserError or StingException, please
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4246 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
4183e8805a
commit
1de713f354
|
|
@ -26,6 +26,7 @@
|
||||||
package net.sf.picard.reference;
|
package net.sf.picard.reference;
|
||||||
|
|
||||||
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.ReferenceDataSourceProgressListener;
|
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.ReferenceDataSourceProgressListener;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import static net.sf.picard.reference.FastaSequenceIndexBuilder.Status.*;
|
import static net.sf.picard.reference.FastaSequenceIndexBuilder.Status.*;
|
||||||
|
|
||||||
|
|
@ -33,6 +34,7 @@ import java.io.*;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import net.sf.picard.reference.FastaSequenceIndex;
|
import net.sf.picard.reference.FastaSequenceIndex;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds FastaSequenceIndex from fasta file.
|
* Builds FastaSequenceIndex from fasta file.
|
||||||
|
|
@ -83,7 +85,7 @@ public class FastaSequenceIndexBuilder {
|
||||||
in = new DataInputStream(new BufferedInputStream(new FileInputStream(fastaFile)));
|
in = new DataInputStream(new BufferedInputStream(new FileInputStream(fastaFile)));
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
throw new StingException(String.format("Could not read fasta file %s", fastaFile.getAbsolutePath()));
|
throw new UserError.CouldNotReadInputFile(fastaFile, "Could not read fasta file", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -166,7 +168,7 @@ public class FastaSequenceIndexBuilder {
|
||||||
// validate base character
|
// validate base character
|
||||||
else {
|
else {
|
||||||
if (!isValidBase(currentByte))
|
if (!isValidBase(currentByte))
|
||||||
throw new StingException(String.format("An invalid base was found in the contig: %s", contig));
|
throw new UserError.MalformedFile(fastaFile, String.format("An invalid base was found in the contig: %s", contig));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -192,7 +194,7 @@ public class FastaSequenceIndexBuilder {
|
||||||
// error if next char is a valid base, end of contig otherwise
|
// error if next char is a valid base, end of contig otherwise
|
||||||
else if (basesThisLine != basesPerLine || bytesPerLine != bytesRead - endOfLastLine) {
|
else if (basesThisLine != basesPerLine || bytesPerLine != bytesRead - endOfLastLine) {
|
||||||
if (isValidBase(nextByte) && nextByte != -1) {
|
if (isValidBase(nextByte) && nextByte != -1) {
|
||||||
throw new StingException(String.format("An invalid line was found in the contig: %s", contig));
|
throw new UserError.MalformedFile(fastaFile, String.format("An invalid line was found in the contig: %s", contig));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
finishReadingContig(sequenceIndex);
|
finishReadingContig(sequenceIndex);
|
||||||
|
|
@ -204,7 +206,7 @@ public class FastaSequenceIndexBuilder {
|
||||||
// validate base character
|
// validate base character
|
||||||
else {
|
else {
|
||||||
if (!isValidBase(currentByte))
|
if (!isValidBase(currentByte))
|
||||||
throw new StingException(String.format("An invalid base was found in the contig: %s", contig));
|
throw new UserError.MalformedFile(fastaFile, String.format("An invalid base was found in the contig: %s", contig));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -212,9 +214,10 @@ public class FastaSequenceIndexBuilder {
|
||||||
return sequenceIndex;
|
return sequenceIndex;
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
throw new StingException(String.format("Could not read fasta file %s", fastaFile.getAbsolutePath()), e); }
|
throw new UserError.CouldNotReadInputFile(fastaFile, String.format("Could not read fasta file"), e);
|
||||||
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
throw new StingException(e.getMessage(), e);
|
throw new GATKException(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -270,8 +273,7 @@ public class FastaSequenceIndexBuilder {
|
||||||
out = new BufferedWriter(new FileWriter(faiFile));
|
out = new BufferedWriter(new FileWriter(faiFile));
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
throw new StingException(String.format("Could not open file %s for writing. Check that GATK is permitted to write to disk.",
|
throw new UserError.CouldNotCreateOutputFile(faiFile, e);
|
||||||
faiFile.getAbsolutePath()), e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -282,7 +284,7 @@ public class FastaSequenceIndexBuilder {
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
throw new StingException(String.format("An error occurred while writing file %s", e));
|
throw new UserError.CouldNotCreateOutputFile(faiFile, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package org.broadinstitute.sting.alignment;
|
package org.broadinstitute.sting.alignment;
|
||||||
|
|
||||||
import net.sf.samtools.*;
|
import net.sf.samtools.*;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.utils.BaseUtils;
|
import org.broadinstitute.sting.utils.BaseUtils;
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
import org.broadinstitute.sting.utils.Utils;
|
||||||
|
|
@ -189,7 +190,7 @@ public class Alignment {
|
||||||
read = (SAMRecord)unmappedRead.clone();
|
read = (SAMRecord)unmappedRead.clone();
|
||||||
}
|
}
|
||||||
catch(CloneNotSupportedException ex) {
|
catch(CloneNotSupportedException ex) {
|
||||||
throw new StingException("Unable to create aligned read from template.");
|
throw new GATKException("Unable to create aligned read from template.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newSAMHeader != null)
|
if(newSAMHeader != null)
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.utils.BaseUtils;
|
import org.broadinstitute.sting.utils.BaseUtils;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.alignment.bwa.c.BWACAligner;
|
import org.broadinstitute.sting.alignment.bwa.c.BWACAligner;
|
||||||
|
|
@ -120,7 +121,7 @@ public class AlignmentValidationWalker extends ReadWalker<Integer,Integer> {
|
||||||
logger.error(String.format(" Mapping quality: %s%n", alignmentsByScore[i].getMappingQuality()));
|
logger.error(String.format(" Mapping quality: %s%n", alignmentsByScore[i].getMappingQuality()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new StingException(String.format("Read %s mismatches!", read.getReadName()));
|
throw new GATKException(String.format("Read %s mismatches!", read.getReadName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.broadinstitute.sting.alignment.bwa;
|
package org.broadinstitute.sting.alignment.bwa;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.utils.BaseUtils;
|
import org.broadinstitute.sting.utils.BaseUtils;
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
import org.broadinstitute.sting.utils.Utils;
|
||||||
|
|
@ -76,7 +77,7 @@ public class BWTFiles {
|
||||||
*/
|
*/
|
||||||
public BWTFiles(String prefix) {
|
public BWTFiles(String prefix) {
|
||||||
if(prefix == null)
|
if(prefix == null)
|
||||||
throw new StingException("Prefix must not be null.");
|
throw new GATKException("Prefix must not be null.");
|
||||||
annFile = new File(prefix + ".ann");
|
annFile = new File(prefix + ".ann");
|
||||||
ambFile = new File(prefix + ".amb");
|
ambFile = new File(prefix + ".amb");
|
||||||
pacFile = new File(prefix + ".pac");
|
pacFile = new File(prefix + ".pac");
|
||||||
|
|
@ -135,7 +136,7 @@ public class BWTFiles {
|
||||||
success &= reverseSAFile.delete();
|
success &= reverseSAFile.delete();
|
||||||
|
|
||||||
if(!success)
|
if(!success)
|
||||||
throw new StingException("Unable to clean up autogenerated representation");
|
throw new GATKException("Unable to clean up autogenerated representation");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -183,7 +184,7 @@ public class BWTFiles {
|
||||||
writeEncodedReferenceSequence(reverseReferenceSequence,rpacFile,rbwtFile,rsaFile);
|
writeEncodedReferenceSequence(reverseReferenceSequence,rpacFile,rbwtFile,rsaFile);
|
||||||
}
|
}
|
||||||
catch(IOException ex) {
|
catch(IOException ex) {
|
||||||
throw new StingException("Unable to write autogenerated reference sequence to temporary files");
|
throw new GATKException("Unable to write autogenerated reference sequence to temporary files");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure that, at the very least, all temporary files are deleted on exit.
|
// Make sure that, at the very least, all temporary files are deleted on exit.
|
||||||
|
|
@ -235,7 +236,7 @@ public class BWTFiles {
|
||||||
StringUtil.toUpperCase(referenceSequence);
|
StringUtil.toUpperCase(referenceSequence);
|
||||||
for(byte base: referenceSequence) {
|
for(byte base: referenceSequence) {
|
||||||
if(base != 'A' && base != 'C' && base != 'G' && base != 'T')
|
if(base != 'A' && base != 'C' && base != 'G' && base != 'T')
|
||||||
throw new StingException(String.format("Base type %c is not supported when building references on-the-fly",(char)base));
|
throw new GATKException(String.format("Base type %c is not supported when building references on-the-fly",(char)base));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package org.broadinstitute.sting.alignment.bwa.c;
|
||||||
|
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
import net.sf.samtools.SAMFileHeader;
|
import net.sf.samtools.SAMFileHeader;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.alignment.Alignment;
|
import org.broadinstitute.sting.alignment.Alignment;
|
||||||
import org.broadinstitute.sting.alignment.bwa.BWAConfiguration;
|
import org.broadinstitute.sting.alignment.bwa.BWAConfiguration;
|
||||||
|
|
@ -29,15 +30,15 @@ public class BWACAligner extends BWAAligner {
|
||||||
public BWACAligner(BWTFiles bwtFiles, BWAConfiguration configuration) {
|
public BWACAligner(BWTFiles bwtFiles, BWAConfiguration configuration) {
|
||||||
super(bwtFiles,configuration);
|
super(bwtFiles,configuration);
|
||||||
if(thunkPointer != 0)
|
if(thunkPointer != 0)
|
||||||
throw new StingException("BWA/C attempting to reinitialize.");
|
throw new GATKException("BWA/C attempting to reinitialize.");
|
||||||
|
|
||||||
if(!bwtFiles.annFile.exists()) throw new StingException("ANN file is missing; please rerun 'bwa aln' to regenerate it.");
|
if(!bwtFiles.annFile.exists()) throw new GATKException("ANN file is missing; please rerun 'bwa aln' to regenerate it.");
|
||||||
if(!bwtFiles.ambFile.exists()) throw new StingException("AMB file is missing; please rerun 'bwa aln' to regenerate it.");
|
if(!bwtFiles.ambFile.exists()) throw new GATKException("AMB file is missing; please rerun 'bwa aln' to regenerate it.");
|
||||||
if(!bwtFiles.pacFile.exists()) throw new StingException("PAC file is missing; please rerun 'bwa aln' to regenerate it.");
|
if(!bwtFiles.pacFile.exists()) throw new GATKException("PAC file is missing; please rerun 'bwa aln' to regenerate it.");
|
||||||
if(!bwtFiles.forwardBWTFile.exists()) throw new StingException("Forward BWT file is missing; please rerun 'bwa aln' to regenerate it.");
|
if(!bwtFiles.forwardBWTFile.exists()) throw new GATKException("Forward BWT file is missing; please rerun 'bwa aln' to regenerate it.");
|
||||||
if(!bwtFiles.forwardSAFile.exists()) throw new StingException("Forward SA file is missing; please rerun 'bwa aln' to regenerate it.");
|
if(!bwtFiles.forwardSAFile.exists()) throw new GATKException("Forward SA file is missing; please rerun 'bwa aln' to regenerate it.");
|
||||||
if(!bwtFiles.reverseBWTFile.exists()) throw new StingException("Reverse BWT file is missing; please rerun 'bwa aln' to regenerate it.");
|
if(!bwtFiles.reverseBWTFile.exists()) throw new GATKException("Reverse BWT file is missing; please rerun 'bwa aln' to regenerate it.");
|
||||||
if(!bwtFiles.reverseSAFile.exists()) throw new StingException("Reverse SA file is missing; please rerun 'bwa aln' to regenerate it.");
|
if(!bwtFiles.reverseSAFile.exists()) throw new GATKException("Reverse SA file is missing; please rerun 'bwa aln' to regenerate it.");
|
||||||
|
|
||||||
thunkPointer = create(bwtFiles,configuration);
|
thunkPointer = create(bwtFiles,configuration);
|
||||||
}
|
}
|
||||||
|
|
@ -60,7 +61,7 @@ public class BWACAligner extends BWAAligner {
|
||||||
@Override
|
@Override
|
||||||
public void updateConfiguration(BWAConfiguration configuration) {
|
public void updateConfiguration(BWAConfiguration configuration) {
|
||||||
if(thunkPointer != 0)
|
if(thunkPointer != 0)
|
||||||
throw new StingException("BWA/C: attempting to update configuration of uninitialized aligner.");
|
throw new GATKException("BWA/C: attempting to update configuration of uninitialized aligner.");
|
||||||
updateConfiguration(thunkPointer,configuration);
|
updateConfiguration(thunkPointer,configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -70,7 +71,7 @@ public class BWACAligner extends BWAAligner {
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
if(thunkPointer == 0)
|
if(thunkPointer == 0)
|
||||||
throw new StingException("BWA/C close attempted, but BWA/C is not properly initialized.");
|
throw new GATKException("BWA/C close attempted, but BWA/C is not properly initialized.");
|
||||||
destroy(thunkPointer);
|
destroy(thunkPointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -82,7 +83,7 @@ public class BWACAligner extends BWAAligner {
|
||||||
@Override
|
@Override
|
||||||
public Alignment getBestAlignment(final byte[] bases) {
|
public Alignment getBestAlignment(final byte[] bases) {
|
||||||
if(thunkPointer == 0)
|
if(thunkPointer == 0)
|
||||||
throw new StingException("BWA/C getBestAlignment attempted, but BWA/C is not properly initialized.");
|
throw new GATKException("BWA/C getBestAlignment attempted, but BWA/C is not properly initialized.");
|
||||||
return getBestAlignment(thunkPointer,bases);
|
return getBestAlignment(thunkPointer,bases);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -193,7 +194,7 @@ public class BWACAligner extends BWAAligner {
|
||||||
*/
|
*/
|
||||||
public BWAPath[] getPaths(byte[] bases) {
|
public BWAPath[] getPaths(byte[] bases) {
|
||||||
if(thunkPointer == 0)
|
if(thunkPointer == 0)
|
||||||
throw new StingException("BWA/C getPaths attempted, but BWA/C is not properly initialized.");
|
throw new GATKException("BWA/C getPaths attempted, but BWA/C is not properly initialized.");
|
||||||
return getPaths(thunkPointer,bases);
|
return getPaths(thunkPointer,bases);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -226,7 +227,7 @@ public class BWACAligner extends BWAAligner {
|
||||||
*/
|
*/
|
||||||
protected Alignment[] convertPathsToAlignments(byte[] bases, BWAPath[] paths) {
|
protected Alignment[] convertPathsToAlignments(byte[] bases, BWAPath[] paths) {
|
||||||
if(thunkPointer == 0)
|
if(thunkPointer == 0)
|
||||||
throw new StingException("BWA/C convertPathsToAlignments attempted, but BWA/C is not properly initialized.");
|
throw new GATKException("BWA/C convertPathsToAlignments attempted, but BWA/C is not properly initialized.");
|
||||||
return convertPathsToAlignments(thunkPointer,bases,paths);
|
return convertPathsToAlignments(thunkPointer,bases,paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package org.broadinstitute.sting.alignment.bwa.java;
|
||||||
|
|
||||||
import org.broadinstitute.sting.alignment.Aligner;
|
import org.broadinstitute.sting.alignment.Aligner;
|
||||||
import org.broadinstitute.sting.alignment.Alignment;
|
import org.broadinstitute.sting.alignment.Alignment;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.utils.BaseUtils;
|
import org.broadinstitute.sting.utils.BaseUtils;
|
||||||
|
|
||||||
|
|
@ -61,7 +62,7 @@ public class AlignerTestHarness {
|
||||||
alignmentCleaned = (SAMRecord)read.clone();
|
alignmentCleaned = (SAMRecord)read.clone();
|
||||||
}
|
}
|
||||||
catch( CloneNotSupportedException ex ) {
|
catch( CloneNotSupportedException ex ) {
|
||||||
throw new StingException("SAMRecord clone not supported", ex);
|
throw new GATKException("SAMRecord clone not supported", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( alignmentCleaned.getReadNegativeStrandFlag() )
|
if( alignmentCleaned.getReadNegativeStrandFlag() )
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package org.broadinstitute.sting.alignment.bwa.java;
|
package org.broadinstitute.sting.alignment.bwa.java;
|
||||||
|
|
||||||
import org.broadinstitute.sting.alignment.bwa.java.AlignmentState;
|
import org.broadinstitute.sting.alignment.bwa.java.AlignmentState;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
import java.util.Deque;
|
import java.util.Deque;
|
||||||
|
|
@ -33,7 +34,7 @@ public class AlignmentMatchSequence implements Cloneable {
|
||||||
copy = (AlignmentMatchSequence)super.clone();
|
copy = (AlignmentMatchSequence)super.clone();
|
||||||
}
|
}
|
||||||
catch( CloneNotSupportedException ex ) {
|
catch( CloneNotSupportedException ex ) {
|
||||||
throw new StingException("Unable to clone AlignmentMatchSequence.");
|
throw new GATKException("Unable to clone AlignmentMatchSequence.");
|
||||||
}
|
}
|
||||||
|
|
||||||
copy.entries = new ArrayDeque<AlignmentMatchSequenceEntry>();
|
copy.entries = new ArrayDeque<AlignmentMatchSequenceEntry>();
|
||||||
|
|
@ -53,7 +54,7 @@ public class AlignmentMatchSequence implements Cloneable {
|
||||||
case MATCH_MISMATCH: operator = CigarOperator.MATCH_OR_MISMATCH; break;
|
case MATCH_MISMATCH: operator = CigarOperator.MATCH_OR_MISMATCH; break;
|
||||||
case INSERTION: operator = CigarOperator.INSERTION; break;
|
case INSERTION: operator = CigarOperator.INSERTION; break;
|
||||||
case DELETION: operator = CigarOperator.DELETION; break;
|
case DELETION: operator = CigarOperator.DELETION; break;
|
||||||
default: throw new StingException("convertToCigar: cannot process state: " + entry.getAlignmentState());
|
default: throw new GATKException("convertToCigar: cannot process state: " + entry.getAlignmentState());
|
||||||
}
|
}
|
||||||
cigar.add( new CigarElement(entry.count,operator) );
|
cigar.add( new CigarElement(entry.count,operator) );
|
||||||
}
|
}
|
||||||
|
|
@ -129,7 +130,7 @@ public class AlignmentMatchSequence implements Cloneable {
|
||||||
return (AlignmentMatchSequenceEntry)super.clone();
|
return (AlignmentMatchSequenceEntry)super.clone();
|
||||||
}
|
}
|
||||||
catch( CloneNotSupportedException ex ) {
|
catch( CloneNotSupportedException ex ) {
|
||||||
throw new StingException("Unable to clone AlignmentMatchSequenceEntry.");
|
throw new GATKException("Unable to clone AlignmentMatchSequenceEntry.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import org.broadinstitute.sting.alignment.Alignment;
|
||||||
import org.broadinstitute.sting.alignment.bwa.java.BWAJavaAligner;
|
import org.broadinstitute.sting.alignment.bwa.java.BWAJavaAligner;
|
||||||
import org.broadinstitute.sting.alignment.bwa.java.AlignmentMatchSequence;
|
import org.broadinstitute.sting.alignment.bwa.java.AlignmentMatchSequence;
|
||||||
import org.broadinstitute.sting.alignment.bwa.java.AlignmentState;
|
import org.broadinstitute.sting.alignment.bwa.java.AlignmentState;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import net.sf.samtools.Cigar;
|
import net.sf.samtools.Cigar;
|
||||||
|
|
||||||
|
|
@ -151,7 +152,7 @@ public class BWAAlignment extends Alignment implements Cloneable {
|
||||||
newAlignment = (BWAAlignment)super.clone();
|
newAlignment = (BWAAlignment)super.clone();
|
||||||
}
|
}
|
||||||
catch( CloneNotSupportedException ex ) {
|
catch( CloneNotSupportedException ex ) {
|
||||||
throw new StingException("Unable to clone BWAAlignment.");
|
throw new GATKException("Unable to clone BWAAlignment.");
|
||||||
}
|
}
|
||||||
newAlignment.creationNumber = numCreated++;
|
newAlignment.creationNumber = numCreated++;
|
||||||
newAlignment.alignmentMatchSequence = alignmentMatchSequence.clone();
|
newAlignment.alignmentMatchSequence = alignmentMatchSequence.clone();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package org.broadinstitute.sting.alignment.reference.bwt;
|
package org.broadinstitute.sting.alignment.reference.bwt;
|
||||||
|
|
||||||
import org.broadinstitute.sting.alignment.reference.packing.PackUtils;
|
import org.broadinstitute.sting.alignment.reference.packing.PackUtils;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -124,7 +125,7 @@ public class BWT {
|
||||||
*/
|
*/
|
||||||
protected byte getBase(long index) {
|
protected byte getBase(long index) {
|
||||||
if(index == inverseSA0)
|
if(index == inverseSA0)
|
||||||
throw new StingException(String.format("Base at index %d does not have a text representation",index));
|
throw new GATKException(String.format("Base at index %d does not have a text representation",index));
|
||||||
|
|
||||||
SequenceBlock block = getSequenceBlock(index);
|
SequenceBlock block = getSequenceBlock(index);
|
||||||
int position = getSequencePosition(index);
|
int position = getSequencePosition(index);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.broadinstitute.sting.alignment.reference.bwt;
|
package org.broadinstitute.sting.alignment.reference.bwt;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.alignment.reference.packing.UnsignedIntPackedInputStream;
|
import org.broadinstitute.sting.alignment.reference.packing.UnsignedIntPackedInputStream;
|
||||||
import org.broadinstitute.sting.alignment.reference.packing.BasePackedInputStream;
|
import org.broadinstitute.sting.alignment.reference.packing.BasePackedInputStream;
|
||||||
|
|
@ -28,7 +29,7 @@ public class BWTReader {
|
||||||
this.inputStream = new FileInputStream(inputFile);
|
this.inputStream = new FileInputStream(inputFile);
|
||||||
}
|
}
|
||||||
catch( FileNotFoundException ex ) {
|
catch( FileNotFoundException ex ) {
|
||||||
throw new StingException("Unable to open input file", ex);
|
throw new GATKException("Unable to open input file", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -80,7 +81,7 @@ public class BWTReader {
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
}
|
}
|
||||||
catch( IOException ex ) {
|
catch( IOException ex ) {
|
||||||
throw new StingException("Unable to close input file", ex);
|
throw new GATKException("Unable to close input file", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.broadinstitute.sting.alignment.reference.bwt;
|
package org.broadinstitute.sting.alignment.reference.bwt;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.alignment.reference.packing.UnsignedIntPackedOutputStream;
|
import org.broadinstitute.sting.alignment.reference.packing.UnsignedIntPackedOutputStream;
|
||||||
import org.broadinstitute.sting.alignment.reference.packing.BasePackedOutputStream;
|
import org.broadinstitute.sting.alignment.reference.packing.BasePackedOutputStream;
|
||||||
|
|
@ -28,7 +29,7 @@ public class BWTWriter {
|
||||||
this.outputStream = new BufferedOutputStream(new FileOutputStream(outputFile));
|
this.outputStream = new BufferedOutputStream(new FileOutputStream(outputFile));
|
||||||
}
|
}
|
||||||
catch( FileNotFoundException ex ) {
|
catch( FileNotFoundException ex ) {
|
||||||
throw new StingException("Unable to open output file", ex);
|
throw new GATKException("Unable to open output file", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -53,7 +54,7 @@ public class BWTWriter {
|
||||||
intPackedOutputStream.write(bwt.counts.toArray(false));
|
intPackedOutputStream.write(bwt.counts.toArray(false));
|
||||||
}
|
}
|
||||||
catch( IOException ex ) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -65,7 +66,7 @@ public class BWTWriter {
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
}
|
}
|
||||||
catch( IOException ex ) {
|
catch( IOException ex ) {
|
||||||
throw new StingException("Unable to close input file", ex);
|
throw new GATKException("Unable to close input file", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.broadinstitute.sting.alignment.reference.bwt;
|
package org.broadinstitute.sting.alignment.reference.bwt;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -87,7 +88,7 @@ public class Bases implements Iterable<Byte>
|
||||||
if( entry.getValue().equals(ascii) )
|
if( entry.getValue().equals(ascii) )
|
||||||
return entry.getKey();
|
return entry.getKey();
|
||||||
}
|
}
|
||||||
throw new StingException(String.format("Base %c is an invalid base to pack", (char)ascii));
|
throw new GATKException(String.format("Base %c is an invalid base to pack", (char)ascii));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.broadinstitute.sting.alignment.reference.bwt;
|
package org.broadinstitute.sting.alignment.reference.bwt;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
@ -96,7 +97,7 @@ public class Counts implements Cloneable {
|
||||||
other = (Counts)super.clone();
|
other = (Counts)super.clone();
|
||||||
}
|
}
|
||||||
catch(CloneNotSupportedException ex) {
|
catch(CloneNotSupportedException ex) {
|
||||||
throw new StingException("Unable to clone counts object", ex);
|
throw new GATKException("Unable to clone counts object", ex);
|
||||||
}
|
}
|
||||||
other.counts = new HashMap<Byte,Long>(counts);
|
other.counts = new HashMap<Byte,Long>(counts);
|
||||||
other.cumulativeCounts = new HashMap<Byte,Long>(cumulativeCounts);
|
other.cumulativeCounts = new HashMap<Byte,Long>(cumulativeCounts);
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ import net.sf.picard.reference.ReferenceSequence;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.alignment.reference.packing.PackUtils;
|
import org.broadinstitute.sting.alignment.reference.packing.PackUtils;
|
||||||
|
|
||||||
|
|
@ -182,7 +183,7 @@ public class CreateBWTFromReference {
|
||||||
|
|
||||||
for( int i = 0; i < bwt.length(); i++ ) {
|
for( int i = 0; i < bwt.length(); i++ ) {
|
||||||
if( bwtSequence[i] != existingBWTSequence[i] )
|
if( bwtSequence[i] != existingBWTSequence[i] )
|
||||||
throw new StingException("BWT mismatch at " + i);
|
throw new GATKException("BWT mismatch at " + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
File existingSAFile = new File(inputFileName+".sa");
|
File existingSAFile = new File(inputFileName+".sa");
|
||||||
|
|
@ -193,7 +194,7 @@ public class CreateBWTFromReference {
|
||||||
if( i % 10000 == 0 )
|
if( i % 10000 == 0 )
|
||||||
System.out.printf("Validating suffix array entry %d%n", i);
|
System.out.printf("Validating suffix array entry %d%n", i);
|
||||||
if( suffixArray.get(i) != existingSuffixArray.get(i) )
|
if( suffixArray.get(i) != existingSuffixArray.get(i) )
|
||||||
throw new StingException(String.format("Suffix array mismatch at %d; SA is %d; should be %d",i,existingSuffixArray.get(i),suffixArray.get(i)));
|
throw new GATKException(String.format("Suffix array mismatch at %d; SA is %d; should be %d",i,existingSuffixArray.get(i),suffixArray.get(i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.broadinstitute.sting.alignment.reference.bwt;
|
package org.broadinstitute.sting.alignment.reference.bwt;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
@ -53,7 +54,7 @@ public class SuffixArray {
|
||||||
this.bwt = bwt;
|
this.bwt = bwt;
|
||||||
|
|
||||||
if(sequenceInterval != 1 && bwt == null)
|
if(sequenceInterval != 1 && bwt == null)
|
||||||
throw new StingException("A BWT must be provided if the sequence interval is not 1");
|
throw new GATKException("A BWT must be provided if the sequence interval is not 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -118,7 +119,7 @@ public class SuffixArray {
|
||||||
inverseSA0 = i;
|
inverseSA0 = i;
|
||||||
}
|
}
|
||||||
if(inverseSA0 < 0)
|
if(inverseSA0 < 0)
|
||||||
throw new StingException("Unable to find first inverse SA entry in generated suffix array.");
|
throw new GATKException("Unable to find first inverse SA entry in generated suffix array.");
|
||||||
|
|
||||||
return new SuffixArray(inverseSA0,occurrences,suffixArray);
|
return new SuffixArray(inverseSA0,occurrences,suffixArray);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.broadinstitute.sting.alignment.reference.bwt;
|
package org.broadinstitute.sting.alignment.reference.bwt;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.alignment.reference.packing.UnsignedIntPackedInputStream;
|
import org.broadinstitute.sting.alignment.reference.packing.UnsignedIntPackedInputStream;
|
||||||
import org.broadinstitute.sting.alignment.reference.packing.PackUtils;
|
import org.broadinstitute.sting.alignment.reference.packing.PackUtils;
|
||||||
|
|
@ -35,7 +36,7 @@ public class SuffixArrayReader {
|
||||||
this.bwt = bwt;
|
this.bwt = bwt;
|
||||||
}
|
}
|
||||||
catch( FileNotFoundException ex ) {
|
catch( FileNotFoundException ex ) {
|
||||||
throw new StingException("Unable to open input file", ex);
|
throw new GATKException("Unable to open input file", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -61,7 +62,7 @@ public class SuffixArrayReader {
|
||||||
uintPackedInputStream.read(suffixArray);
|
uintPackedInputStream.read(suffixArray);
|
||||||
}
|
}
|
||||||
catch( IOException ex ) {
|
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 SuffixArray(inverseSA0, new Counts(occurrences,true), suffixArray, suffixArrayInterval, bwt);
|
return new SuffixArray(inverseSA0, new Counts(occurrences,true), suffixArray, suffixArrayInterval, bwt);
|
||||||
|
|
@ -76,7 +77,7 @@ public class SuffixArrayReader {
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
}
|
}
|
||||||
catch( IOException ex ) {
|
catch( IOException ex ) {
|
||||||
throw new StingException("Unable to close input file", ex);
|
throw new GATKException("Unable to close input file", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.broadinstitute.sting.alignment.reference.bwt;
|
package org.broadinstitute.sting.alignment.reference.bwt;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.alignment.reference.packing.UnsignedIntPackedOutputStream;
|
import org.broadinstitute.sting.alignment.reference.packing.UnsignedIntPackedOutputStream;
|
||||||
|
|
||||||
|
|
@ -27,7 +28,7 @@ public class SuffixArrayWriter {
|
||||||
this.outputStream = new BufferedOutputStream(new FileOutputStream(outputFile));
|
this.outputStream = new BufferedOutputStream(new FileOutputStream(outputFile));
|
||||||
}
|
}
|
||||||
catch( FileNotFoundException ex ) {
|
catch( FileNotFoundException ex ) {
|
||||||
throw new StingException("Unable to open input file", ex);
|
throw new GATKException("Unable to open input file", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -48,7 +49,7 @@ public class SuffixArrayWriter {
|
||||||
uintPackedOutputStream.write(suffixArray.sequence,1,suffixArray.sequence.length-1);
|
uintPackedOutputStream.write(suffixArray.sequence,1,suffixArray.sequence.length-1);
|
||||||
}
|
}
|
||||||
catch( IOException ex ) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -61,7 +62,7 @@ public class SuffixArrayWriter {
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
}
|
}
|
||||||
catch( IOException ex ) {
|
catch( IOException ex ) {
|
||||||
throw new StingException("Unable to close input file", ex);
|
throw new GATKException("Unable to close input file", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.broadinstitute.sting.alignment.reference.packing;
|
package org.broadinstitute.sting.alignment.reference.packing;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
@ -51,7 +52,7 @@ public class BasePackedInputStream<T> {
|
||||||
|
|
||||||
public BasePackedInputStream( Class<T> type, FileInputStream inputStream, ByteOrder byteOrder ) {
|
public BasePackedInputStream( Class<T> type, FileInputStream inputStream, ByteOrder byteOrder ) {
|
||||||
if( type != Integer.class )
|
if( type != Integer.class )
|
||||||
throw new StingException("Only bases packed into 32-bit words are currently supported by this input stream. Type specified: " + type.getName());
|
throw new GATKException("Only bases packed into 32-bit words are currently supported by this input stream. Type specified: " + type.getName());
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.targetInputStream = inputStream;
|
this.targetInputStream = inputStream;
|
||||||
this.targetInputChannel = inputStream.getChannel();
|
this.targetInputChannel = inputStream.getChannel();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.broadinstitute.sting.alignment.reference.packing;
|
package org.broadinstitute.sting.alignment.reference.packing;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
@ -134,7 +135,7 @@ public class BasePackedOutputStream<T> {
|
||||||
else if( type == Byte.class )
|
else if( type == Byte.class )
|
||||||
buffer.put((byte)packedBases);
|
buffer.put((byte)packedBases);
|
||||||
else
|
else
|
||||||
throw new StingException("Cannot pack bases into type " + type.getName());
|
throw new GATKException("Cannot pack bases into type " + type.getName());
|
||||||
targetOutputStream.write(buffer.array());
|
targetOutputStream.write(buffer.array());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.broadinstitute.sting.alignment.reference.packing;
|
package org.broadinstitute.sting.alignment.reference.packing;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
@ -58,14 +59,14 @@ public class PackUtils {
|
||||||
long typeSize = type.getField("MAX_VALUE").getLong(null) - type.getField("MIN_VALUE").getLong(null)+1;
|
long typeSize = type.getField("MAX_VALUE").getLong(null) - type.getField("MIN_VALUE").getLong(null)+1;
|
||||||
long intTypeSize = (long)Integer.MAX_VALUE - (long)Integer.MIN_VALUE + 1;
|
long intTypeSize = (long)Integer.MAX_VALUE - (long)Integer.MIN_VALUE + 1;
|
||||||
if( typeSize > intTypeSize )
|
if( typeSize > intTypeSize )
|
||||||
throw new StingException("Cannot determine number of bits available in type: " + type.getName());
|
throw new GATKException("Cannot determine number of bits available in type: " + type.getName());
|
||||||
return (int)(Math.log(typeSize)/Math.log(2));
|
return (int)(Math.log(typeSize)/Math.log(2));
|
||||||
}
|
}
|
||||||
catch( NoSuchFieldException ex ) {
|
catch( NoSuchFieldException ex ) {
|
||||||
throw new StingException("Cannot determine number of bits available in type: " + type.getName(),ex);
|
throw new GATKException("Cannot determine number of bits available in type: " + type.getName(),ex);
|
||||||
}
|
}
|
||||||
catch( IllegalAccessException ex ) {
|
catch( IllegalAccessException ex ) {
|
||||||
throw new StingException("Cannot determine number of bits available in type: " + type.getName(),ex);
|
throw new GATKException("Cannot determine number of bits available in type: " + type.getName(),ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -85,7 +86,7 @@ public class PackUtils {
|
||||||
case 'T':
|
case 'T':
|
||||||
return 3;
|
return 3;
|
||||||
default:
|
default:
|
||||||
throw new StingException("Unknown base type: " + base);
|
throw new GATKException("Unknown base type: " + base);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -105,7 +106,7 @@ public class PackUtils {
|
||||||
case 3:
|
case 3:
|
||||||
return 'T';
|
return 'T';
|
||||||
default:
|
default:
|
||||||
throw new StingException("Unknown pack type: " + pack);
|
throw new GATKException("Unknown pack type: " + pack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.commandline;
|
package org.broadinstitute.sting.commandline;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -69,7 +70,7 @@ public class ArgumentDefinitionGroup implements Iterable<ArgumentDefinition> {
|
||||||
*/
|
*/
|
||||||
public ArgumentDefinitionGroup merge( ArgumentDefinitionGroup other ) {
|
public ArgumentDefinitionGroup merge( ArgumentDefinitionGroup other ) {
|
||||||
if( !groupNameMatches(other) )
|
if( !groupNameMatches(other) )
|
||||||
throw new StingException("Unable to merge two argument groups with differing names.");
|
throw new GATKException("Unable to merge two argument groups with differing names.");
|
||||||
|
|
||||||
// Create a merged definition group.
|
// Create a merged definition group.
|
||||||
List<ArgumentDefinition> mergedDefinitions = new ArrayList<ArgumentDefinition>();
|
List<ArgumentDefinition> mergedDefinitions = new ArrayList<ArgumentDefinition>();
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.commandline;
|
package org.broadinstitute.sting.commandline;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
@ -56,9 +57,9 @@ public class ArgumentDefinitions implements Iterable<ArgumentDefinition> {
|
||||||
if( definition.fullName.length() == 0 )
|
if( definition.fullName.length() == 0 )
|
||||||
throw new IllegalArgumentException( "Argument cannot have 0-length fullname." );
|
throw new IllegalArgumentException( "Argument cannot have 0-length fullname." );
|
||||||
if( hasArgumentDefinition( definition.fullName, FullNameDefinitionMatcher ) )
|
if( hasArgumentDefinition( definition.fullName, FullNameDefinitionMatcher ) )
|
||||||
throw new StingException("Duplicate definition of argument with full name: " + definition.fullName);
|
throw new GATKException("Duplicate definition of argument with full name: " + definition.fullName);
|
||||||
if( definition.shortName != null && hasArgumentDefinition( definition.shortName, ShortNameDefinitionMatcher ) )
|
if( definition.shortName != null && hasArgumentDefinition( definition.shortName, ShortNameDefinitionMatcher ) )
|
||||||
throw new StingException("Duplicate definition of argument with short name: " + definition.shortName);
|
throw new GATKException("Duplicate definition of argument with short name: " + definition.shortName);
|
||||||
|
|
||||||
argumentDefinitions.add( definition );
|
argumentDefinitions.add( definition );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.commandline;
|
package org.broadinstitute.sting.commandline;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
|
|
@ -46,6 +47,6 @@ public enum ArgumentIOType {
|
||||||
for (ArgumentIOType ioType: ArgumentIOType.values())
|
for (ArgumentIOType ioType: ArgumentIOType.values())
|
||||||
if (ioType.annotationClass.isAssignableFrom(annotation.getClass()))
|
if (ioType.annotationClass.isAssignableFrom(annotation.getClass()))
|
||||||
return ioType;
|
return ioType;
|
||||||
throw new StingException("Unknown annotation type: " + annotation);
|
throw new GATKException("Unknown annotation type: " + annotation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.commandline;
|
package org.broadinstitute.sting.commandline;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
@ -209,7 +210,7 @@ public class ArgumentSource {
|
||||||
*/
|
*/
|
||||||
public MultiplexArgumentTypeDescriptor createDependentTypeDescriptor(Object containingObject) {
|
public MultiplexArgumentTypeDescriptor createDependentTypeDescriptor(Object containingObject) {
|
||||||
if(!isDependent())
|
if(!isDependent())
|
||||||
throw new StingException("Field " + field.getName() + " is independent; no dependent type descriptor can be derived.");
|
throw new GATKException("Field " + field.getName() + " is independent; no dependent type descriptor can be derived.");
|
||||||
return ((MultiplexArgumentTypeDescriptor)typeDescriptor).createCustomTypeDescriptor(this,containingObject);
|
return ((MultiplexArgumentTypeDescriptor)typeDescriptor).createCustomTypeDescriptor(this,containingObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,13 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.commandline;
|
package org.broadinstitute.sting.commandline;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.utils.classloader.JVMUtils;
|
import org.broadinstitute.sting.utils.classloader.JVMUtils;
|
||||||
import org.broadinstitute.sting.gatk.walkers.Multiplex;
|
import org.broadinstitute.sting.gatk.walkers.Multiplex;
|
||||||
import org.broadinstitute.sting.gatk.walkers.Multiplexer;
|
import org.broadinstitute.sting.gatk.walkers.Multiplexer;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.*;
|
import java.lang.reflect.*;
|
||||||
|
|
@ -81,7 +83,7 @@ public abstract class ArgumentTypeDescriptor {
|
||||||
if( descriptor.supports(type) )
|
if( descriptor.supports(type) )
|
||||||
return descriptor;
|
return descriptor;
|
||||||
}
|
}
|
||||||
throw new StingException("Can't process command-line arguments of type: " + type.getName());
|
throw new GATKException("Can't process command-line arguments of type: " + type.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -219,7 +221,7 @@ public abstract class ArgumentTypeDescriptor {
|
||||||
protected String getArgumentValue( ArgumentDefinition definition, ArgumentMatches matches ) {
|
protected String getArgumentValue( ArgumentDefinition definition, ArgumentMatches matches ) {
|
||||||
Collection<String> argumentValues = getArgumentValues( definition, matches );
|
Collection<String> argumentValues = getArgumentValues( definition, matches );
|
||||||
if( argumentValues.size() > 1 )
|
if( argumentValues.size() > 1 )
|
||||||
throw new StingException("Multiple values associated with given definition, but this argument expects only one: " + definition.fullName);
|
throw new UserError.CommandLineError("Multiple values associated with given definition, but this argument expects only one: " + definition.fullName);
|
||||||
return argumentValues.size() > 0 ? argumentValues.iterator().next() : null;
|
return argumentValues.size() > 0 ? argumentValues.iterator().next() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -263,7 +265,7 @@ public abstract class ArgumentTypeDescriptor {
|
||||||
for (Class annotation: ARGUMENT_ANNOTATIONS)
|
for (Class annotation: ARGUMENT_ANNOTATIONS)
|
||||||
if (source.field.isAnnotationPresent(annotation))
|
if (source.field.isAnnotationPresent(annotation))
|
||||||
return source.field.getAnnotation(annotation);
|
return source.field.getAnnotation(annotation);
|
||||||
throw new StingException("ArgumentAnnotation is not present for the argument field: " + source.field.getName());
|
throw new GATKException("ArgumentAnnotation is not present for the argument field: " + source.field.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -331,7 +333,7 @@ class SimpleArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
for (Object val : vals) {
|
for (Object val : vals) {
|
||||||
if (String.valueOf(val).equalsIgnoreCase(value)) return val;
|
if (String.valueOf(val).equalsIgnoreCase(value)) return val;
|
||||||
try { if (type.getField(val.toString()).isAnnotationPresent(EnumerationArgumentDefault.class)) defaultEnumeration = val; }
|
try { if (type.getField(val.toString()).isAnnotationPresent(EnumerationArgumentDefault.class)) defaultEnumeration = val; }
|
||||||
catch (NoSuchFieldException e) { throw new StingException("parsing " + type.toString() + "doesn't contain the field " + val.toString()); }
|
catch (NoSuchFieldException e) { throw new GATKException("parsing " + type.toString() + "doesn't contain the field " + val.toString()); }
|
||||||
}
|
}
|
||||||
// if their argument has no value (null), and there's a default, return that default for the enum value
|
// if their argument has no value (null), and there's a default, return that default for the enum value
|
||||||
if (defaultEnumeration != null && value == null)
|
if (defaultEnumeration != null && value == null)
|
||||||
|
|
@ -348,13 +350,13 @@ class SimpleArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (NoSuchMethodException e) {
|
catch (NoSuchMethodException e) {
|
||||||
throw new StingException("constructFromString:NoSuchMethodException: Failed conversion " + e.getMessage());
|
throw new GATKException("constructFromString:NoSuchMethodException: Failed conversion " + e.getMessage());
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
throw new StingException("constructFromString:IllegalAccessException: Failed conversion " + e.getMessage());
|
throw new GATKException("constructFromString:IllegalAccessException: Failed conversion " + e.getMessage());
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
throw new StingException("constructFromString:InvocationTargetException: Failed conversion - this is most likely caused by using an incorrect data type (e.g. a double when an int is required)");
|
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) {
|
} catch (InstantiationException e) {
|
||||||
throw new StingException("constructFromString:InstantiationException: Failed conversion " + e.getMessage());
|
throw new GATKException("constructFromString:InstantiationException: Failed conversion " + e.getMessage());
|
||||||
}
|
}
|
||||||
// WARNING: Side effect!
|
// WARNING: Side effect!
|
||||||
parsingEngine.addTags(result,tags);
|
parsingEngine.addTags(result,tags);
|
||||||
|
|
@ -417,11 +419,11 @@ class CompoundArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
}
|
}
|
||||||
catch (InstantiationException e) {
|
catch (InstantiationException e) {
|
||||||
logger.fatal("ArgumentParser: InstantiationException: cannot convert field " + source.field.getName());
|
logger.fatal("ArgumentParser: InstantiationException: cannot convert field " + source.field.getName());
|
||||||
throw new StingException("constructFromString:InstantiationException: Failed conversion " + e.getMessage());
|
throw new GATKException("constructFromString:InstantiationException: Failed conversion " + e.getMessage());
|
||||||
}
|
}
|
||||||
catch (IllegalAccessException e) {
|
catch (IllegalAccessException e) {
|
||||||
logger.fatal("ArgumentParser: IllegalAccessException: cannot convert field " + source.field.getName());
|
logger.fatal("ArgumentParser: IllegalAccessException: cannot convert field " + source.field.getName());
|
||||||
throw new StingException("constructFromString:IllegalAccessException: Failed conversion " + e.getMessage());
|
throw new GATKException("constructFromString:IllegalAccessException: Failed conversion " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
for( ArgumentMatch match: matches ) {
|
for( ArgumentMatch match: matches ) {
|
||||||
|
|
@ -453,7 +455,7 @@ class CompoundArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw new StingException("Unsupported compound argument type: " + type);
|
throw new GATKException("Unsupported compound argument type: " + type);
|
||||||
|
|
||||||
// WARNING: Side effect!
|
// WARNING: Side effect!
|
||||||
parsingEngine.addTags(result,tags);
|
parsingEngine.addTags(result,tags);
|
||||||
|
|
@ -521,7 +523,7 @@ class MultiplexArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
@Override
|
@Override
|
||||||
public Object createTypeDefault(ArgumentSource source,Class type) {
|
public Object createTypeDefault(ArgumentSource source,Class type) {
|
||||||
if(multiplexer == null || multiplexedIds == null)
|
if(multiplexer == null || multiplexedIds == null)
|
||||||
throw new StingException("No multiplexed ids available");
|
throw new GATKException("No multiplexed ids available");
|
||||||
|
|
||||||
Map<Object,Object> multiplexedMapping = new HashMap<Object,Object>();
|
Map<Object,Object> multiplexedMapping = new HashMap<Object,Object>();
|
||||||
Class componentType = getCollectionComponentType(source.field);
|
Class componentType = getCollectionComponentType(source.field);
|
||||||
|
|
@ -540,7 +542,7 @@ class MultiplexArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
@Override
|
@Override
|
||||||
public Object parse(ParsingEngine parsingEngine, ArgumentSource source, Class type, ArgumentMatches matches) {
|
public Object parse(ParsingEngine parsingEngine, ArgumentSource source, Class type, ArgumentMatches matches) {
|
||||||
if(multiplexedIds == null)
|
if(multiplexedIds == null)
|
||||||
throw new StingException("Cannot directly parse a MultiplexArgumentTypeDescriptor; must create a derivative type descriptor first.");
|
throw new GATKException("Cannot directly parse a MultiplexArgumentTypeDescriptor; must create a derivative type descriptor first.");
|
||||||
|
|
||||||
Map<Object,Object> multiplexedMapping = new HashMap<Object,Object>();
|
Map<Object,Object> multiplexedMapping = new HashMap<Object,Object>();
|
||||||
|
|
||||||
|
|
@ -571,14 +573,14 @@ class MultiplexArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
if(!source.field.getName().equals(sourceField))
|
if(!source.field.getName().equals(sourceField))
|
||||||
continue;
|
continue;
|
||||||
if(source.field.isAnnotationPresent(Multiplex.class))
|
if(source.field.isAnnotationPresent(Multiplex.class))
|
||||||
throw new StingException("Command-line arguments can only depend on independent fields");
|
throw new GATKException("Command-line arguments can only depend on independent fields");
|
||||||
sourceTypes[currentField] = source.field.getType();
|
sourceTypes[currentField] = source.field.getType();
|
||||||
sourceValues[currentField] = JVMUtils.getFieldValue(source.field,containingObject);
|
sourceValues[currentField] = JVMUtils.getFieldValue(source.field,containingObject);
|
||||||
currentField++;
|
currentField++;
|
||||||
fieldFound = true;
|
fieldFound = true;
|
||||||
}
|
}
|
||||||
if(!fieldFound)
|
if(!fieldFound)
|
||||||
throw new StingException(String.format("Unable to find source field %s, referred to by dependent field %s",sourceField,dependentArgument.field.getName()));
|
throw new GATKException(String.format("Unable to find source field %s, referred to by dependent field %s",sourceField,dependentArgument.field.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Class<? extends Multiplexer> multiplexerType = dependentArgument.field.getAnnotation(Multiplex.class).value();
|
Class<? extends Multiplexer> multiplexerType = dependentArgument.field.getAnnotation(Multiplex.class).value();
|
||||||
|
|
@ -588,7 +590,7 @@ class MultiplexArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
multiplexerConstructor.setAccessible(true);
|
multiplexerConstructor.setAccessible(true);
|
||||||
}
|
}
|
||||||
catch(NoSuchMethodException ex) {
|
catch(NoSuchMethodException ex) {
|
||||||
throw new StingException(String.format("Unable to find constructor for class %s with parameters %s",multiplexerType.getName(),Arrays.deepToString(sourceFields)),ex);
|
throw new GATKException(String.format("Unable to find constructor for class %s with parameters %s",multiplexerType.getName(),Arrays.deepToString(sourceFields)),ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
Multiplexer multiplexer = null;
|
Multiplexer multiplexer = null;
|
||||||
|
|
@ -596,13 +598,13 @@ class MultiplexArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
multiplexer = multiplexerConstructor.newInstance(sourceValues);
|
multiplexer = multiplexerConstructor.newInstance(sourceValues);
|
||||||
}
|
}
|
||||||
catch(IllegalAccessException ex) {
|
catch(IllegalAccessException ex) {
|
||||||
throw new StingException(String.format("Constructor for class %s with parameters %s is inaccessible",multiplexerType.getName(),Arrays.deepToString(sourceFields)),ex);
|
throw new GATKException(String.format("Constructor for class %s with parameters %s is inaccessible",multiplexerType.getName(),Arrays.deepToString(sourceFields)),ex);
|
||||||
}
|
}
|
||||||
catch(InstantiationException ex) {
|
catch(InstantiationException ex) {
|
||||||
throw new StingException(String.format("Can't create class %s with parameters %s",multiplexerType.getName(),Arrays.deepToString(sourceFields)),ex);
|
throw new GATKException(String.format("Can't create class %s with parameters %s",multiplexerType.getName(),Arrays.deepToString(sourceFields)),ex);
|
||||||
}
|
}
|
||||||
catch(InvocationTargetException ex) {
|
catch(InvocationTargetException ex) {
|
||||||
throw new StingException(String.format("Can't invoke constructor of class %s with parameters %s",multiplexerType.getName(),Arrays.deepToString(sourceFields)),ex);
|
throw new GATKException(String.format("Can't invoke constructor of class %s with parameters %s",multiplexerType.getName(),Arrays.deepToString(sourceFields)),ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new MultiplexArgumentTypeDescriptor(multiplexer,multiplexer.multiplex());
|
return new MultiplexArgumentTypeDescriptor(multiplexer,multiplexer.multiplex());
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.commandline;
|
package org.broadinstitute.sting.commandline;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.classloader.JVMUtils;
|
import org.broadinstitute.sting.utils.classloader.JVMUtils;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||||
|
|
@ -124,7 +125,7 @@ public class CommandLineUtils {
|
||||||
try {
|
try {
|
||||||
return annotation.getClass().getMethod(method).invoke(annotation);
|
return annotation.getClass().getMethod(method).invoke(annotation);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new StingException("Unable to access method " + method + " on annotation " + annotation.getClass(), e);
|
throw new GATKException("Unable to access method " + method + " on annotation " + annotation.getClass(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,12 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.commandline;
|
package org.broadinstitute.sting.commandline;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.utils.collections.Pair;
|
import org.broadinstitute.sting.utils.collections.Pair;
|
||||||
import org.broadinstitute.sting.utils.classloader.JVMUtils;
|
import org.broadinstitute.sting.utils.classloader.JVMUtils;
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
import org.broadinstitute.sting.utils.Utils;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
import org.broadinstitute.sting.utils.help.ApplicationDetails;
|
import org.broadinstitute.sting.utils.help.ApplicationDetails;
|
||||||
import org.broadinstitute.sting.utils.help.HelpFormatter;
|
import org.broadinstitute.sting.utils.help.HelpFormatter;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
@ -293,9 +295,9 @@ public class ParsingEngine {
|
||||||
// Grab the first argument definition and report that one as the failure. Theoretically, we should notify of all failures.
|
// Grab the first argument definition and report that one as the failure. Theoretically, we should notify of all failures.
|
||||||
List<ArgumentDefinition> definitions = argumentSource.createArgumentDefinitions();
|
List<ArgumentDefinition> definitions = argumentSource.createArgumentDefinitions();
|
||||||
if(definitions.size() < 1)
|
if(definitions.size() < 1)
|
||||||
throw new StingException("Internal error. Argument source creates no definitions.");
|
throw new GATKException("Internal error. Argument source creates no definitions.");
|
||||||
ArgumentDefinition definition = definitions.get(0);
|
ArgumentDefinition definition = definitions.get(0);
|
||||||
throw new StingException(String.format("The parameter %s is deprecated. %s",definition.fullName,definition.doc));
|
throw new UserError.DeprecatedArgument(definition.fullName,definition.doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -314,7 +316,7 @@ public class ParsingEngine {
|
||||||
|
|
||||||
// Abort if no home is found for the object.
|
// Abort if no home is found for the object.
|
||||||
if( targets.size() == 0 )
|
if( targets.size() == 0 )
|
||||||
throw new StingException("Internal command-line parser error: unable to find a home for argument matches " + argumentMatches);
|
throw new GATKException("Internal command-line parser error: unable to find a home for argument matches " + argumentMatches);
|
||||||
|
|
||||||
for( Object target: targets ) {
|
for( Object target: targets ) {
|
||||||
Object value = (argumentMatches.size() != 0) ? source.parse(this,argumentMatches) : source.createDefault();
|
Object value = (argumentMatches.size() != 0) ? source.parse(this,argumentMatches) : source.createDefault();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package org.broadinstitute.sting.gatk;
|
package org.broadinstitute.sting.gatk;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes the method for downsampling reads at a given locus.
|
* Describes the method for downsampling reads at a given locus.
|
||||||
|
|
@ -35,15 +36,15 @@ public class DownsamplingMethod {
|
||||||
|
|
||||||
// Can't leave toFraction and toCoverage null unless type is experimental naive duplicate eliminator.
|
// Can't leave toFraction and toCoverage null unless type is experimental naive duplicate eliminator.
|
||||||
if(type != DownsampleType.NONE && toFraction == null && toCoverage == null)
|
if(type != DownsampleType.NONE && toFraction == null && toCoverage == null)
|
||||||
throw new StingException("Must specify either toFraction or toCoverage when downsampling.");
|
throw new UserError.CommandLineError("Must specify either toFraction or toCoverage when downsampling.");
|
||||||
|
|
||||||
// Fraction and coverage cannot both be specified.
|
// Fraction and coverage cannot both be specified.
|
||||||
if(toFraction != null && toCoverage != null)
|
if(toFraction != null && toCoverage != null)
|
||||||
throw new StingException("Downsampling coverage and fraction are both specified. Please choose only one.");
|
throw new UserError.CommandLineError("Downsampling coverage and fraction are both specified. Please choose only one.");
|
||||||
|
|
||||||
// Experimental by sample downsampling does not work with a fraction of reads.
|
// Experimental by sample downsampling does not work with a fraction of reads.
|
||||||
if(type == DownsampleType.BY_SAMPLE && toFraction != null)
|
if(type == DownsampleType.BY_SAMPLE && toFraction != null)
|
||||||
throw new StingException("Cannot downsample to fraction with new EXPERIMENTAL_BY_SAMPLE method");
|
throw new UserError.CommandLineError("Cannot downsample to fraction with new EXPERIMENTAL_BY_SAMPLE method");
|
||||||
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.toCoverage = toCoverage;
|
this.toCoverage = toCoverage;
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ import net.sf.samtools.*;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.broadinstitute.sting.gatk.arguments.GATKArgumentCollection;
|
import org.broadinstitute.sting.gatk.arguments.GATKArgumentCollection;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.helpers.DbSNPHelper;
|
import org.broadinstitute.sting.gatk.refdata.utils.helpers.DbSNPHelper;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
import org.broadinstitute.sting.utils.interval.IntervalMergingRule;
|
import org.broadinstitute.sting.utils.interval.IntervalMergingRule;
|
||||||
import org.broadinstitute.sting.utils.interval.IntervalUtils;
|
import org.broadinstitute.sting.utils.interval.IntervalUtils;
|
||||||
import org.broadinstitute.sting.gatk.arguments.ValidationExclusion;
|
import org.broadinstitute.sting.gatk.arguments.ValidationExclusion;
|
||||||
|
|
@ -42,7 +43,6 @@ import org.broadinstitute.sting.gatk.datasources.simpleDataSources.*;
|
||||||
import org.broadinstitute.sting.gatk.executive.MicroScheduler;
|
import org.broadinstitute.sting.gatk.executive.MicroScheduler;
|
||||||
import org.broadinstitute.sting.gatk.filters.FilterManager;
|
import org.broadinstitute.sting.gatk.filters.FilterManager;
|
||||||
import org.broadinstitute.sting.gatk.filters.ReadGroupBlackListFilter;
|
import org.broadinstitute.sting.gatk.filters.ReadGroupBlackListFilter;
|
||||||
import org.broadinstitute.sting.gatk.filters.ZeroMappingQualityReadFilter;
|
|
||||||
import org.broadinstitute.sting.gatk.io.OutputTracker;
|
import org.broadinstitute.sting.gatk.io.OutputTracker;
|
||||||
import org.broadinstitute.sting.gatk.io.stubs.*;
|
import org.broadinstitute.sting.gatk.io.stubs.*;
|
||||||
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrack;
|
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrack;
|
||||||
|
|
@ -155,12 +155,12 @@ public class GenomeAnalysisEngine {
|
||||||
|
|
||||||
// validate our parameters
|
// validate our parameters
|
||||||
if (args == null) {
|
if (args == null) {
|
||||||
throw new StingException("The GATKArgumentCollection passed to GenomeAnalysisEngine can not be null.");
|
throw new GATKException("The GATKArgumentCollection passed to GenomeAnalysisEngine can not be null.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// validate our parameters
|
// validate our parameters
|
||||||
if (my_walker == null)
|
if (my_walker == null)
|
||||||
throw new StingException("The walker passed to GenomeAnalysisEngine can not be null.");
|
throw new GATKException("The walker passed to GenomeAnalysisEngine can not be null.");
|
||||||
|
|
||||||
// save our argument parameter
|
// save our argument parameter
|
||||||
this.argCollection = args;
|
this.argCollection = args;
|
||||||
|
|
@ -267,7 +267,7 @@ public class GenomeAnalysisEngine {
|
||||||
|
|
||||||
// check to make sure we have a rod of that name
|
// check to make sure we have a rod of that name
|
||||||
if (!rodNames.containsKey(rodName))
|
if (!rodNames.containsKey(rodName))
|
||||||
throw new StingException("--rodToIntervalTrackName (-BTI) was pass the name '"+rodName+"', which wasn't given as a ROD name in the -B option");
|
throw new UserError.CommandLineError("--rodToIntervalTrackName (-BTI) was passed the name '"+rodName+"', which wasn't given as a ROD name in the -B option");
|
||||||
|
|
||||||
for (String str : rodNames.keySet())
|
for (String str : rodNames.keySet())
|
||||||
if (str.equals(rodName)) {
|
if (str.equals(rodName)) {
|
||||||
|
|
@ -400,7 +400,7 @@ public class GenomeAnalysisEngine {
|
||||||
// Temporarily require all walkers to have a reference, even if that reference is not conceptually necessary.
|
// Temporarily require all walkers to have a reference, even if that reference is not conceptually necessary.
|
||||||
if ((my_walker instanceof ReadWalker || my_walker instanceof DuplicateWalker || my_walker instanceof ReadPairWalker) &&
|
if ((my_walker instanceof ReadWalker || my_walker instanceof DuplicateWalker || my_walker instanceof ReadPairWalker) &&
|
||||||
argCollection.referenceFile == null) {
|
argCollection.referenceFile == null) {
|
||||||
Utils.scareUser(String.format("Read-based traversals require a reference file but none was given"));
|
throw new UserError.CommandLineError("Read-based traversals require a reference file but none was given");
|
||||||
}
|
}
|
||||||
|
|
||||||
return MicroScheduler.create(this,my_walker,readsDataSource,referenceDataSource.getReference(),rodDataSources,argCollection.numberOfThreads);
|
return MicroScheduler.create(this,my_walker,readsDataSource,referenceDataSource.getReference(),rodDataSources,argCollection.numberOfThreads);
|
||||||
|
|
@ -720,7 +720,7 @@ public class GenomeAnalysisEngine {
|
||||||
error.append(String.format(compareToName + " contigs: %s%n", prettyPrintSequenceRecords(comparedToDictionary)));
|
error.append(String.format(compareToName + " contigs: %s%n", prettyPrintSequenceRecords(comparedToDictionary)));
|
||||||
error.append(String.format("Reference contigs: %s%n", prettyPrintSequenceRecords(referenceDictionary)));
|
error.append(String.format("Reference contigs: %s%n", prettyPrintSequenceRecords(referenceDictionary)));
|
||||||
logger.error(error.toString());
|
logger.error(error.toString());
|
||||||
Utils.scareUser("No overlap exists between sequence dictionary of " + compareToName + " and the sequence dictionary of the reference.");
|
throw new UserError.IncompatibleSequenceDictionaries(referenceDictionary, comparedToDictionary, compareToName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the two datasets are not equal and neither is a strict subset of the other, warn the user.
|
// If the two datasets are not equal and neither is a strict subset of the other, warn the user.
|
||||||
|
|
@ -773,20 +773,20 @@ public class GenomeAnalysisEngine {
|
||||||
// sharding system; it's required with the new sharding system only for locus walkers.
|
// sharding system; it's required with the new sharding system only for locus walkers.
|
||||||
if(readsDataSource != null && !readsDataSource.hasIndex() ) {
|
if(readsDataSource != null && !readsDataSource.hasIndex() ) {
|
||||||
if(!exclusions.contains(ValidationExclusion.TYPE.ALLOW_UNINDEXED_BAM))
|
if(!exclusions.contains(ValidationExclusion.TYPE.ALLOW_UNINDEXED_BAM))
|
||||||
throw new StingException("The GATK cannot currently process unindexed BAM files without the -U ALLOW_UNINDEXED_BAM");
|
throw new UserError.CommandLineError("The GATK cannot currently process unindexed BAM files without the -U ALLOW_UNINDEXED_BAM");
|
||||||
if(intervals != null && WalkerManager.getWalkerDataSource(walker) != DataSource.REFERENCE)
|
if(intervals != null && WalkerManager.getWalkerDataSource(walker) != DataSource.REFERENCE)
|
||||||
throw new StingException("Cannot shard input by interval when walker is not driven by reference.");
|
throw new UserError.CommandLineError("Cannot perform interval processing when walker is not driven by reference and no index is available.");
|
||||||
|
|
||||||
Shard.ShardType shardType;
|
Shard.ShardType shardType;
|
||||||
if(walker instanceof LocusWalker) {
|
if(walker instanceof LocusWalker) {
|
||||||
if (readsDataSource.getSortOrder() != SAMFileHeader.SortOrder.coordinate)
|
if (readsDataSource.getSortOrder() != SAMFileHeader.SortOrder.coordinate)
|
||||||
Utils.scareUser("Locus walkers can only walk over coordinate-sorted data. Please resort your input BAM file.");
|
throw new UserError.MissortedBAM(SAMFileHeader.SortOrder.coordinate, "Locus walkers can only walk over coordinate-sorted data. Please resort your input BAM file(s).");
|
||||||
shardType = Shard.ShardType.LOCUS;
|
shardType = Shard.ShardType.LOCUS;
|
||||||
}
|
}
|
||||||
else if(walker instanceof ReadWalker || walker instanceof DuplicateWalker || walker instanceof ReadPairWalker)
|
else if(walker instanceof ReadWalker || walker instanceof DuplicateWalker || walker instanceof ReadPairWalker)
|
||||||
shardType = Shard.ShardType.READ;
|
shardType = Shard.ShardType.READ;
|
||||||
else
|
else
|
||||||
throw new StingException("The GATK cannot currently process unindexed BAM files");
|
throw new UserError.CommandLineError("The GATK cannot currently process unindexed BAM files");
|
||||||
|
|
||||||
List<GenomeLoc> region;
|
List<GenomeLoc> region;
|
||||||
if(intervals != null)
|
if(intervals != null)
|
||||||
|
|
@ -810,7 +810,7 @@ public class GenomeAnalysisEngine {
|
||||||
|
|
||||||
if (intervals != null && !intervals.isEmpty()) {
|
if (intervals != null && !intervals.isEmpty()) {
|
||||||
if(!readsDataSource.isEmpty() && readsDataSource.getSortOrder() != SAMFileHeader.SortOrder.coordinate)
|
if(!readsDataSource.isEmpty() && readsDataSource.getSortOrder() != SAMFileHeader.SortOrder.coordinate)
|
||||||
Utils.scareUser("Locus walkers can only walk over coordinate-sorted data. Please resort your input BAM file.");
|
throw new UserError.MissortedBAM(SAMFileHeader.SortOrder.coordinate, "Locus walkers can only walk over coordinate-sorted data. Please resort your input BAM file(s).");
|
||||||
|
|
||||||
shardStrategy = ShardStrategyFactory.shatter(readsDataSource,
|
shardStrategy = ShardStrategyFactory.shatter(readsDataSource,
|
||||||
referenceDataSource.getReference(),
|
referenceDataSource.getReference(),
|
||||||
|
|
@ -844,9 +844,9 @@ public class GenomeAnalysisEngine {
|
||||||
}
|
}
|
||||||
} else if (walker instanceof ReadPairWalker) {
|
} else if (walker instanceof ReadPairWalker) {
|
||||||
if(readsDataSource != null && readsDataSource.getSortOrder() != SAMFileHeader.SortOrder.queryname)
|
if(readsDataSource != null && readsDataSource.getSortOrder() != SAMFileHeader.SortOrder.queryname)
|
||||||
Utils.scareUser("Read pair walkers can only walk over query name-sorted data. Please resort your input BAM file.");
|
throw new UserError.MissortedBAM(SAMFileHeader.SortOrder.queryname, "Read pair walkers can only walk over query name-sorted data. Please resort your input BAM file.");
|
||||||
if(intervals != null && !intervals.isEmpty())
|
if(intervals != null && !intervals.isEmpty())
|
||||||
Utils.scareUser("Pairs traversal cannot be used in conjunction with intervals.");
|
throw new UserError.CommandLineError("Pairs traversal cannot be used in conjunction with intervals.");
|
||||||
|
|
||||||
shardStrategy = ShardStrategyFactory.shatter(readsDataSource,
|
shardStrategy = ShardStrategyFactory.shatter(readsDataSource,
|
||||||
referenceDataSource.getReference(),
|
referenceDataSource.getReference(),
|
||||||
|
|
@ -854,7 +854,7 @@ public class GenomeAnalysisEngine {
|
||||||
drivingDataSource.getSequenceDictionary(),
|
drivingDataSource.getSequenceDictionary(),
|
||||||
SHARD_SIZE);
|
SHARD_SIZE);
|
||||||
} else
|
} else
|
||||||
throw new StingException("Unable to support walker of type" + walker.getClass().getName());
|
throw new GATKException("Unable to support walker of type" + walker.getClass().getName());
|
||||||
|
|
||||||
return shardStrategy;
|
return shardStrategy;
|
||||||
}
|
}
|
||||||
|
|
@ -996,7 +996,7 @@ public class GenomeAnalysisEngine {
|
||||||
unpackedReads.add(new SAMReaderID(new File(fileName),getTags(inputFile)));
|
unpackedReads.add(new SAMReaderID(new File(fileName),getTags(inputFile)));
|
||||||
}
|
}
|
||||||
catch( FileNotFoundException ex ) {
|
catch( FileNotFoundException ex ) {
|
||||||
throw new StingException("Unable to find file while unpacking reads", ex);
|
throw new UserError.CouldNotReadInputFile(inputFile, "Unable to find file while unpacking reads", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(inputFile.getName().toLowerCase().endsWith(".bam")) {
|
else if(inputFile.getName().toLowerCase().endsWith(".bam")) {
|
||||||
|
|
@ -1006,9 +1006,9 @@ public class GenomeAnalysisEngine {
|
||||||
unpackedReads.add(new SAMReaderID(new File("/dev/stdin"),Collections.<String>emptyList()));
|
unpackedReads.add(new SAMReaderID(new File("/dev/stdin"),Collections.<String>emptyList()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Utils.scareUser(String.format("The GATK reads argument (-I) supports only BAM files with the .bam extension and lists of BAM files " +
|
throw new UserError.CommandLineError(String.format("The GATK reads argument (-I) supports only BAM files with the .bam extension and lists of BAM files " +
|
||||||
"with the .list extension, but the file %s has neither extension. Please ensure that your BAM file or list " +
|
"with the .list extension, but the file %s has neither extension. Please ensure that your BAM file or list " +
|
||||||
"of BAM files is in the correct format, update the extension, and try again.",inputFile.getName()));
|
"of BAM files is in the correct format, update the extension, and try again.",inputFile.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return unpackedReads;
|
return unpackedReads;
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import java.util.Map;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -78,7 +79,7 @@ public class ReadMetrics implements Cloneable {
|
||||||
newMetrics = (ReadMetrics)super.clone();
|
newMetrics = (ReadMetrics)super.clone();
|
||||||
}
|
}
|
||||||
catch(CloneNotSupportedException ex) {
|
catch(CloneNotSupportedException ex) {
|
||||||
throw new StingException("Unable to clone runtime metrics",ex);
|
throw new GATKException("Unable to clone runtime metrics",ex);
|
||||||
}
|
}
|
||||||
newMetrics.nRecords = nRecords;
|
newMetrics.nRecords = nRecords;
|
||||||
newMetrics.nReads = nReads;
|
newMetrics.nReads = nReads;
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import org.broadinstitute.sting.commandline.Hidden;
|
||||||
import org.broadinstitute.sting.gatk.filters.FilterManager;
|
import org.broadinstitute.sting.gatk.filters.FilterManager;
|
||||||
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrack;
|
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrack;
|
||||||
import org.broadinstitute.sting.gatk.walkers.*;
|
import org.broadinstitute.sting.gatk.walkers.*;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.classloader.PluginManager;
|
import org.broadinstitute.sting.utils.classloader.PluginManager;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.utils.text.TextFormattingUtils;
|
import org.broadinstitute.sting.utils.text.TextFormattingUtils;
|
||||||
|
|
@ -168,7 +169,7 @@ public class WalkerManager extends PluginManager<Walker> {
|
||||||
public static DataSource getWalkerDataSource(Class<? extends Walker> walkerClass) {
|
public static DataSource getWalkerDataSource(Class<? extends Walker> walkerClass) {
|
||||||
By byDataSource = walkerClass.getAnnotation(By.class);
|
By byDataSource = walkerClass.getAnnotation(By.class);
|
||||||
if( byDataSource == null )
|
if( byDataSource == null )
|
||||||
throw new StingException("Unable to find By annotation for walker class " + walkerClass.getName());
|
throw new GATKException("Unable to find By annotation for walker class " + walkerClass.getName());
|
||||||
return byDataSource.value();
|
return byDataSource.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -397,7 +398,7 @@ public class WalkerManager extends PluginManager<Walker> {
|
||||||
private static Requires getWalkerRequirements(Class<? extends Walker> walkerClass) {
|
private static Requires getWalkerRequirements(Class<? extends Walker> walkerClass) {
|
||||||
Requires requiresDataSource = walkerClass.getAnnotation(Requires.class);
|
Requires requiresDataSource = walkerClass.getAnnotation(Requires.class);
|
||||||
if( requiresDataSource == null )
|
if( requiresDataSource == null )
|
||||||
throw new StingException( "Unable to find data types required by walker class " + walkerClass.getName());
|
throw new GATKException( "Unable to find data types required by walker class " + walkerClass.getName());
|
||||||
return requiresDataSource;
|
return requiresDataSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ package org.broadinstitute.sting.gatk.arguments;
|
||||||
|
|
||||||
import net.sf.samtools.SAMFileReader;
|
import net.sf.samtools.SAMFileReader;
|
||||||
import org.broadinstitute.sting.gatk.phonehome.GATKRunReport;
|
import org.broadinstitute.sting.gatk.phonehome.GATKRunReport;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.utils.interval.IntervalMergingRule;
|
import org.broadinstitute.sting.utils.interval.IntervalMergingRule;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
|
|
@ -191,7 +192,7 @@ public class GATKArgumentCollection {
|
||||||
try {
|
try {
|
||||||
serializer.write(collection, result);
|
serializer.write(collection, result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new StingException("Failed to marshal the data to the file " + outputFile, e);
|
throw new GATKException("Failed to marshal the data to the file " + outputFile, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -206,7 +207,7 @@ public class GATKArgumentCollection {
|
||||||
try {
|
try {
|
||||||
serializer.write(collection, outputFile);
|
serializer.write(collection, outputFile);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new StingException("Failed to marshal the data to the file " + outputFile, e);
|
throw new GATKException("Failed to marshal the data to the file " + outputFile, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -222,7 +223,7 @@ public class GATKArgumentCollection {
|
||||||
GATKArgumentCollection example = serializer.read(GATKArgumentCollection.class, source);
|
GATKArgumentCollection example = serializer.read(GATKArgumentCollection.class, source);
|
||||||
return example;
|
return example;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new StingException("Failed to marshal the data from file " + filename, e);
|
throw new GATKException("Failed to marshal the data from file " + filename, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -237,7 +238,7 @@ public class GATKArgumentCollection {
|
||||||
GATKArgumentCollection example = serializer.read(GATKArgumentCollection.class, file);
|
GATKArgumentCollection example = serializer.read(GATKArgumentCollection.class, file);
|
||||||
return example;
|
return example;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new StingException("Failed to marshal the data from file " + file.toString(), e);
|
throw new GATKException("Failed to marshal the data from file " + file.toString(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
package org.broadinstitute.sting.gatk.contexts;
|
package org.broadinstitute.sting.gatk.contexts;
|
||||||
|
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
|
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
|
||||||
|
|
@ -68,8 +69,8 @@ public class AlignmentContext {
|
||||||
|
|
||||||
public AlignmentContext(GenomeLoc loc, ReadBackedPileup basePileup, long skippedBases,boolean hasPileupBeenDownsampled ) {
|
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 StingException("BUG: GenomeLoc in Alignment context is null");
|
||||||
if ( basePileup == null ) throw new StingException("BUG: ReadBackedPileup in Alignment context is null");
|
if ( basePileup == null ) throw new GATKException("BUG: ReadBackedPileup in Alignment context is null");
|
||||||
if ( skippedBases < 0 ) throw new StingException("BUG: skippedBases is -1 in Alignment context");
|
if ( skippedBases < 0 ) throw new GATKException("BUG: skippedBases is -1 in Alignment context");
|
||||||
|
|
||||||
this.loc = loc;
|
this.loc = loc;
|
||||||
this.basePileup = basePileup;
|
this.basePileup = basePileup;
|
||||||
|
|
@ -90,7 +91,7 @@ public class AlignmentContext {
|
||||||
*/
|
*/
|
||||||
public ReadBackedPileup getBasePileup() {
|
public ReadBackedPileup getBasePileup() {
|
||||||
if(!hasBasePileup())
|
if(!hasBasePileup())
|
||||||
throw new StingException("No base pileup is available. Please check for a base pileup with hasBasePileup() before attempting to retrieve a pileup.");
|
throw new GATKException("No base pileup is available. Please check for a base pileup with hasBasePileup() before attempting to retrieve a pileup.");
|
||||||
return basePileup;
|
return basePileup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -100,7 +101,7 @@ public class AlignmentContext {
|
||||||
*/
|
*/
|
||||||
public ReadBackedExtendedEventPileup getExtendedEventPileup() {
|
public ReadBackedExtendedEventPileup getExtendedEventPileup() {
|
||||||
if(!hasExtendedEventPileup())
|
if(!hasExtendedEventPileup())
|
||||||
throw new StingException("No extended event pileup is present.");
|
throw new GATKException("No extended event pileup is present.");
|
||||||
return (ReadBackedExtendedEventPileup)basePileup;
|
return (ReadBackedExtendedEventPileup)basePileup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.gatk.contexts;
|
package org.broadinstitute.sting.gatk.contexts;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.utils.BaseUtils;
|
import org.broadinstitute.sting.utils.BaseUtils;
|
||||||
|
|
@ -191,7 +192,7 @@ public class ReferenceContext {
|
||||||
byte[] b = new byte[stop-start];
|
byte[] b = new byte[stop-start];
|
||||||
|
|
||||||
if ( stop > bases.length )
|
if ( stop > bases.length )
|
||||||
throw new StingException("Bases beyond the current window requested: window="+window+", requested="+n);
|
throw new GATKException("Bases beyond the current window requested: window="+window+", requested="+n);
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for ( int j = start ; j < stop ; j++) b[i++]=bases[j];
|
for ( int j = start ; j < stop ; j++) b[i++]=bases[j];
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,10 @@ package org.broadinstitute.sting.gatk.contexts;
|
||||||
|
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
import net.sf.samtools.SAMReadGroupRecord;
|
import net.sf.samtools.SAMReadGroupRecord;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
import org.broadinstitute.sting.utils.pileup.*;
|
import org.broadinstitute.sting.utils.pileup.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -73,7 +75,7 @@ public class StratifiedAlignmentContext<RBP extends ReadBackedPileup> {
|
||||||
case REVERSE:
|
case REVERSE:
|
||||||
return new AlignmentContext(loc,basePileup.getNegativeStrandPileup());
|
return new AlignmentContext(loc,basePileup.getNegativeStrandPileup());
|
||||||
default:
|
default:
|
||||||
throw new StingException("Unable to get alignment context for type = " + type);
|
throw new GATKException("Unable to get alignment context for type = " + type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -113,8 +115,9 @@ public class StratifiedAlignmentContext<RBP extends ReadBackedPileup> {
|
||||||
if(sampleName != null)
|
if(sampleName != null)
|
||||||
contexts.put(sampleName,new StratifiedAlignmentContext<RBP>(loc,pileupBySample));
|
contexts.put(sampleName,new StratifiedAlignmentContext<RBP>(loc,pileupBySample));
|
||||||
else {
|
else {
|
||||||
if(assumedSingleSample == null)
|
if(assumedSingleSample == null) {
|
||||||
throw new StingException("Missing read group for read " + pileupBySample.iterator().next().getRead());
|
throw new UserError.MalformedBam(pileupBySample.iterator().next().getRead(), "Missing read group for read");
|
||||||
|
}
|
||||||
contexts.put(assumedSingleSample,new StratifiedAlignmentContext<RBP>(loc,pileupBySample));
|
contexts.put(assumedSingleSample,new StratifiedAlignmentContext<RBP>(loc,pileupBySample));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -144,9 +147,9 @@ public class StratifiedAlignmentContext<RBP extends ReadBackedPileup> {
|
||||||
boolean isExtended = contexts.iterator().next().basePileup instanceof ReadBackedExtendedEventPileup;
|
boolean isExtended = contexts.iterator().next().basePileup instanceof ReadBackedExtendedEventPileup;
|
||||||
for(StratifiedAlignmentContext context: contexts) {
|
for(StratifiedAlignmentContext context: contexts) {
|
||||||
if(!loc.equals(context.getLocation()))
|
if(!loc.equals(context.getLocation()))
|
||||||
throw new StingException("Illegal attempt to join contexts from different genomic locations");
|
throw new GATKException("Illegal attempt to join contexts from different genomic locations");
|
||||||
if(isExtended != (context.basePileup instanceof ReadBackedExtendedEventPileup))
|
if(isExtended != (context.basePileup instanceof ReadBackedExtendedEventPileup))
|
||||||
throw new StingException("Illegal attempt to join simple and extended contexts");
|
throw new GATKException("Illegal attempt to join simple and extended contexts");
|
||||||
}
|
}
|
||||||
|
|
||||||
AlignmentContext jointContext;
|
AlignmentContext jointContext;
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ public class VariantContextUtils {
|
||||||
*/
|
*/
|
||||||
public static List<JexlVCMatchExp> initializeMatchExps(String[] names, String[] exps) {
|
public static List<JexlVCMatchExp> initializeMatchExps(String[] names, String[] exps) {
|
||||||
if ( names == null || exps == null )
|
if ( names == null || exps == null )
|
||||||
throw new StingException("BUG: neither names nor exps can be null: names " + Arrays.toString(names) + " exps=" + Arrays.toString(exps) );
|
throw new GATKException("BUG: neither names nor exps can be null: names " + Arrays.toString(names) + " exps=" + Arrays.toString(exps) );
|
||||||
|
|
||||||
if ( names.length != exps.length )
|
if ( names.length != exps.length )
|
||||||
throw new UserError("Inconsistent number of provided filter names and expressions: names=" + Arrays.toString(names) + " exps=" + Arrays.toString(exps));
|
throw new UserError("Inconsistent number of provided filter names and expressions: names=" + Arrays.toString(names) + " exps=" + Arrays.toString(exps));
|
||||||
|
|
@ -322,7 +322,7 @@ public class VariantContextUtils {
|
||||||
|
|
||||||
for ( VariantContext vc : VCs ) {
|
for ( VariantContext vc : VCs ) {
|
||||||
if ( loc.getStart() != vc.getStart() ) // || !first.getReference().equals(vc.getReference()) )
|
if ( loc.getStart() != vc.getStart() ) // || !first.getReference().equals(vc.getReference()) )
|
||||||
throw new StingException("BUG: attempting to merge VariantContexts with different start sites: first="+ first.toString() + " second=" + vc.toString());
|
throw new GATKException("BUG: attempting to merge VariantContexts with different start sites: first="+ first.toString() + " second=" + vc.toString());
|
||||||
|
|
||||||
if ( getLocation(vc).size() > loc.size() )
|
if ( getLocation(vc).size() > loc.size() )
|
||||||
loc = getLocation(vc); // get the longest location
|
loc = getLocation(vc); // get the longest location
|
||||||
|
|
@ -449,7 +449,7 @@ public class VariantContextUtils {
|
||||||
if ( ref == null || ref.length() < myRef.length() )
|
if ( ref == null || ref.length() < myRef.length() )
|
||||||
ref = myRef;
|
ref = myRef;
|
||||||
else if ( ref.length() == myRef.length() && ! ref.equals(myRef) )
|
else if ( ref.length() == myRef.length() && ! ref.equals(myRef) )
|
||||||
throw new StingException("BUG: equal length references with difference bases: "+ ref + " " + myRef);
|
throw new GATKException("BUG: equal length references with difference bases: "+ ref + " " + myRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
|
|
@ -471,7 +471,7 @@ public class VariantContextUtils {
|
||||||
//
|
//
|
||||||
|
|
||||||
Allele myRef = vc.getReference();
|
Allele myRef = vc.getReference();
|
||||||
if ( refAllele.length() <= myRef.length() ) throw new StingException("BUG: myRef="+myRef+" is longer than refAllele="+refAllele);
|
if ( refAllele.length() <= myRef.length() ) throw new GATKException("BUG: myRef="+myRef+" is longer than refAllele="+refAllele);
|
||||||
byte[] extraBases = Arrays.copyOfRange(refAllele.getBases(), myRef.length(), refAllele.length());
|
byte[] extraBases = Arrays.copyOfRange(refAllele.getBases(), myRef.length(), refAllele.length());
|
||||||
|
|
||||||
// System.out.printf("Remapping allele at %s%n", vc);
|
// System.out.printf("Remapping allele at %s%n", vc);
|
||||||
|
|
@ -576,7 +576,7 @@ public class VariantContextUtils {
|
||||||
padVC = false;
|
padVC = false;
|
||||||
else if (refAllele.length() == locLength-1)
|
else if (refAllele.length() == locLength-1)
|
||||||
padVC = true;
|
padVC = true;
|
||||||
else throw new StingException("Badly formed variant context, reference length must be at most one base shorter than location size");
|
else throw new GATKException("Badly formed variant context, reference length must be at most one base shorter than location size");
|
||||||
|
|
||||||
|
|
||||||
// nothing to do if we don't need to pad bases
|
// nothing to do if we don't need to pad bases
|
||||||
|
|
@ -590,7 +590,7 @@ public class VariantContextUtils {
|
||||||
else if (attributes.containsKey(VariantContext.REFERENCE_BASE_FOR_INDEL_KEY))
|
else if (attributes.containsKey(VariantContext.REFERENCE_BASE_FOR_INDEL_KEY))
|
||||||
refByte = (Byte)attributes.get(VariantContext.REFERENCE_BASE_FOR_INDEL_KEY);
|
refByte = (Byte)attributes.get(VariantContext.REFERENCE_BASE_FOR_INDEL_KEY);
|
||||||
else
|
else
|
||||||
throw new StingException("Error when trying to pad Variant Context: either input reference base must be a regular base, or input VC must contain reference base key");
|
throw new GATKException("Error when trying to pad Variant Context: either input reference base must be a regular base, or input VC must contain reference base key");
|
||||||
|
|
||||||
List<Allele> alleles = new ArrayList<Allele>();
|
List<Allele> alleles = new ArrayList<Allele>();
|
||||||
Map<String, Genotype> genotypes = new TreeMap<String, Genotype>();
|
Map<String, Genotype> genotypes = new TreeMap<String, Genotype>();
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,11 @@ import org.apache.commons.jexl2.JexlContext;
|
||||||
import org.apache.commons.jexl2.MapContext;
|
import org.apache.commons.jexl2.MapContext;
|
||||||
import org.broad.tribble.util.variantcontext.Genotype;
|
import org.broad.tribble.util.variantcontext.Genotype;
|
||||||
import org.broad.tribble.util.variantcontext.VariantContext;
|
import org.broad.tribble.util.variantcontext.VariantContext;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
import org.broadinstitute.sting.utils.Utils;
|
||||||
import org.broad.tribble.vcf.VCFConstants;
|
import org.broad.tribble.vcf.VCFConstants;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
@ -272,7 +274,7 @@ class JEXLMap implements Map<VariantContextUtils.JexlVCMatchExp, Boolean> {
|
||||||
try {
|
try {
|
||||||
jexl.put (exp, (Boolean) exp.exp.evaluate(jContext));
|
jexl.put (exp, (Boolean) exp.exp.evaluate(jContext));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new StingException(e.getMessage());
|
throw new UserError.CommandLineError(String.format("Invalid JEXL expression detected for %s with message %s", exp.name, e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.broadinstitute.sting.gatk.datasources.providers;
|
package org.broadinstitute.sting.gatk.datasources.providers;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
@ -88,8 +89,8 @@ public class LocusReferenceView extends ReferenceView {
|
||||||
if( walker.getClass().isAnnotationPresent(Reference.class) ) {
|
if( walker.getClass().isAnnotationPresent(Reference.class) ) {
|
||||||
Window window = walker.getClass().getAnnotation(Reference.class).window();
|
Window window = walker.getClass().getAnnotation(Reference.class).window();
|
||||||
|
|
||||||
if( window.start() > 0 ) throw new StingException( "Reference window starts after current locus" );
|
if( window.start() > 0 ) throw new GATKException( "Reference window starts after current locus" );
|
||||||
if( window.stop() < 0 ) throw new StingException( "Reference window ends before current locus" );
|
if( window.stop() < 0 ) throw new GATKException( "Reference window ends before current locus" );
|
||||||
|
|
||||||
windowStart = window.start();
|
windowStart = window.start();
|
||||||
windowStop = window.stop();
|
windowStop = window.stop();
|
||||||
|
|
@ -124,7 +125,7 @@ public class LocusReferenceView extends ReferenceView {
|
||||||
if ( bounds==null || loc==null) return; // can bounds be null actually???
|
if ( bounds==null || loc==null) return; // can bounds be null actually???
|
||||||
if ( isLocationWithinBounds(loc) ) return;
|
if ( isLocationWithinBounds(loc) ) return;
|
||||||
if ( loc.getContigIndex() != bounds.getContigIndex() )
|
if ( loc.getContigIndex() != bounds.getContigIndex() )
|
||||||
throw new StingException("Illegal attempt to expand reference view bounds to accommodate location on a different contig.");
|
throw new GATKException("Illegal attempt to expand reference view bounds to accommodate location on a different contig.");
|
||||||
|
|
||||||
bounds = GenomeLocParser.createGenomeLoc(bounds.getContigIndex(),
|
bounds = GenomeLocParser.createGenomeLoc(bounds.getContigIndex(),
|
||||||
Math.min(bounds.getStart(),loc.getStart()),
|
Math.min(bounds.getStart(),loc.getStart()),
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,7 @@
|
||||||
package org.broadinstitute.sting.gatk.datasources.providers;
|
package org.broadinstitute.sting.gatk.datasources.providers;
|
||||||
|
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.*;
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
@ -84,7 +81,7 @@ public class ReferenceView implements View {
|
||||||
int overhang = (int)(genomeLoc.getStop() - stop);
|
int overhang = (int)(genomeLoc.getStop() - stop);
|
||||||
if ( overhang > 0 ) {
|
if ( overhang > 0 ) {
|
||||||
if ( overhang > BUFFER ) // todo -- this is a bit dangerous
|
if ( overhang > BUFFER ) // todo -- this is a bit dangerous
|
||||||
throw new StingException("Insufficient buffer size for Xs overhanging genome -- expand BUFFER");
|
throw new GATKException("Insufficient buffer size for Xs overhanging genome -- expand BUFFER");
|
||||||
byte[] all = new byte[subsequence.getBases().length + overhang];
|
byte[] all = new byte[subsequence.getBases().length + overhang];
|
||||||
System.arraycopy(subsequence.getBases(), 0, all, 0, subsequence.getBases().length);
|
System.arraycopy(subsequence.getBases(), 0, all, 0, subsequence.getBases().length);
|
||||||
System.arraycopy(Xs, 0, all, subsequence.getBases().length, overhang);
|
System.arraycopy(Xs, 0, all, subsequence.getBases().length, overhang);
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package org.broadinstitute.sting.gatk.datasources.providers;
|
||||||
|
|
||||||
import org.broadinstitute.sting.gatk.datasources.shards.Shard;
|
import org.broadinstitute.sting.gatk.datasources.shards.Shard;
|
||||||
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.ReferenceOrderedDataSource;
|
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.ReferenceOrderedDataSource;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -110,7 +111,7 @@ public abstract class ShardDataProvider {
|
||||||
Collection<Class<? extends View>> conflicts = registeredView.getConflictingViews();
|
Collection<Class<? extends View>> conflicts = registeredView.getConflictingViews();
|
||||||
for( Class<? extends View> conflict: conflicts ) {
|
for( Class<? extends View> conflict: conflicts ) {
|
||||||
if( conflict.isInstance(view) )
|
if( conflict.isInstance(view) )
|
||||||
throw new StingException(String.format("Tried to register two conflicting views: %s and %s",
|
throw new GATKException(String.format("Tried to register two conflicting views: %s and %s",
|
||||||
registeredView.getClass().getSimpleName(),
|
registeredView.getClass().getSimpleName(),
|
||||||
view.getClass().getSimpleName()));
|
view.getClass().getSimpleName()));
|
||||||
}
|
}
|
||||||
|
|
@ -120,7 +121,7 @@ public abstract class ShardDataProvider {
|
||||||
for( Class<? extends View> conflict: view.getConflictingViews() ) {
|
for( Class<? extends View> conflict: view.getConflictingViews() ) {
|
||||||
for( View registeredView: registeredViews ) {
|
for( View registeredView: registeredViews ) {
|
||||||
if( conflict.isInstance(registeredView) )
|
if( conflict.isInstance(registeredView) )
|
||||||
throw new StingException(String.format("Tried to register two conflicting views: %s and %s",
|
throw new GATKException(String.format("Tried to register two conflicting views: %s and %s",
|
||||||
registeredView.getClass().getSimpleName(),
|
registeredView.getClass().getSimpleName(),
|
||||||
view.getClass().getSimpleName()));
|
view.getClass().getSimpleName()));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ public class IntervalSharder {
|
||||||
|
|
||||||
for(GenomeLoc location: loci) {
|
for(GenomeLoc location: loci) {
|
||||||
if(!location.getContig().equals(contig))
|
if(!location.getContig().equals(contig))
|
||||||
throw new StingException("Location outside bounds of contig");
|
throw new GATKException("Location outside bounds of contig");
|
||||||
|
|
||||||
if(!binIterator.hasNext())
|
if(!binIterator.hasNext())
|
||||||
break;
|
break;
|
||||||
|
|
@ -190,7 +190,7 @@ public class IntervalSharder {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(lastFilePointer == null)
|
if(lastFilePointer == null)
|
||||||
throw new StingException("Illegal state: initializer failed to create cached file pointer.");
|
throw new GATKException("Illegal state: initializer failed to create cached file pointer.");
|
||||||
|
|
||||||
// The start of the region overlaps the bin. Add the overlapping subset.
|
// The start of the region overlaps the bin. Add the overlapping subset.
|
||||||
final int regionStop = Math.min(locationStop,binStop);
|
final int regionStop = Math.min(locationStop,binStop);
|
||||||
|
|
@ -474,7 +474,7 @@ class BinQueueState implements Comparable<BinQueueState> {
|
||||||
// Both BinQueueStates have next bins. Before proceeding, make sure the bin cache is valid.
|
// Both BinQueueStates have next bins. Before proceeding, make sure the bin cache is valid.
|
||||||
if(this.firstLocusInCurrentBin <= 0 || this.lastLocusInCurrentBin <= 0 ||
|
if(this.firstLocusInCurrentBin <= 0 || this.lastLocusInCurrentBin <= 0 ||
|
||||||
other.firstLocusInCurrentBin <= 0 || other.lastLocusInCurrentBin <= 0) {
|
other.firstLocusInCurrentBin <= 0 || other.lastLocusInCurrentBin <= 0) {
|
||||||
throw new StingException("Sharding mechanism error - bin->locus cache is invalid.");
|
throw new GATKException("Sharding mechanism error - bin->locus cache is invalid.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Straight integer subtraction works here because lhsStart, rhsStart always positive.
|
// Straight integer subtraction works here because lhsStart, rhsStart always positive.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.broadinstitute.sting.gatk.datasources.shards;
|
package org.broadinstitute.sting.gatk.datasources.shards;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.gatk.ReadMetrics;
|
import org.broadinstitute.sting.gatk.ReadMetrics;
|
||||||
|
|
@ -42,7 +43,7 @@ public class MonolithicShard implements Shard {
|
||||||
public MonolithicShard(SAMDataSource readsDataSource, ShardType shardType, List<GenomeLoc> locs) {
|
public MonolithicShard(SAMDataSource readsDataSource, ShardType shardType, List<GenomeLoc> locs) {
|
||||||
this.readsDataSource = readsDataSource;
|
this.readsDataSource = readsDataSource;
|
||||||
if(shardType != ShardType.LOCUS && shardType != ShardType.READ)
|
if(shardType != ShardType.LOCUS && shardType != ShardType.READ)
|
||||||
throw new StingException("Invalid shard type for monolithic shard: " + shardType);
|
throw new GATKException("Invalid shard type for monolithic shard: " + shardType);
|
||||||
this.shardType = shardType;
|
this.shardType = shardType;
|
||||||
this.locs = locs;
|
this.locs = locs;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package org.broadinstitute.sting.gatk.datasources.shards;
|
||||||
|
|
||||||
import net.sf.samtools.SAMSequenceDictionary;
|
import net.sf.samtools.SAMSequenceDictionary;
|
||||||
import net.sf.picard.reference.IndexedFastaSequenceFile;
|
import net.sf.picard.reference.IndexedFastaSequenceFile;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.utils.GenomeLocSortedSet;
|
import org.broadinstitute.sting.utils.GenomeLocSortedSet;
|
||||||
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.SAMDataSource;
|
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.SAMDataSource;
|
||||||
|
|
@ -71,7 +72,7 @@ public class ShardStrategyFactory {
|
||||||
case READS_EXPERIMENTAL:
|
case READS_EXPERIMENTAL:
|
||||||
return new ReadShardStrategy(readsDataSource,null);
|
return new ReadShardStrategy(readsDataSource,null);
|
||||||
default:
|
default:
|
||||||
throw new StingException("Strategy: " + strat + " isn't implemented for this type of shatter request");
|
throw new GATKException("Strategy: " + strat + " isn't implemented for this type of shatter request");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -109,7 +110,7 @@ public class ShardStrategyFactory {
|
||||||
case READS_EXPERIMENTAL:
|
case READS_EXPERIMENTAL:
|
||||||
return new ReadShardStrategy(readsDataSource,lst);
|
return new ReadShardStrategy(readsDataSource,lst);
|
||||||
default:
|
default:
|
||||||
throw new StingException("Strategy: " + strat + " isn't implemented");
|
throw new GATKException("Strategy: " + strat + " isn't implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.gatk.datasources.simpleDataSources;
|
package org.broadinstitute.sting.gatk.datasources.simpleDataSources;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import net.sf.picard.reference.FastaSequenceIndexBuilder;
|
import net.sf.picard.reference.FastaSequenceIndexBuilder;
|
||||||
import net.sf.picard.sam.CreateSequenceDictionary;
|
import net.sf.picard.sam.CreateSequenceDictionary;
|
||||||
|
|
@ -68,7 +69,7 @@ public class ReferenceDataSource implements ReferenceDataSourceProgressListener
|
||||||
try {
|
try {
|
||||||
// get exclusive lock
|
// get exclusive lock
|
||||||
if (!indexLock.exclusiveLock())
|
if (!indexLock.exclusiveLock())
|
||||||
throw new StingException("Index file could not be written because a lock could not be obtained." +
|
throw new GATKException("Index file could not be written because a lock could not be obtained." +
|
||||||
"If you are running multiple instances of GATK, another process is probably creating this " +
|
"If you are running multiple instances of GATK, another process is probably creating this " +
|
||||||
"file now. Please wait until it is finished and try again.");
|
"file now. Please wait until it is finished and try again.");
|
||||||
FastaSequenceIndexBuilder faiBuilder = new FastaSequenceIndexBuilder(fastaFile, this);
|
FastaSequenceIndexBuilder faiBuilder = new FastaSequenceIndexBuilder(fastaFile, this);
|
||||||
|
|
@ -82,7 +83,7 @@ public class ReferenceDataSource implements ReferenceDataSourceProgressListener
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
// If lock creation succeeded, the failure must have been generating the index.
|
// If lock creation succeeded, the failure must have been generating the index.
|
||||||
// If lock creation failed, just skip over index creation entirely.
|
// If lock creation failed, just skip over index creation entirely.
|
||||||
throw new StingException("Index file does not exist and could not be created because " + e.getMessage(), e);
|
throw new GATKException("Index file does not exist and could not be created because " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
indexLock.unlock();
|
indexLock.unlock();
|
||||||
|
|
@ -108,7 +109,7 @@ public class ReferenceDataSource implements ReferenceDataSourceProgressListener
|
||||||
try {
|
try {
|
||||||
// get shared lock on dict file so nobody else can start creating it
|
// get shared lock on dict file so nobody else can start creating it
|
||||||
if (!dictLock.exclusiveLock())
|
if (!dictLock.exclusiveLock())
|
||||||
throw new StingException("Dictionary file could not be written because a lock could not be obtained." +
|
throw new GATKException("Dictionary file could not be written because a lock could not be obtained." +
|
||||||
"If you are running multiple instances of GATK, another process is probably creating this " +
|
"If you are running multiple instances of GATK, another process is probably creating this " +
|
||||||
"file now. Please wait until it is finished and try again.");
|
"file now. Please wait until it is finished and try again.");
|
||||||
// dict will be written to random temporary file in same directory (see note above)
|
// dict will be written to random temporary file in same directory (see note above)
|
||||||
|
|
@ -121,7 +122,7 @@ public class ReferenceDataSource implements ReferenceDataSourceProgressListener
|
||||||
new CreateSequenceDictionary().instanceMain(args);
|
new CreateSequenceDictionary().instanceMain(args);
|
||||||
|
|
||||||
if (!tempFile.renameTo(dictFile))
|
if (!tempFile.renameTo(dictFile))
|
||||||
throw new StingException("Error transferring temp file " + tempFile + " to dict file " + dictFile);
|
throw new GATKException("Error transferring temp file " + tempFile + " to dict file " + dictFile);
|
||||||
}
|
}
|
||||||
catch(FileSystemInabilityToLockException ex) {
|
catch(FileSystemInabilityToLockException ex) {
|
||||||
logger.info("Unable to create write lock: " + ex.getMessage());
|
logger.info("Unable to create write lock: " + ex.getMessage());
|
||||||
|
|
@ -130,7 +131,7 @@ public class ReferenceDataSource implements ReferenceDataSourceProgressListener
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
// If lock creation succeeded, the failure must have been generating the index.
|
// If lock creation succeeded, the failure must have been generating the index.
|
||||||
// If lock creation failed, just skip over index creation entirely.
|
// If lock creation failed, just skip over index creation entirely.
|
||||||
throw new StingException("Dictionary file does not exist and could not be created because " + e.getMessage(), e);
|
throw new GATKException("Dictionary file does not exist and could not be created because " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
dictLock.unlock();
|
dictLock.unlock();
|
||||||
|
|
@ -149,7 +150,7 @@ public class ReferenceDataSource implements ReferenceDataSourceProgressListener
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
if (!dictLock.sharedLock()) {
|
if (!dictLock.sharedLock()) {
|
||||||
throw new StingException("Could not open dictionary file because a lock could not be obtained.");
|
throw new GATKException("Could not open dictionary file because a lock could not be obtained.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(FileSystemInabilityToLockException ex) {
|
catch(FileSystemInabilityToLockException ex) {
|
||||||
|
|
@ -159,7 +160,7 @@ public class ReferenceDataSource implements ReferenceDataSourceProgressListener
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!indexLock.sharedLock()) {
|
if (!indexLock.sharedLock()) {
|
||||||
throw new StingException("Could not open index file because a lock could not be obtained.");
|
throw new GATKException("Could not open index file because a lock could not be obtained.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(FileSystemInabilityToLockException ex) {
|
catch(FileSystemInabilityToLockException ex) {
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,10 @@ import org.broadinstitute.sting.gatk.refdata.utils.FlashBackIterator;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.LocationAwareSeekableRODIterator;
|
import org.broadinstitute.sting.gatk.refdata.utils.LocationAwareSeekableRODIterator;
|
||||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||||
import org.broadinstitute.sting.gatk.walkers.Walker;
|
import org.broadinstitute.sting.gatk.walkers.Walker;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -155,7 +157,7 @@ class ReferenceOrderedDataPool extends ResourcePool<LocationAwareSeekableRODIter
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new StingException("Unable to find a ROD iterator for segments of type " + segment.getClass());
|
throw new GATKException("Unable to find a ROD iterator for segments of type " + segment.getClass());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -223,7 +225,7 @@ class ReferenceOrderedQueryDataPool extends ResourcePool<FeatureSource, Location
|
||||||
try {
|
try {
|
||||||
resource.close();
|
resource.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new StingException("Unable to close reader for rod named " + rod.getName(),e);
|
throw new UserError.CouldNotReadInputFile("Unable to close reader for rod named " + rod.getName(),e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.broadinstitute.sting.gatk.datasources.simpleDataSources;
|
package org.broadinstitute.sting.gatk.datasources.simpleDataSources;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||||
|
|
@ -88,10 +89,10 @@ abstract class ResourcePool <T,I extends Iterator> {
|
||||||
|
|
||||||
// make sure we actually removed the assignment
|
// make sure we actually removed the assignment
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
throw new StingException("Failed to remove resource assignment; target key had no associated value in the resource assignment map");
|
throw new GATKException("Failed to remove resource assignment; target key had no associated value in the resource assignment map");
|
||||||
// Return the resource to the pool.
|
// Return the resource to the pool.
|
||||||
if( !allResources.contains(resource) )
|
if( !allResources.contains(resource) )
|
||||||
throw new StingException("Iterator does not belong to the given pool.");
|
throw new GATKException("Iterator does not belong to the given pool.");
|
||||||
availableResources.add(resource);
|
availableResources.add(resource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,9 @@ import org.broadinstitute.sting.gatk.ReadProperties;
|
||||||
import org.broadinstitute.sting.gatk.ReadMetrics;
|
import org.broadinstitute.sting.gatk.ReadMetrics;
|
||||||
import org.broadinstitute.sting.gatk.arguments.ValidationExclusion;
|
import org.broadinstitute.sting.gatk.arguments.ValidationExclusion;
|
||||||
import org.broadinstitute.sting.gatk.filters.CountingFilteringIterator;
|
import org.broadinstitute.sting.gatk.filters.CountingFilteringIterator;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -126,7 +128,7 @@ public class SAMDataSource implements SimpleDataSource {
|
||||||
|
|
||||||
// Validate that all input files are sorted in the same order.
|
// Validate that all input files are sorted in the same order.
|
||||||
if(this.sortOrder != null && this.sortOrder != sortOrder)
|
if(this.sortOrder != null && this.sortOrder != sortOrder)
|
||||||
throw new StingException(String.format("Attempted to process mixed of files sorted as %s and %s.",this.sortOrder,sortOrder));
|
throw new UserError.MissortedBAM(String.format("Attempted to process mixed of files sorted as %s and %s.",this.sortOrder,sortOrder));
|
||||||
|
|
||||||
// Update the sort order.
|
// Update the sort order.
|
||||||
this.sortOrder = sortOrder;
|
this.sortOrder = sortOrder;
|
||||||
|
|
@ -293,7 +295,7 @@ public class SAMDataSource implements SimpleDataSource {
|
||||||
*/
|
*/
|
||||||
public void fillShard(BAMFormatAwareShard shard) {
|
public void fillShard(BAMFormatAwareShard shard) {
|
||||||
if(!shard.buffersReads())
|
if(!shard.buffersReads())
|
||||||
throw new StingException("Attempting to fill a non-buffering shard.");
|
throw new GATKException("Attempting to fill a non-buffering shard.");
|
||||||
|
|
||||||
SAMReaders readers = resourcePool.getAvailableReaders();
|
SAMReaders readers = resourcePool.getAvailableReaders();
|
||||||
// Cache the most recently viewed read so that we can check whether we've reached the end of a pair.
|
// Cache the most recently viewed read so that we can check whether we've reached the end of a pair.
|
||||||
|
|
@ -325,7 +327,7 @@ public class SAMDataSource implements SimpleDataSource {
|
||||||
return seekMonolithic(shard);
|
return seekMonolithic(shard);
|
||||||
|
|
||||||
if(!(shard instanceof BAMFormatAwareShard))
|
if(!(shard instanceof BAMFormatAwareShard))
|
||||||
throw new StingException("BlockDrivenSAMDataSource cannot operate on shards of type: " + shard.getClass());
|
throw new GATKException("BlockDrivenSAMDataSource cannot operate on shards of type: " + shard.getClass());
|
||||||
BAMFormatAwareShard bamAwareShard = (BAMFormatAwareShard)shard;
|
BAMFormatAwareShard bamAwareShard = (BAMFormatAwareShard)shard;
|
||||||
|
|
||||||
if(bamAwareShard.buffersReads()) {
|
if(bamAwareShard.buffersReads()) {
|
||||||
|
|
@ -348,7 +350,7 @@ public class SAMDataSource implements SimpleDataSource {
|
||||||
if(readers.getReader(id) == read.getFileSource().getReader())
|
if(readers.getReader(id) == read.getFileSource().getReader())
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
throw new StingException("Unable to find id for reader associated with read " + read.getReadName());
|
throw new GATKException("Unable to find id for reader associated with read " + read.getReadName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -507,7 +509,7 @@ public class SAMDataSource implements SimpleDataSource {
|
||||||
|
|
||||||
public synchronized void releaseReaders(SAMReaders readers) {
|
public synchronized void releaseReaders(SAMReaders readers) {
|
||||||
if(!allResources.contains(readers))
|
if(!allResources.contains(readers))
|
||||||
throw new StingException("Tried to return readers from the pool that didn't originate in the pool.");
|
throw new GATKException("Tried to return readers from the pool that didn't originate in the pool.");
|
||||||
availableResources.add(readers);
|
availableResources.add(readers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -522,12 +524,12 @@ public class SAMDataSource implements SimpleDataSource {
|
||||||
if(id != null)
|
if(id != null)
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
throw new StingException("No such reader id is available");
|
throw new GATKException("No such reader id is available");
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void createNewResource() {
|
private synchronized void createNewResource() {
|
||||||
if(allResources.size() > maxEntries)
|
if(allResources.size() > maxEntries)
|
||||||
throw new StingException("Cannot create a new resource pool. All resources are in use.");
|
throw new GATKException("Cannot create a new resource pool. All resources are in use.");
|
||||||
SAMReaders readers = new SAMReaders(readProperties);
|
SAMReaders readers = new SAMReaders(readProperties);
|
||||||
allResources.add(readers);
|
allResources.add(readers);
|
||||||
availableResources.add(readers);
|
availableResources.add(readers);
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ package org.broadinstitute.sting.gatk.datasources.utilities;
|
||||||
|
|
||||||
import org.broadinstitute.sting.commandline.CommandLineProgram;
|
import org.broadinstitute.sting.commandline.CommandLineProgram;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.utils.instrumentation.Sizeof;
|
import org.broadinstitute.sting.utils.instrumentation.Sizeof;
|
||||||
|
|
||||||
|
|
@ -58,7 +59,7 @@ public class BAMFileStat extends CommandLineProgram {
|
||||||
public int execute() {
|
public int execute() {
|
||||||
switch(command) {
|
switch(command) {
|
||||||
case ShowBlocks:
|
case ShowBlocks:
|
||||||
throw new StingException("The BAM block inspector has been disabled.");
|
throw new GATKException("The BAM block inspector has been disabled.");
|
||||||
case ShowIndex:
|
case ShowIndex:
|
||||||
showIndexBins(new File(bamFileName),range);
|
showIndexBins(new File(bamFileName),range);
|
||||||
break;
|
break;
|
||||||
|
|
@ -171,7 +172,7 @@ public class BAMFileStat extends CommandLineProgram {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(IllegalAccessException ex) {
|
catch(IllegalAccessException ex) {
|
||||||
throw new StingException("Unable to examine cached index",ex);
|
throw new GATKException("Unable to examine cached index",ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.printf("%nOverall: %d bins, %d chunks, %d linear index entries",numBins,numChunks,numLinearIndexEntries);
|
System.out.printf("%nOverall: %d bins, %d chunks, %d linear index entries",numBins,numChunks,numLinearIndexEntries);
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ import org.broadinstitute.sting.gatk.walkers.Walker;
|
||||||
import org.broadinstitute.sting.gatk.datasources.providers.ShardDataProvider;
|
import org.broadinstitute.sting.gatk.datasources.providers.ShardDataProvider;
|
||||||
import org.broadinstitute.sting.gatk.datasources.providers.LocusShardDataProvider;
|
import org.broadinstitute.sting.gatk.datasources.providers.LocusShardDataProvider;
|
||||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.collections.Pair;
|
import org.broadinstitute.sting.utils.collections.Pair;
|
||||||
import org.broadinstitute.sting.utils.GenomeLocSortedSet;
|
import org.broadinstitute.sting.utils.GenomeLocSortedSet;
|
||||||
|
|
@ -184,7 +185,7 @@ public abstract class Accumulator {
|
||||||
*/
|
*/
|
||||||
public void accumulate( ShardDataProvider provider, Object result ) {
|
public void accumulate( ShardDataProvider provider, Object result ) {
|
||||||
if(!(provider instanceof LocusShardDataProvider))
|
if(!(provider instanceof LocusShardDataProvider))
|
||||||
throw new StingException("Unable to reduce by interval on reads traversals at this time.");
|
throw new GATKException("Unable to reduce by interval on reads traversals at this time.");
|
||||||
|
|
||||||
GenomeLoc location = ((LocusShardDataProvider)provider).getLocus();
|
GenomeLoc location = ((LocusShardDataProvider)provider).getLocus();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import org.broadinstitute.sting.gatk.datasources.simpleDataSources.ReferenceOrde
|
||||||
import org.broadinstitute.sting.gatk.io.*;
|
import org.broadinstitute.sting.gatk.io.*;
|
||||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||||
import org.broadinstitute.sting.gatk.ReadMetrics;
|
import org.broadinstitute.sting.gatk.ReadMetrics;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.utils.threading.ThreadPoolMonitor;
|
import org.broadinstitute.sting.utils.threading.ThreadPoolMonitor;
|
||||||
|
|
||||||
|
|
@ -110,7 +111,7 @@ public class HierarchicalMicroScheduler extends MicroScheduler implements Hierar
|
||||||
mbs.registerMBean(this, name);
|
mbs.registerMBean(this, name);
|
||||||
}
|
}
|
||||||
catch (JMException ex) {
|
catch (JMException ex) {
|
||||||
throw new StingException("Unable to register microscheduler with JMX", ex);
|
throw new GATKException("Unable to register microscheduler with JMX", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -130,7 +131,7 @@ public class HierarchicalMicroScheduler extends MicroScheduler implements Hierar
|
||||||
while (isShardTraversePending() || isTreeReducePending()) {
|
while (isShardTraversePending() || isTreeReducePending()) {
|
||||||
// Check for errors during execution.
|
// Check for errors during execution.
|
||||||
if(hasTraversalErrorOccurred())
|
if(hasTraversalErrorOccurred())
|
||||||
throw new StingException("An error has occurred during the traversal.",getTraversalError());
|
throw new GATKException("An error has occurred during the traversal.",getTraversalError());
|
||||||
|
|
||||||
// Too many files sitting around taking up space? Merge them.
|
// Too many files sitting around taking up space? Merge them.
|
||||||
if (isMergeLimitExceeded())
|
if (isMergeLimitExceeded())
|
||||||
|
|
@ -159,7 +160,7 @@ public class HierarchicalMicroScheduler extends MicroScheduler implements Hierar
|
||||||
notifyTraversalDone(walker,result);
|
notifyTraversalDone(walker,result);
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
throw new StingException("Unable to retrieve result", ex);
|
throw new GATKException("Unable to retrieve result", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
outputTracker.close();
|
outputTracker.close();
|
||||||
|
|
@ -359,7 +360,7 @@ public class HierarchicalMicroScheduler extends MicroScheduler implements Hierar
|
||||||
|
|
||||||
private synchronized Throwable getTraversalError() {
|
private synchronized Throwable getTraversalError() {
|
||||||
if(!hasTraversalErrorOccurred())
|
if(!hasTraversalErrorOccurred())
|
||||||
throw new StingException("User has attempted to retrieve a traversal error when none exists");
|
throw new GATKException("User has attempted to retrieve a traversal error when none exists");
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import org.broadinstitute.sting.gatk.traversals.TraversalEngine;
|
||||||
import org.broadinstitute.sting.gatk.io.ThreadLocalOutputTracker;
|
import org.broadinstitute.sting.gatk.io.ThreadLocalOutputTracker;
|
||||||
import org.broadinstitute.sting.gatk.walkers.Walker;
|
import org.broadinstitute.sting.gatk.walkers.Walker;
|
||||||
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
|
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
@ -83,7 +84,7 @@ public class ShardTraverser implements Callable {
|
||||||
catch(Throwable t) {
|
catch(Throwable t) {
|
||||||
// Notify that an exception has occurred and rethrow it.
|
// Notify that an exception has occurred and rethrow it.
|
||||||
microScheduler.notifyOfTraversalError(t);
|
microScheduler.notifyOfTraversalError(t);
|
||||||
throw new StingException("An error has occurred during traversal",t);
|
throw new GATKException("An error has occurred during traversal",t);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
synchronized(this) {
|
synchronized(this) {
|
||||||
|
|
@ -115,7 +116,7 @@ public class ShardTraverser implements Callable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( InterruptedException ex ) {
|
catch( InterruptedException ex ) {
|
||||||
throw new StingException("Interrupted while waiting for more output to be finalized.",ex);
|
throw new GATKException("Interrupted while waiting for more output to be finalized.",ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package org.broadinstitute.sting.gatk.executive;
|
package org.broadinstitute.sting.gatk.executive;
|
||||||
|
|
||||||
import org.broadinstitute.sting.gatk.walkers.TreeReducible;
|
import org.broadinstitute.sting.gatk.walkers.TreeReducible;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
@ -90,11 +91,11 @@ public class TreeReducer implements Callable {
|
||||||
}
|
}
|
||||||
catch( InterruptedException ex ) {
|
catch( InterruptedException ex ) {
|
||||||
microScheduler.notifyOfTraversalError(ex);
|
microScheduler.notifyOfTraversalError(ex);
|
||||||
throw new StingException("Hierarchical reduce interrupted", ex);
|
throw new GATKException("Hierarchical reduce interrupted", ex);
|
||||||
}
|
}
|
||||||
catch( ExecutionException ex ) {
|
catch( ExecutionException ex ) {
|
||||||
microScheduler.notifyOfTraversalError(ex);
|
microScheduler.notifyOfTraversalError(ex);
|
||||||
throw new StingException("Hierarchical reduce failed", ex);
|
throw new GATKException("Hierarchical reduce failed", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
long endTime = System.currentTimeMillis();
|
long endTime = System.currentTimeMillis();
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.gatk.io;
|
package org.broadinstitute.sting.gatk.io;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.classloader.JVMUtils;
|
import org.broadinstitute.sting.utils.classloader.JVMUtils;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.commandline.ArgumentSource;
|
import org.broadinstitute.sting.commandline.ArgumentSource;
|
||||||
|
|
@ -140,7 +141,7 @@ public abstract class OutputTracker {
|
||||||
*/
|
*/
|
||||||
protected <T> T getTargetStream( Stub<T> stub ) {
|
protected <T> T getTargetStream( Stub<T> stub ) {
|
||||||
if( !outputs.containsKey(stub) )
|
if( !outputs.containsKey(stub) )
|
||||||
throw new StingException("OutputTracker was not notified that this stub exists: " + stub);
|
throw new GATKException("OutputTracker was not notified that this stub exists: " + stub);
|
||||||
Storage<T> storage = outputs.get(stub);
|
Storage<T> storage = outputs.get(stub);
|
||||||
if( storage == null ) {
|
if( storage == null ) {
|
||||||
storage = StorageFactory.createStorage(stub);
|
storage = StorageFactory.createStorage(stub);
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.gatk.io.storage;
|
package org.broadinstitute.sting.gatk.io.storage;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.gatk.io.stubs.OutputStreamStub;
|
import org.broadinstitute.sting.gatk.io.stubs.OutputStreamStub;
|
||||||
import org.broadinstitute.sting.gatk.io.storage.Storage;
|
import org.broadinstitute.sting.gatk.io.storage.Storage;
|
||||||
|
|
@ -60,7 +61,7 @@ public class OutputStreamStorage extends OutputStream implements Storage<OutputS
|
||||||
this.outputStream = stub.getOutputStream();
|
this.outputStream = stub.getOutputStream();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw new StingException("Not enough information to create storage for an OutputStream; need either a file or an existing output stream");
|
throw new GATKException("Not enough information to create storage for an OutputStream; need either a file or an existing output stream");
|
||||||
}
|
}
|
||||||
|
|
||||||
public OutputStreamStorage( OutputStreamStub stub, File file ) {
|
public OutputStreamStorage( OutputStreamStub stub, File file ) {
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ import org.broadinstitute.sting.gatk.io.stubs.Stub;
|
||||||
import org.broadinstitute.sting.gatk.io.stubs.OutputStreamStub;
|
import org.broadinstitute.sting.gatk.io.stubs.OutputStreamStub;
|
||||||
import org.broadinstitute.sting.gatk.io.stubs.SAMFileWriterStub;
|
import org.broadinstitute.sting.gatk.io.stubs.SAMFileWriterStub;
|
||||||
import org.broadinstitute.sting.gatk.io.stubs.VCFWriterStub;
|
import org.broadinstitute.sting.gatk.io.stubs.VCFWriterStub;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
@ -85,7 +86,7 @@ public class StorageFactory {
|
||||||
storage = new VCFWriterStorage(vcfWriterStub);
|
storage = new VCFWriterStorage(vcfWriterStub);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw new StingException("Unsupported stub type: " + stub.getClass().getName());
|
throw new GATKException("Unsupported stub type: " + stub.getClass().getName());
|
||||||
|
|
||||||
return storage;
|
return storage;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import org.broad.tribble.vcf.VCFHeader;
|
||||||
import org.broad.tribble.vcf.VCFHeaderLine;
|
import org.broad.tribble.vcf.VCFHeaderLine;
|
||||||
import org.broad.tribble.util.variantcontext.VariantContext;
|
import org.broad.tribble.util.variantcontext.VariantContext;
|
||||||
import org.broad.tribble.vcf.VCFWriter;
|
import org.broad.tribble.vcf.VCFWriter;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.gatk.io.stubs.VCFWriterStub;
|
import org.broadinstitute.sting.gatk.io.stubs.VCFWriterStub;
|
||||||
|
|
||||||
|
|
@ -48,7 +49,7 @@ public class VCFWriterStorage implements Storage<VCFWriterStorage>, VCFWriter {
|
||||||
this.stream = stub.getOutputStream();
|
this.stream = stub.getOutputStream();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw new StingException("Unable to create target to which to write; storage was provided with neither a file nor a stream.");
|
throw new GATKException("Unable to create target to which to write; storage was provided with neither a file nor a stream.");
|
||||||
|
|
||||||
writer = new StandardVCFWriter(stream);
|
writer = new StandardVCFWriter(stream);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
package org.broadinstitute.sting.gatk.io.stubs;
|
package org.broadinstitute.sting.gatk.io.stubs;
|
||||||
|
|
||||||
import org.broadinstitute.sting.commandline.*;
|
import org.broadinstitute.sting.commandline.*;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||||
|
|
||||||
|
|
@ -117,13 +118,13 @@ public class OutputStreamArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
return getConstructorForClass(type).newInstance(outputStream);
|
return getConstructorForClass(type).newInstance(outputStream);
|
||||||
}
|
}
|
||||||
catch( InstantiationException ex ) {
|
catch( InstantiationException ex ) {
|
||||||
throw new StingException("Could not instantiate class with OutputStream constructor: " + type.getName());
|
throw new GATKException("Could not instantiate class with OutputStream constructor: " + type.getName());
|
||||||
}
|
}
|
||||||
catch( IllegalAccessException ex ) {
|
catch( IllegalAccessException ex ) {
|
||||||
throw new StingException("Could not access class with OutputStream constructor: " + type.getName());
|
throw new GATKException("Could not access class with OutputStream constructor: " + type.getName());
|
||||||
}
|
}
|
||||||
catch( InvocationTargetException ex ) {
|
catch( InvocationTargetException ex ) {
|
||||||
throw new StingException("Could not invoke constructor for class with OutputStream constructor: " + type.getName());
|
throw new GATKException("Could not invoke constructor for class with OutputStream constructor: " + type.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ import org.broadinstitute.sting.commandline.ArgumentTypeDescriptor;
|
||||||
import org.broadinstitute.sting.commandline.ArgumentSource;
|
import org.broadinstitute.sting.commandline.ArgumentSource;
|
||||||
import org.broadinstitute.sting.commandline.ArgumentMatches;
|
import org.broadinstitute.sting.commandline.ArgumentMatches;
|
||||||
import org.broadinstitute.sting.commandline.ParsingEngine;
|
import org.broadinstitute.sting.commandline.ParsingEngine;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
import org.broadinstitute.sting.utils.sam.SAMFileReaderBuilder;
|
import org.broadinstitute.sting.utils.sam.SAMFileReaderBuilder;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||||
|
|
@ -66,7 +67,7 @@ public class SAMFileReaderArgumentTypeDescriptor extends ArgumentTypeDescriptor
|
||||||
String readerFileName = getArgumentValue( createDefaultArgumentDefinition(source), matches );
|
String readerFileName = getArgumentValue( createDefaultArgumentDefinition(source), matches );
|
||||||
|
|
||||||
if( readerFileName == null )
|
if( readerFileName == null )
|
||||||
throw new StingException("SAM file compression was supplied, but no associated writer was supplied with it.");
|
throw new UserError.CommandLineError("SAM file compression was supplied, but no associated writer was supplied with it.");
|
||||||
|
|
||||||
builder.setSAMFile(new File(readerFileName));
|
builder.setSAMFile(new File(readerFileName));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||||
import org.broadinstitute.sting.gatk.io.StingSAMFileWriter;
|
import org.broadinstitute.sting.gatk.io.StingSAMFileWriter;
|
||||||
import net.sf.samtools.SAMFileWriter;
|
import net.sf.samtools.SAMFileWriter;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -94,7 +95,7 @@ public class SAMFileWriterArgumentTypeDescriptor extends ArgumentTypeDescriptor
|
||||||
public Object parse( ParsingEngine parsingEngine, ArgumentSource source, Class type, ArgumentMatches matches ) {
|
public Object parse( ParsingEngine parsingEngine, ArgumentSource source, Class type, ArgumentMatches matches ) {
|
||||||
String writerFileName = getArgumentValue( createBAMArgumentDefinition(source), matches );
|
String writerFileName = getArgumentValue( createBAMArgumentDefinition(source), matches );
|
||||||
if( writerFileName == null )
|
if( writerFileName == null )
|
||||||
throw new StingException("SAM file compression was supplied, but no associated writer was supplied with it.");
|
throw new UserError.CommandLineError("SAM file compression was supplied, but no associated writer was supplied with it.");
|
||||||
|
|
||||||
SAMFileWriterStub stub = new SAMFileWriterStub(engine, new File(writerFileName));
|
SAMFileWriterStub stub = new SAMFileWriterStub(engine, new File(writerFileName));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ import java.io.OutputStream;
|
||||||
import org.broadinstitute.sting.gatk.io.OutputTracker;
|
import org.broadinstitute.sting.gatk.io.OutputTracker;
|
||||||
import org.broadinstitute.sting.gatk.io.StingSAMFileWriter;
|
import org.broadinstitute.sting.gatk.io.StingSAMFileWriter;
|
||||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -150,7 +151,7 @@ public class SAMFileWriterStub implements Stub<SAMFileWriter>, StingSAMFileWrite
|
||||||
*/
|
*/
|
||||||
public void setCompressionLevel( Integer compressionLevel ) {
|
public void setCompressionLevel( Integer compressionLevel ) {
|
||||||
if(writeStarted)
|
if(writeStarted)
|
||||||
throw new StingException("User attempted to change the compression level of a file with alignments already in it.");
|
throw new GATKException("Attempted to change the compression level of a file with alignments already in it.");
|
||||||
this.compressionLevel = compressionLevel;
|
this.compressionLevel = compressionLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -168,7 +169,7 @@ public class SAMFileWriterStub implements Stub<SAMFileWriter>, StingSAMFileWrite
|
||||||
*/
|
*/
|
||||||
public void setPresorted(boolean presorted) {
|
public void setPresorted(boolean presorted) {
|
||||||
if(writeStarted)
|
if(writeStarted)
|
||||||
throw new StingException("User attempted to change the presorted state of a file with alignments already in it.");
|
throw new GATKException("Attempted to change the presorted state of a file with alignments already in it.");
|
||||||
this.presorted = presorted;
|
this.presorted = presorted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -186,7 +187,7 @@ public class SAMFileWriterStub implements Stub<SAMFileWriter>, StingSAMFileWrite
|
||||||
*/
|
*/
|
||||||
public void setMaxRecordsInRam(int maxRecordsInRam) {
|
public void setMaxRecordsInRam(int maxRecordsInRam) {
|
||||||
if(writeStarted)
|
if(writeStarted)
|
||||||
throw new StingException("User attempted to change the max records in RAM of a file with alignments already in it.");
|
throw new GATKException("Attempted to change the max records in RAM of a file with alignments already in it.");
|
||||||
this.maxRecordsInRam = maxRecordsInRam;
|
this.maxRecordsInRam = maxRecordsInRam;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -204,7 +205,7 @@ public class SAMFileWriterStub implements Stub<SAMFileWriter>, StingSAMFileWrite
|
||||||
*/
|
*/
|
||||||
public void writeHeader(SAMFileHeader header) {
|
public void writeHeader(SAMFileHeader header) {
|
||||||
if(writeStarted)
|
if(writeStarted)
|
||||||
throw new StingException("User attempted to change the header of a file with alignments already in it.");
|
throw new GATKException("Attempted to change the header of a file with alignments already in it.");
|
||||||
this.headerOverride = header;
|
this.headerOverride = header;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ import java.util.LinkedList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -67,7 +68,7 @@ public class BufferingReadIterator implements CloseableIterator<SAMRecord> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove() {
|
public void remove() {
|
||||||
throw new StingException("Unable to remove from a BufferingReadIterator");
|
throw new GATKException("Unable to remove from a BufferingReadIterator");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import org.broadinstitute.sting.gatk.CommandLineGATK;
|
||||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||||
import org.broadinstitute.sting.gatk.arguments.GATKArgumentCollection;
|
import org.broadinstitute.sting.gatk.arguments.GATKArgumentCollection;
|
||||||
import org.broadinstitute.sting.gatk.walkers.Walker;
|
import org.broadinstitute.sting.gatk.walkers.Walker;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
import org.broadinstitute.sting.utils.Utils;
|
||||||
import org.simpleframework.xml.Element;
|
import org.simpleframework.xml.Element;
|
||||||
|
|
@ -241,7 +242,7 @@ public class GATKRunReport {
|
||||||
serializer.write(this, stream);
|
serializer.write(this, stream);
|
||||||
//throw new StingException("test");
|
//throw new StingException("test");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new StingException("Failed to marshal the data to the file " + stream, e);
|
throw new GATKException("Failed to marshal the data to the file " + stream, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.broadinstitute.sting.gatk.refdata;
|
package org.broadinstitute.sting.gatk.refdata;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
|
|
@ -29,7 +30,7 @@ public class IntervalRod extends BasicReferenceOrderedDatum {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String repl() {
|
public String repl() {
|
||||||
throw new StingException("repl() is not implemented yet");
|
throw new GATKException("repl() is not implemented yet");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toSimpleString() { return loc.toString(); }
|
public String toSimpleString() { return loc.toString(); }
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package org.broadinstitute.sting.gatk.refdata;
|
package org.broadinstitute.sting.gatk.refdata;
|
||||||
|
|
||||||
import org.broad.tribble.util.variantcontext.Allele;
|
import org.broad.tribble.util.variantcontext.Allele;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
@ -65,7 +66,7 @@ public class PlinkRod extends BasicReferenceOrderedDatum implements Iterator<Pli
|
||||||
try {
|
try {
|
||||||
plink.initialize(file);
|
plink.initialize(file);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
throw new StingException("Unable to find file " + file);
|
throw new GATKException("Unable to find file " + file);
|
||||||
}
|
}
|
||||||
return plink;
|
return plink;
|
||||||
}
|
}
|
||||||
|
|
@ -188,9 +189,9 @@ public class PlinkRod extends BasicReferenceOrderedDatum implements Iterator<Pli
|
||||||
return seqVars;
|
return seqVars;
|
||||||
|
|
||||||
} catch ( FileNotFoundException e ) {
|
} catch ( FileNotFoundException e ) {
|
||||||
throw new StingException("File "+file.getAbsolutePath()+" could not be found. This was checked earlier. Should never happen.",e);
|
throw new GATKException("File "+file.getAbsolutePath()+" could not be found. This was checked earlier. Should never happen.",e);
|
||||||
} catch ( IOException e ) {
|
} catch ( IOException e ) {
|
||||||
throw new StingException("Error reading file "+file.getAbsolutePath()+".",e);
|
throw new GATKException("Error reading file "+file.getAbsolutePath()+".",e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -200,7 +201,7 @@ public class PlinkRod extends BasicReferenceOrderedDatum implements Iterator<Pli
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( plinkFileType != PlinkFileType.STANDARD_PED )
|
if ( plinkFileType != PlinkFileType.STANDARD_PED )
|
||||||
throw new StingException("Plink file is likely of .raw or recoded format. Please use an uncoded .ped file.");
|
throw new GATKException("Plink file is likely of .raw or recoded format. Please use an uncoded .ped file.");
|
||||||
|
|
||||||
StringTokenizer st = new StringTokenizer(plinkLine, "\t");
|
StringTokenizer st = new StringTokenizer(plinkLine, "\t");
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
@ -224,7 +225,7 @@ public class PlinkRod extends BasicReferenceOrderedDatum implements Iterator<Pli
|
||||||
// if the first line is not a comment (what we're used to seeing),
|
// if the first line is not a comment (what we're used to seeing),
|
||||||
// then it's the raw header (comes from de-binary-ing a .bed file)
|
// then it's the raw header (comes from de-binary-ing a .bed file)
|
||||||
if ( !header.startsWith("#") )
|
if ( !header.startsWith("#") )
|
||||||
throw new StingException("Plink file is likely of .raw or recoded format. Please use an uncoded .ped file.");
|
throw new GATKException("Plink file is likely of .raw or recoded format. Please use an uncoded .ped file.");
|
||||||
|
|
||||||
plinkFileType = PlinkFileType.STANDARD_PED;
|
plinkFileType = PlinkFileType.STANDARD_PED;
|
||||||
|
|
||||||
|
|
@ -281,7 +282,7 @@ public class PlinkRod extends BasicReferenceOrderedDatum implements Iterator<Pli
|
||||||
try {
|
try {
|
||||||
reader = new BufferedReader( new FileReader( bimFile ));
|
reader = new BufferedReader( new FileReader( bimFile ));
|
||||||
} catch ( FileNotFoundException e) {
|
} catch ( FileNotFoundException e) {
|
||||||
throw new StingException("The SNP information file accompanying the binary ped file was not found (the .bim file). "+
|
throw new GATKException("The SNP information file accompanying the binary ped file was not found (the .bim file). "+
|
||||||
"Please ensure that it is in the same directory as the .bed and .fam files. The file we "+
|
"Please ensure that it is in the same directory as the .bed and .fam files. The file we "+
|
||||||
"Were looking for was "+bimFile.getAbsolutePath(),e);
|
"Were looking for was "+bimFile.getAbsolutePath(),e);
|
||||||
}
|
}
|
||||||
|
|
@ -300,7 +301,7 @@ public class PlinkRod extends BasicReferenceOrderedDatum implements Iterator<Pli
|
||||||
line = reader.readLine();
|
line = reader.readLine();
|
||||||
}
|
}
|
||||||
} catch ( IOException e ) {
|
} catch ( IOException e ) {
|
||||||
throw new StingException("There was an error reading the .bim file "+bimFile.getAbsolutePath(), e);
|
throw new GATKException("There was an error reading the .bim file "+bimFile.getAbsolutePath(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return variants;
|
return variants;
|
||||||
|
|
@ -311,7 +312,7 @@ public class PlinkRod extends BasicReferenceOrderedDatum implements Iterator<Pli
|
||||||
try {
|
try {
|
||||||
reader = new BufferedReader( new FileReader( famFile ));
|
reader = new BufferedReader( new FileReader( famFile ));
|
||||||
} catch ( FileNotFoundException e) {
|
} catch ( FileNotFoundException e) {
|
||||||
throw new StingException("The Family information file accompanying the binary ped file was not found (the .fam file). "+
|
throw new GATKException("The Family information file accompanying the binary ped file was not found (the .fam file). "+
|
||||||
"Please ensure that it is in the same directory as the .bed and .bim files. The file we "+
|
"Please ensure that it is in the same directory as the .bed and .bim files. The file we "+
|
||||||
"Were looking for was "+famFile.getAbsolutePath(),e);
|
"Were looking for was "+famFile.getAbsolutePath(),e);
|
||||||
}
|
}
|
||||||
|
|
@ -327,7 +328,7 @@ public class PlinkRod extends BasicReferenceOrderedDatum implements Iterator<Pli
|
||||||
}
|
}
|
||||||
} while ( line != null );
|
} while ( line != null );
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new StingException("There was an error reading the .fam file "+famFile.getAbsolutePath(),e);
|
throw new GATKException("There was an error reading the .fam file "+famFile.getAbsolutePath(),e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return sampleNames;
|
return sampleNames;
|
||||||
|
|
@ -338,7 +339,7 @@ public class PlinkRod extends BasicReferenceOrderedDatum implements Iterator<Pli
|
||||||
try {
|
try {
|
||||||
inStream = new FileInputStream(bedFile);
|
inStream = new FileInputStream(bedFile);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
throw new StingException("The Binary pedigree file file accompanying the family file was not found (the .bed file). "+
|
throw new GATKException("The Binary pedigree file file accompanying the family file was not found (the .bed file). "+
|
||||||
"Please ensure that it is in the same directory as the .bim and .fam files. The file we "+
|
"Please ensure that it is in the same directory as the .bim and .fam files. The file we "+
|
||||||
"Were looking for was "+bedFile.getAbsolutePath(),e);
|
"Were looking for was "+bedFile.getAbsolutePath(),e);
|
||||||
}
|
}
|
||||||
|
|
@ -378,7 +379,7 @@ public class PlinkRod extends BasicReferenceOrderedDatum implements Iterator<Pli
|
||||||
}
|
}
|
||||||
} while ( genotype != -1 );
|
} while ( genotype != -1 );
|
||||||
} catch ( IOException e) {
|
} catch ( IOException e) {
|
||||||
throw new StingException("Error reading binary ped file "+bedFile.getAbsolutePath(), e);
|
throw new GATKException("Error reading binary ped file "+bedFile.getAbsolutePath(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return variants;
|
return variants;
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.gatk.refdata;
|
package org.broadinstitute.sting.gatk.refdata;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
import org.broadinstitute.sting.utils.text.XReadLines;
|
import org.broadinstitute.sting.utils.text.XReadLines;
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
import org.broadinstitute.sting.utils.Utils;
|
||||||
|
|
@ -115,7 +116,7 @@ public class RODRecordIterator<ROD extends ReferenceOrderedDatum> implements Ite
|
||||||
try {
|
try {
|
||||||
reader = new PushbackIterator<String>(new XReadLines(file));
|
reader = new PushbackIterator<String>(new XReadLines(file));
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
Utils.scareUser("Couldn't open file: " + file);
|
throw new UserError.CouldNotReadInputFile(file, e);
|
||||||
}
|
}
|
||||||
this.file = file;
|
this.file = file;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
@ -124,7 +125,7 @@ public class RODRecordIterator<ROD extends ReferenceOrderedDatum> implements Ite
|
||||||
named_constructor = type.getConstructor(String.class);
|
named_constructor = type.getConstructor(String.class);
|
||||||
}
|
}
|
||||||
catch (java.lang.NoSuchMethodException e) {
|
catch (java.lang.NoSuchMethodException e) {
|
||||||
throw new StingException("ROD class "+type.getName()+" does not have constructor that accepts a single String argument (track name)");
|
throw new GATKException("ROD class "+type.getName()+" does not have constructor that accepts a single String argument (track name)");
|
||||||
}
|
}
|
||||||
ROD rod = instantiateROD(name);
|
ROD rod = instantiateROD(name);
|
||||||
fieldDelimiter = rod.delimiterRegex(); // get delimiter from the ROD itself
|
fieldDelimiter = rod.delimiterRegex(); // get delimiter from the ROD itself
|
||||||
|
|
@ -232,11 +233,11 @@ public class RODRecordIterator<ROD extends ReferenceOrderedDatum> implements Ite
|
||||||
try {
|
try {
|
||||||
return (ROD) named_constructor.newInstance(name);
|
return (ROD) named_constructor.newInstance(name);
|
||||||
} catch (java.lang.InstantiationException e) {
|
} catch (java.lang.InstantiationException e) {
|
||||||
throw new StingException("Failed to instantiate ROD object of class "+type.getName());
|
throw new GATKException("Failed to instantiate ROD object of class "+type.getName());
|
||||||
} catch (java.lang.IllegalAccessException e) {
|
} catch (java.lang.IllegalAccessException e) {
|
||||||
throw new StingException("Access violation attempt while instantiating ROD object of class "+type.getName());
|
throw new GATKException("Access violation attempt while instantiating ROD object of class "+type.getName());
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
throw new StingException("InvocationTargetException: Failed to instantiate ROD object of class "+type.getName());
|
throw new GATKException("InvocationTargetException: Failed to instantiate ROD object of class "+type.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package org.broadinstitute.sting.gatk.refdata;
|
||||||
|
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.RODRecordList;
|
import org.broadinstitute.sting.gatk.refdata.utils.RODRecordList;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
|
|
@ -47,10 +48,10 @@ public class RODRecordListImpl extends AbstractList<GATKFeature> implements Comp
|
||||||
records.add(r);
|
records.add(r);
|
||||||
if ( r == null ) continue;
|
if ( r == null ) continue;
|
||||||
if ( ! this.name.equals(r.getName() ) ) {
|
if ( ! this.name.equals(r.getName() ) ) {
|
||||||
throw new StingException("Attempt to add GATKFeature with non-matching name "+r.getName()+" to the track "+name);
|
throw new GATKException("Attempt to add GATKFeature with non-matching name "+r.getName()+" to the track "+name);
|
||||||
}
|
}
|
||||||
if ( location != null && ! location.overlapsP(r.getLocation()) ) {
|
if ( location != null && ! location.overlapsP(r.getLocation()) ) {
|
||||||
throw new StingException("Attempt to add GATKFeature that lies outside of specified interval "+location+"; offending GATKFeature:\n"+r.toString());
|
throw new GATKException("Attempt to add GATKFeature that lies outside of specified interval "+location+"; offending GATKFeature:\n"+r.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -72,7 +73,7 @@ public class RODRecordListImpl extends AbstractList<GATKFeature> implements Comp
|
||||||
public void add(GATKFeature record, boolean allowNameMismatch) {
|
public void add(GATKFeature record, boolean allowNameMismatch) {
|
||||||
if ( record != null ) {
|
if ( record != null ) {
|
||||||
if ( ! allowNameMismatch && ! name.equals(record.getName() ) )
|
if ( ! allowNameMismatch && ! name.equals(record.getName() ) )
|
||||||
throw new StingException("Attempt to add GATKFeature with non-matching name "+record.getName()+" to the track "+name);
|
throw new GATKException("Attempt to add GATKFeature with non-matching name "+record.getName()+" to the track "+name);
|
||||||
}
|
}
|
||||||
records.add(record);
|
records.add(record);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,10 @@ import org.broad.tribble.util.variantcontext.VariantContext;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.RODRecordList;
|
import org.broadinstitute.sting.gatk.refdata.utils.RODRecordList;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
@ -106,8 +108,8 @@ public class RefMetaDataTracker {
|
||||||
|
|
||||||
Object obj = objects.get(0).getUnderlyingObject();
|
Object obj = objects.get(0).getUnderlyingObject();
|
||||||
if (!(clazz.isAssignableFrom(obj.getClass())))
|
if (!(clazz.isAssignableFrom(obj.getClass())))
|
||||||
throw new StingException("Unable to case track named " + name + " to type of " + clazz.toString()
|
throw new UserError.CommandLineError("Unable to case track named " + name + " to type of " + clazz.toString()
|
||||||
+ " it's of type " + obj.getClass());
|
+ " it's of type " + obj.getClass());
|
||||||
|
|
||||||
return (T)obj;
|
return (T)obj;
|
||||||
}
|
}
|
||||||
|
|
@ -289,7 +291,7 @@ public class RefMetaDataTracker {
|
||||||
Collection<VariantContext> contexts = getVariantContexts(ref, name, allowedTypes, curLocation, requireStartHere, false );
|
Collection<VariantContext> contexts = getVariantContexts(ref, name, allowedTypes, curLocation, requireStartHere, false );
|
||||||
|
|
||||||
if ( contexts.size() > 1 )
|
if ( contexts.size() > 1 )
|
||||||
throw new StingException("Requested a single VariantContext object for track " + name + " but multiple variants were present at position " + curLocation);
|
throw new GATKException("Requested a single VariantContext object for track " + name + " but multiple variants were present at position " + curLocation);
|
||||||
else if ( contexts.size() == 0 )
|
else if ( contexts.size() == 0 )
|
||||||
return null;
|
return null;
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import org.broadinstitute.sting.gatk.iterators.PushbackIterator;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.LocationAwareSeekableRODIterator;
|
import org.broadinstitute.sting.gatk.refdata.utils.LocationAwareSeekableRODIterator;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.RODRecordList;
|
import org.broadinstitute.sting.gatk.refdata.utils.RODRecordList;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
@ -131,7 +132,7 @@ public class SeekableRODIterator implements LocationAwareSeekableRODIterator {
|
||||||
*/
|
*/
|
||||||
public RODRecordList next() {
|
public RODRecordList next() {
|
||||||
if ( ! next_is_allowed )
|
if ( ! next_is_allowed )
|
||||||
throw new StingException("Illegal use of iterator: Can not advance iterator with next() after seek-forward query of length > 1");
|
throw new GATKException("Illegal use of iterator: Can not advance iterator with next() after seek-forward query of length > 1");
|
||||||
|
|
||||||
curr_position++;
|
curr_position++;
|
||||||
// curr_query_end = -1;
|
// curr_query_end = -1;
|
||||||
|
|
@ -178,7 +179,7 @@ public class SeekableRODIterator implements LocationAwareSeekableRODIterator {
|
||||||
r = it.next(); // we got here only if we do need next record, time to load it for real
|
r = it.next(); // we got here only if we do need next record, time to load it for real
|
||||||
|
|
||||||
long stop = r.getLocation().getStop();
|
long stop = r.getLocation().getStop();
|
||||||
if ( stop < curr_position ) throw new StingException("DEBUG: encountered contig that should have been loaded earlier"); // this should never happen
|
if ( stop < curr_position ) throw new GATKException("DEBUG: encountered contig that should have been loaded earlier"); // this should never happen
|
||||||
if ( stop > max_position ) max_position = stop; // max_position keeps the rightmost stop position across all loaded records
|
if ( stop > max_position ) max_position = stop; // max_position keeps the rightmost stop position across all loaded records
|
||||||
records.add(r);
|
records.add(r);
|
||||||
}
|
}
|
||||||
|
|
@ -257,14 +258,14 @@ public class SeekableRODIterator implements LocationAwareSeekableRODIterator {
|
||||||
public RODRecordList seekForward(GenomeLoc interval) {
|
public RODRecordList seekForward(GenomeLoc interval) {
|
||||||
|
|
||||||
if ( interval.getContigIndex() < curr_contig )
|
if ( interval.getContigIndex() < curr_contig )
|
||||||
throw new StingException("Out of order query: query contig "+interval.getContig()+" is located before "+
|
throw new GATKException("Out of order query: query contig "+interval.getContig()+" is located before "+
|
||||||
"the iterator's current contig");
|
"the iterator's current contig");
|
||||||
if ( interval.getContigIndex() == curr_contig ) {
|
if ( interval.getContigIndex() == curr_contig ) {
|
||||||
if ( interval.getStart() < curr_position )
|
if ( interval.getStart() < curr_position )
|
||||||
throw new StingException("Out of order query: query position "+interval +" is located before "+
|
throw new GATKException("Out of order query: query position "+interval +" is located before "+
|
||||||
"the iterator's current position "+curr_contig + ":" + curr_position);
|
"the iterator's current position "+curr_contig + ":" + curr_position);
|
||||||
if ( interval.getStop() < curr_query_end )
|
if ( interval.getStop() < curr_query_end )
|
||||||
throw new StingException("Unsupported querying sequence: current query interval " +
|
throw new GATKException("Unsupported querying sequence: current query interval " +
|
||||||
interval+" ends before the end of previous query interval ("+curr_query_end+")");
|
interval+" ends before the end of previous query interval ("+curr_query_end+")");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import org.broad.tribble.Feature;
|
||||||
import org.broadinstitute.sting.gatk.refdata.Transcript;
|
import org.broadinstitute.sting.gatk.refdata.Transcript;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.RODRecordList;
|
import org.broadinstitute.sting.gatk.refdata.utils.RODRecordList;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
@ -60,7 +61,7 @@ public class RefSeqFeature implements Transcript, Feature {
|
||||||
|
|
||||||
/** Genomic location of the n-th exon; throws an exception if n is out of bounds */
|
/** Genomic location of the n-th exon; throws an exception if n is out of bounds */
|
||||||
public GenomeLoc getExonLocation(int n) {
|
public GenomeLoc getExonLocation(int n) {
|
||||||
if ( n >= exons.size() || n < 0 ) throw new StingException("Index out-of-bounds. Transcript has " + exons.size() +" exons; requested: "+n);
|
if ( n >= exons.size() || n < 0 ) throw new GATKException("Index out-of-bounds. Transcript has " + exons.size() +" exons; requested: "+n);
|
||||||
return exons.get(n);
|
return exons.get(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,10 @@ package org.broadinstitute.sting.gatk.refdata.tracks;
|
||||||
import org.broadinstitute.sting.gatk.refdata.tracks.builders.RMDTrackBuilder;
|
import org.broadinstitute.sting.gatk.refdata.tracks.builders.RMDTrackBuilder;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.RMDTriplet;
|
import org.broadinstitute.sting.gatk.refdata.utils.RMDTriplet;
|
||||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.classloader.PluginManager;
|
import org.broadinstitute.sting.utils.classloader.PluginManager;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -175,7 +177,7 @@ public class RMDTrackManager extends PluginManager<RMDTrackBuilder> {
|
||||||
// create instances of each of the requested types
|
// create instances of each of the requested types
|
||||||
for (RMDTriplet trip : inputs) {
|
for (RMDTriplet trip : inputs) {
|
||||||
RMDTrackBuilder b = availableTrackBuilders.get(trip.getType().toUpperCase());
|
RMDTrackBuilder b = availableTrackBuilders.get(trip.getType().toUpperCase());
|
||||||
if (b == null) throw new StingException("Unable to find track for " + trip.getType());
|
if (b == null) throw new UserError.CommandLineError("Unable to find track for " + trip.getType());
|
||||||
tracks.add(b.createInstanceOfTrack(availableTrackTypes.get(trip.getType().toUpperCase()), trip.getName(), new File(trip.getFile())));
|
tracks.add(b.createInstanceOfTrack(availableTrackTypes.get(trip.getType().toUpperCase()), trip.getName(), new File(trip.getFile())));
|
||||||
}
|
}
|
||||||
return tracks;
|
return tracks;
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import org.broad.tribble.FeatureSource;
|
||||||
import org.broad.tribble.source.BasicFeatureSource;
|
import org.broad.tribble.source.BasicFeatureSource;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.FeatureToGATKFeatureIterator;
|
import org.broadinstitute.sting.gatk.refdata.utils.FeatureToGATKFeatureIterator;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
|
|
@ -115,7 +116,7 @@ public class TribbleTrack extends RMDTrack implements QueryableTrack {
|
||||||
try {
|
try {
|
||||||
reader.close();
|
reader.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new StingException("Unable to close reader " + reader.toString(),e);
|
throw new GATKException("Unable to close reader " + reader.toString(),e);
|
||||||
}
|
}
|
||||||
reader = null;
|
reader = null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ import org.broad.tribble.util.LittleEndianOutputStream;
|
||||||
import org.broadinstitute.sting.gatk.refdata.tracks.TribbleTrack;
|
import org.broadinstitute.sting.gatk.refdata.tracks.TribbleTrack;
|
||||||
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrack;
|
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrack;
|
||||||
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrackCreationException;
|
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrackCreationException;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.collections.Pair;
|
import org.broadinstitute.sting.utils.collections.Pair;
|
||||||
import org.broadinstitute.sting.utils.classloader.PluginManager;
|
import org.broadinstitute.sting.utils.classloader.PluginManager;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
@ -230,7 +231,7 @@ public class TribbleRMDTrackBuilder extends PluginManager<FeatureCodec> implemen
|
||||||
locked = lock.sharedLock();
|
locked = lock.sharedLock();
|
||||||
}
|
}
|
||||||
catch(FileSystemInabilityToLockException ex) {
|
catch(FileSystemInabilityToLockException ex) {
|
||||||
throw new StingException("Unexpected inability to lock exception", ex);
|
throw new GATKException("Unexpected inability to lock exception", ex);
|
||||||
}
|
}
|
||||||
Index idx;
|
Index idx;
|
||||||
try {
|
try {
|
||||||
|
|
@ -297,7 +298,7 @@ public class TribbleRMDTrackBuilder extends PluginManager<FeatureCodec> implemen
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
catch(FileSystemInabilityToLockException ex) {
|
catch(FileSystemInabilityToLockException ex) {
|
||||||
throw new StingException("Unexpected inability to lock exception", ex);
|
throw new GATKException("Unexpected inability to lock exception", ex);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if (locked) lock.unlock();
|
if (locked) lock.unlock();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.broadinstitute.sting.gatk.walkers.analyzeannotations;
|
package org.broadinstitute.sting.gatk.walkers.analyzeannotations;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
@ -114,7 +115,7 @@ public class AnnotationDatum implements Comparator<AnnotationDatum> {
|
||||||
final public float calcTiTv( final int INDEX ) {
|
final public float calcTiTv( final int INDEX ) {
|
||||||
|
|
||||||
if( ti[INDEX] < 0 || tv[INDEX] < 0 ) {
|
if( ti[INDEX] < 0 || tv[INDEX] < 0 ) {
|
||||||
throw new StingException( "Integer overflow detected! There are too many variants piled up in one annotation bin." );
|
throw new GATKException( "Integer overflow detected! There are too many variants piled up in one annotation bin." );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( tv[INDEX] == 0 ) { // Don't divide by zero
|
if( tv[INDEX] == 0 ) { // Don't divide by zero
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,7 @@ public class HaplotypeScore implements InfoFieldAnnotation, StandardAnnotation {
|
||||||
String b = haplotypeB.toString();
|
String b = haplotypeB.toString();
|
||||||
|
|
||||||
if (a.length() != b.length())
|
if (a.length() != b.length())
|
||||||
throw new StingException("Haplotypes a and b must be of same length");
|
throw new GATKException("Haplotypes a and b must be of same length");
|
||||||
|
|
||||||
char chA, chB;
|
char chA, chB;
|
||||||
char wc = REGEXP_WILDCARD.charAt(0);
|
char wc = REGEXP_WILDCARD.charAt(0);
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.helpers.DbSNPHelper;
|
import org.broadinstitute.sting.gatk.refdata.utils.helpers.DbSNPHelper;
|
||||||
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*;
|
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*;
|
||||||
import org.broadinstitute.sting.gatk.walkers.annotator.genomicannotator.*;
|
import org.broadinstitute.sting.gatk.walkers.annotator.genomicannotator.*;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.utils.classloader.PackageUtils;
|
import org.broadinstitute.sting.utils.classloader.PackageUtils;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
|
|
@ -168,7 +169,7 @@ public class VariantAnnotatorEngine {
|
||||||
Collection<VariantContext> results = this.annotateContext(tracker, ref, EMPTY_STRATIFIED_ALIGNMENT_CONTEXT, vc);
|
Collection<VariantContext> results = this.annotateContext(tracker, ref, EMPTY_STRATIFIED_ALIGNMENT_CONTEXT, vc);
|
||||||
|
|
||||||
if ( results.size() != 1 )
|
if ( results.size() != 1 )
|
||||||
throw new StingException("BUG: annotateContext call requires 1 resulting annotated VC, but got " + results);
|
throw new GATKException("BUG: annotateContext call requires 1 resulting annotated VC, but got " + results);
|
||||||
|
|
||||||
return results.iterator().next();
|
return results.iterator().next();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
|
|
||||||
|
|
@ -83,7 +84,7 @@ public class JoinTable
|
||||||
*/
|
*/
|
||||||
public void parseFromFile(String filename, String localBindingName, String localColumnName, String externalBindingName, String externalColumnName) {
|
public void parseFromFile(String filename, String localBindingName, String localColumnName, String externalBindingName, String externalColumnName) {
|
||||||
if(parsedFromFile) {
|
if(parsedFromFile) {
|
||||||
throw new StingException("parseFromFile(" + filename +", ..) called more than once");
|
throw new GATKException("parseFromFile(" + filename +", ..) called more than once");
|
||||||
}
|
}
|
||||||
parsedFromFile = true;
|
parsedFromFile = true;
|
||||||
|
|
||||||
|
|
@ -135,7 +136,7 @@ public class JoinTable
|
||||||
br.close();
|
br.close();
|
||||||
}
|
}
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
throw new StingException("Unable to close file: " + filename, e);
|
throw new GATKException("Unable to close file: " + filename, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
import org.broadinstitute.sting.utils.Utils;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserError;
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
|
|
@ -63,7 +64,7 @@ public class JoinTableParser
|
||||||
public List<String> readHeader(BufferedReader br) throws IOException
|
public List<String> readHeader(BufferedReader br) throws IOException
|
||||||
{
|
{
|
||||||
if(header != null) {
|
if(header != null) {
|
||||||
throw new StingException("readHeader(..) called more than once. Header is currently set to: " + header);
|
throw new GATKException("readHeader(..) called more than once. Header is currently set to: " + header);
|
||||||
}
|
}
|
||||||
|
|
||||||
header = Collections.unmodifiableList(parseHeader(br));
|
header = Collections.unmodifiableList(parseHeader(br));
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,9 @@ import org.broadinstitute.sting.gatk.walkers.Requires;
|
||||||
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
||||||
import org.broadinstitute.sting.gatk.walkers.Window;
|
import org.broadinstitute.sting.gatk.walkers.Window;
|
||||||
import org.broadinstitute.sting.utils.BaseUtils;
|
import org.broadinstitute.sting.utils.BaseUtils;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -173,12 +175,12 @@ public class TranscriptToGenomicInfo extends RodWalker<Integer, Integer> {
|
||||||
try {
|
try {
|
||||||
header = AnnotatorInputTableCodec.readHeader(transcriptsDataSource.getReferenceOrderedData().getFile());
|
header = AnnotatorInputTableCodec.readHeader(transcriptsDataSource.getReferenceOrderedData().getFile());
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
throw new StingException("Failed when attempting to read header from file: " + transcriptsDataSource.getReferenceOrderedData().getFile(), e);
|
throw new UserError.MalformedFile(transcriptsDataSource.getReferenceOrderedData().getFile(), "Failed when attempting to read header from file", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( String columnName : GENE_NAME_COLUMNS ) {
|
for ( String columnName : GENE_NAME_COLUMNS ) {
|
||||||
if ( !header.contains(columnName) )
|
if ( !header.contains(columnName) )
|
||||||
throw new StingException("The column name '" + columnName + "' provided to -n doesn't match any of the column names in: " + transcriptsDataSource.getReferenceOrderedData().getFile());
|
throw new UserError.CommandLineError("The column name '" + columnName + "' provided to -n doesn't match any of the column names in: " + transcriptsDataSource.getReferenceOrderedData().getFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
//init outputColumnNames list
|
//init outputColumnNames list
|
||||||
|
|
@ -973,7 +975,7 @@ public class TranscriptToGenomicInfo extends RodWalker<Integer, Integer> {
|
||||||
*/
|
*/
|
||||||
public int computeInitialCodingCoord() {
|
public int computeInitialCodingCoord() {
|
||||||
if(!isProteinCodingTranscript()) {
|
if(!isProteinCodingTranscript()) {
|
||||||
throw new StingException("This method should only be called for protein-coding transcripts");
|
throw new GATKException("This method should only be called for protein-coding transcripts");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(positiveStrand)
|
if(positiveStrand)
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
||||||
import org.broadinstitute.sting.gatk.walkers.TreeReducible;
|
import org.broadinstitute.sting.gatk.walkers.TreeReducible;
|
||||||
import org.broadinstitute.sting.gatk.walkers.Window;
|
import org.broadinstitute.sting.gatk.walkers.Window;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -70,7 +71,7 @@ public class TranscriptToInfo extends RodWalker<Integer, Integer> implements Tre
|
||||||
private String[] GENE_NAME_COLUMNS = {};
|
private String[] GENE_NAME_COLUMNS = {};
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
throw new StingException("This walker is no longer supported. We are actively working on a bug-free replacement. We thank you for your patience at this time.");
|
throw new UserError.MissingWalker("TranscriptToInfo", "This walker is no longer supported. We are actively working on a bug-free replacement. We thank you for your patience at this time.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer reduceInit() { return 0; }
|
public Integer reduceInit() { return 0; }
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ import org.broadinstitute.sting.gatk.walkers.By;
|
||||||
import org.broadinstitute.sting.gatk.walkers.DataSource;
|
import org.broadinstitute.sting.gatk.walkers.DataSource;
|
||||||
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
|
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
|
||||||
import org.broadinstitute.sting.utils.*;
|
import org.broadinstitute.sting.utils.*;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.commandline.Output;
|
import org.broadinstitute.sting.commandline.Output;
|
||||||
|
|
@ -91,7 +92,7 @@ public class CallableLociWalker extends LocusWalker<CallableLociWalker.CallableB
|
||||||
PrintStream summaryOut = new PrintStream(summaryFile);
|
PrintStream summaryOut = new PrintStream(summaryFile);
|
||||||
summaryOut.close();
|
summaryOut.close();
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
throw new StingException("Cannot write to summary file " + summaryFile);
|
throw new UserError.CouldNotCreateOutputFile(summaryFile, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -219,7 +220,7 @@ public class CallableLociWalker extends LocusWalker<CallableLociWalker.CallableB
|
||||||
|
|
||||||
summaryOut.close();
|
summaryOut.close();
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
throw new StingException(e.getMessage());
|
throw new UserError.CouldNotCreateOutputFile(summaryFile, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.commandline.Output;
|
import org.broadinstitute.sting.commandline.Output;
|
||||||
import org.broad.tribble.bed.FullBEDFeature;
|
import org.broad.tribble.bed.FullBEDFeature;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
|
@ -94,7 +95,7 @@ public class CompareCallableLociWalker extends RodWalker<List<CallableLociWalker
|
||||||
//System.out.printf("tracker %s%n", tracker);
|
//System.out.printf("tracker %s%n", tracker);
|
||||||
List<Object> bindings = tracker.getReferenceMetaData(track);
|
List<Object> bindings = tracker.getReferenceMetaData(track);
|
||||||
if ( bindings.size() != 1 || ! (bindings.get(0) instanceof FullBEDFeature)) {
|
if ( bindings.size() != 1 || ! (bindings.get(0) instanceof FullBEDFeature)) {
|
||||||
throw new StingException(String.format("%s track isn't a properly formated CallableBases object!", track));
|
throw new UserError.MalformedFile(String.format("%s track isn't a properly formated CallableBases object!", track));
|
||||||
}
|
}
|
||||||
|
|
||||||
FullBEDFeature bed = (FullBEDFeature)bindings.get(0);
|
FullBEDFeature bed = (FullBEDFeature)bindings.get(0);
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,9 @@ import net.sf.samtools.SAMReadGroupRecord;
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||||
import org.broadinstitute.sting.utils.BaseUtils;
|
import org.broadinstitute.sting.utils.BaseUtils;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -56,7 +58,7 @@ public class CoverageUtils {
|
||||||
} else if ( type == DoCOutputType.Partition.sample_by_platform_by_center ) {
|
} else if ( type == DoCOutputType.Partition.sample_by_platform_by_center ) {
|
||||||
return String.format("%s_pl_%s_cn_%s",r.getSample(),r.getPlatform(),r.getSequencingCenter());
|
return String.format("%s_pl_%s_cn_%s",r.getSample(),r.getPlatform(),r.getSequencingCenter());
|
||||||
} else {
|
} else {
|
||||||
throw new StingException("Invalid type ID sent to getTypeID. This is a BUG!");
|
throw new GATKException("Invalid type ID sent to getTypeID. This is a BUG!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -118,7 +120,7 @@ public class CoverageUtils {
|
||||||
try {
|
try {
|
||||||
counts[BaseUtils.simpleBaseToBaseIndex(e.getBase())]++;
|
counts[BaseUtils.simpleBaseToBaseIndex(e.getBase())]++;
|
||||||
} catch (ArrayIndexOutOfBoundsException exc) {
|
} catch (ArrayIndexOutOfBoundsException exc) {
|
||||||
throw new StingException("Expected a simple base, but actually received"+(char)e.getBase());
|
throw new GATKException("Expected a simple base, but actually received"+(char)e.getBase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -126,10 +128,8 @@ public class CoverageUtils {
|
||||||
private static SAMReadGroupRecord getReadGroup(SAMRecord r) {
|
private static SAMReadGroupRecord getReadGroup(SAMRecord r) {
|
||||||
SAMReadGroupRecord rg = r.getReadGroup();
|
SAMReadGroupRecord rg = r.getReadGroup();
|
||||||
if ( rg == null ) {
|
if ( rg == null ) {
|
||||||
String msg = "Read "+r.getReadName()+" lacks read group information.";
|
String msg = "Read "+r.getReadName()+" lacks read group information; Please associate all reads with read groups";
|
||||||
msg += " Please associate all reads with read groups [recommended]\n";
|
throw new UserError.MalformedBam(r, msg);
|
||||||
msg += " Or run with -rf MissingReadGroup [not recommended]";
|
|
||||||
throw new StingException(msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return rg;
|
return rg;
|
||||||
|
|
|
||||||
|
|
@ -36,13 +36,11 @@ import org.broadinstitute.sting.gatk.refdata.features.refseq.RefSeqFeature;
|
||||||
import org.broadinstitute.sting.gatk.refdata.tracks.builders.TribbleRMDTrackBuilder;
|
import org.broadinstitute.sting.gatk.refdata.tracks.builders.TribbleRMDTrackBuilder;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.*;
|
import org.broadinstitute.sting.gatk.refdata.utils.*;
|
||||||
import org.broadinstitute.sting.gatk.walkers.*;
|
import org.broadinstitute.sting.gatk.walkers.*;
|
||||||
import org.broadinstitute.sting.utils.BaseUtils;
|
import org.broadinstitute.sting.utils.*;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
|
||||||
import org.broadinstitute.sting.utils.collections.Pair;
|
import org.broadinstitute.sting.utils.collections.Pair;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.commandline.Output;
|
import org.broadinstitute.sting.commandline.Output;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
@ -227,7 +225,7 @@ public class DepthOfCoverageWalker extends LocusWalker<Map<DoCOutputType.Partiti
|
||||||
partition.add(String.format("%s_pl_%s_cn_%s",rg.getSample(),rg.getPlatform(),rg.getSequencingCenter()));
|
partition.add(String.format("%s_pl_%s_cn_%s",rg.getSample(),rg.getPlatform(),rg.getSequencingCenter()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new StingException("Invalid aggregation type sent to getSamplesFromToolKit");
|
throw new GATKException("Invalid aggregation type sent to getSamplesFromToolKit");
|
||||||
}
|
}
|
||||||
|
|
||||||
return partition;
|
return partition;
|
||||||
|
|
@ -290,7 +288,7 @@ public class DepthOfCoverageWalker extends LocusWalker<Map<DoCOutputType.Partiti
|
||||||
getCorrectStream(partition, DoCOutputType.Aggregation.interval, DoCOutputType.FileType.statistics),
|
getCorrectStream(partition, DoCOutputType.Aggregation.interval, DoCOutputType.FileType.statistics),
|
||||||
partition);
|
partition);
|
||||||
} else {
|
} else {
|
||||||
throw new StingException("Partition type "+partition.toString()+" had no entries. Please check that your .bam header has all appropriate partition types.");
|
throw new GATKException("Partition type "+partition.toString()+" had no entries. Please check that your .bam header has all appropriate partition types.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -405,7 +403,7 @@ public class DepthOfCoverageWalker extends LocusWalker<Map<DoCOutputType.Partiti
|
||||||
try {
|
try {
|
||||||
return new SeekableRODIterator(new FeatureToGATKFeatureIterator(refseq.iterator(),"refseq"));
|
return new SeekableRODIterator(new FeatureToGATKFeatureIterator(refseq.iterator(),"refseq"));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new StingException("Unable to open file " + refSeqGeneList, e);
|
throw new UserError.CouldNotReadInputFile(refSeqGeneList, "Unable to open file", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -615,7 +613,7 @@ public class DepthOfCoverageWalker extends LocusWalker<Map<DoCOutputType.Partiti
|
||||||
private PrintStream getCorrectStream(DoCOutputType.Partition partition, DoCOutputType.Aggregation aggregation, DoCOutputType.FileType fileType) {
|
private PrintStream getCorrectStream(DoCOutputType.Partition partition, DoCOutputType.Aggregation aggregation, DoCOutputType.FileType fileType) {
|
||||||
DoCOutputType outputType = new DoCOutputType(partition,aggregation,fileType);
|
DoCOutputType outputType = new DoCOutputType(partition,aggregation,fileType);
|
||||||
if(!out.containsKey(outputType))
|
if(!out.containsKey(outputType))
|
||||||
throw new StingException(String.format("Unable to find appropriate stream for partition = %s, aggregation = %s, file type = %s",partition,aggregation,fileType));
|
throw new UserError.CommandLineError(String.format("Unable to find appropriate stream for partition = %s, aggregation = %s, file type = %s",partition,aggregation,fileType));
|
||||||
return out.get(outputType);
|
return out.get(outputType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -767,7 +765,7 @@ public class DepthOfCoverageWalker extends LocusWalker<Map<DoCOutputType.Partiti
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for ( String s : namesInAg ) {
|
for ( String s : namesInAg ) {
|
||||||
if ( ! s.equalsIgnoreCase(order.get(index)) ) {
|
if ( ! s.equalsIgnoreCase(order.get(index)) ) {
|
||||||
throw new StingException("IDs are out of order for type "+t+"! Aggregator has different ordering");
|
throw new GATKException("IDs are out of order for type "+t+"! Aggregator has different ordering");
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
@ -776,7 +774,7 @@ public class DepthOfCoverageWalker extends LocusWalker<Map<DoCOutputType.Partiti
|
||||||
|
|
||||||
public boolean checkType(DepthOfCoverageStats stats, DoCOutputType.Partition type ) {
|
public boolean checkType(DepthOfCoverageStats stats, DoCOutputType.Partition type ) {
|
||||||
if ( stats.getHistograms().size() < 1 ) {
|
if ( stats.getHistograms().size() < 1 ) {
|
||||||
Utils.warnUser("The histogram per partition type "+type.toString()+" was empty\n"+
|
logger.warn("The histogram per partition type "+type.toString()+" was empty\n"+
|
||||||
"Do your read groups have this type? (Check your .bam header).");
|
"Do your read groups have this type? (Check your .bam header).");
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.broadinstitute.sting.gatk.walkers.fasta;
|
package org.broadinstitute.sting.gatk.walkers.fasta;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
|
@ -23,7 +24,7 @@ public class FastaSequence {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
if ( printedHeader ) throw new StingException("Can not set name for FASTA record: header is already printed.");
|
if ( printedHeader ) throw new GATKException("Can not set name for FASTA record: header is already printed.");
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.gatk.walkers.filters;
|
package org.broadinstitute.sting.gatk.walkers.filters;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -80,9 +81,9 @@ public class FiltrationContextWindow {
|
||||||
*/
|
*/
|
||||||
public FiltrationContext[] getWindow(int elementsToLeft, int elementsToRight) {
|
public FiltrationContext[] getWindow(int elementsToLeft, int elementsToRight) {
|
||||||
if ( elementsToLeft > maxWindowElements() || elementsToRight > maxWindowElements() )
|
if ( elementsToLeft > maxWindowElements() || elementsToRight > maxWindowElements() )
|
||||||
throw new StingException("Too large a window requested");
|
throw new GATKException("Too large a window requested");
|
||||||
if ( elementsToLeft < 0 || elementsToRight < 0 )
|
if ( elementsToLeft < 0 || elementsToRight < 0 )
|
||||||
throw new StingException("Window size cannot be negative");
|
throw new GATKException("Window size cannot be negative");
|
||||||
|
|
||||||
FiltrationContext[] array = new FiltrationContext[elementsToLeft + elementsToRight + 1];
|
FiltrationContext[] array = new FiltrationContext[elementsToLeft + elementsToRight + 1];
|
||||||
ListIterator<FiltrationContext> iter = window.listIterator(currentContext - elementsToLeft);
|
ListIterator<FiltrationContext> iter = window.listIterator(currentContext - elementsToLeft);
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@ public class DiploidGenotypeCalculationModel extends JointEstimateGenotypeCalcul
|
||||||
|
|
||||||
public void incrementFrequency() {
|
public void incrementFrequency() {
|
||||||
if ( frequency == 2 * N )
|
if ( frequency == 2 * N )
|
||||||
throw new StingException("Frequency was incremented past N; how is this possible?");
|
throw new GATKException("Frequency was incremented past N; how is this possible?");
|
||||||
frequency++;
|
frequency++;
|
||||||
|
|
||||||
double greedy = VALUE_NOT_CALCULATED;
|
double greedy = VALUE_NOT_CALCULATED;
|
||||||
|
|
@ -218,7 +218,7 @@ public class DiploidGenotypeCalculationModel extends JointEstimateGenotypeCalcul
|
||||||
// so we can ignore that case
|
// so we can ignore that case
|
||||||
}
|
}
|
||||||
if ( greedyIndex == -1 )
|
if ( greedyIndex == -1 )
|
||||||
throw new StingException("There is no best choice for a new alternate allele; how is this possible?");
|
throw new GATKException("There is no best choice for a new alternate allele; how is this possible?");
|
||||||
|
|
||||||
if ( indexes[greedyIndex] == GenotypeType.HET.ordinal() )
|
if ( indexes[greedyIndex] == GenotypeType.HET.ordinal() )
|
||||||
indexes[greedyIndex] = GenotypeType.HOM.ordinal();
|
indexes[greedyIndex] = GenotypeType.HOM.ordinal();
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ public class SimpleIndelCalculationModel extends GenotypeCalculationModel {
|
||||||
alleles.add( Allele.create(bestEvent.substring(1), true ));
|
alleles.add( Allele.create(bestEvent.substring(1), true ));
|
||||||
loc = GenomeLocParser.setStop(loc, loc.getStop() + bestEvent.length()-1);
|
loc = GenomeLocParser.setStop(loc, loc.getStop() + bestEvent.length()-1);
|
||||||
} else
|
} else
|
||||||
throw new StingException("Internal error (probably a bug): event does not conform to expected format: "+ bestEvent);
|
throw new GATKException("Internal error (probably a bug): event does not conform to expected format: "+ bestEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
VariantContext vc = new VariantContext("UG_Indel_call", loc.getContig(), loc.getStart(), loc.getStop(), alleles, new HashMap<String, Genotype>() /* genotypes */,
|
VariantContext vc = new VariantContext("UG_Indel_call", loc.getContig(), loc.getStart(), loc.getStop(), alleles, new HashMap<String, Genotype>() /* genotypes */,
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,7 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.gatk.walkers.indels;
|
package org.broadinstitute.sting.gatk.walkers.indels;
|
||||||
|
|
||||||
import net.sf.samtools.Cigar;
|
import net.sf.samtools.*;
|
||||||
import net.sf.samtools.CigarElement;
|
|
||||||
import net.sf.samtools.CigarOperator;
|
|
||||||
import net.sf.samtools.SAMRecord;
|
|
||||||
import org.broad.tribble.FeatureSource;
|
import org.broad.tribble.FeatureSource;
|
||||||
import org.broad.tribble.util.variantcontext.Allele;
|
import org.broad.tribble.util.variantcontext.Allele;
|
||||||
import org.broad.tribble.util.variantcontext.VariantContext;
|
import org.broad.tribble.util.variantcontext.VariantContext;
|
||||||
|
|
@ -51,6 +48,7 @@ import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||||
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.ReferenceDataSource;
|
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.ReferenceDataSource;
|
||||||
import org.broadinstitute.sting.utils.*;
|
import org.broadinstitute.sting.utils.*;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
import org.broadinstitute.sting.utils.vcf.VCFUtils;
|
import org.broadinstitute.sting.utils.vcf.VCFUtils;
|
||||||
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
||||||
import org.broadinstitute.sting.utils.collections.CircularArray;
|
import org.broadinstitute.sting.utils.collections.CircularArray;
|
||||||
|
|
@ -213,7 +211,7 @@ public class IndelGenotyperV2Walker extends ReadWalker<Integer,Integer> {
|
||||||
normal_context = new WindowContext(0,WINDOW_SIZE);
|
normal_context = new WindowContext(0,WINDOW_SIZE);
|
||||||
|
|
||||||
if ( bedOutput != null && output_file != null ) {
|
if ( bedOutput != null && output_file != null ) {
|
||||||
throw new StingException("-O option is deprecated and -bed option replaces it; you can not use both at the same time");
|
throw new UserError.DeprecatedArgument("-O", "-O option is deprecated and -bed option replaces it; you can not use both at the same time");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( RefseqFileName != null ) {
|
if ( RefseqFileName != null ) {
|
||||||
|
|
@ -225,7 +223,7 @@ public class IndelGenotyperV2Walker extends ReadWalker<Integer,Integer> {
|
||||||
try {
|
try {
|
||||||
refseqIterator = new SeekableRODIterator(new FeatureToGATKFeatureIterator(refseq.iterator(),"refseq"));
|
refseqIterator = new SeekableRODIterator(new FeatureToGATKFeatureIterator(refseq.iterator(),"refseq"));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new StingException("Unable to open file " + RefseqFileName, e);
|
throw new UserError.CouldNotReadInputFile(new File(RefseqFileName), "Write failed", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -266,12 +264,12 @@ public class IndelGenotyperV2Walker extends ReadWalker<Integer,Integer> {
|
||||||
if ( bedOutput != null ) bedWriter = new FileWriter(bedOutput);
|
if ( bedOutput != null ) bedWriter = new FileWriter(bedOutput);
|
||||||
if ( output_file != null ) bedWriter = new FileWriter(output_file);
|
if ( output_file != null ) bedWriter = new FileWriter(output_file);
|
||||||
} catch (java.io.IOException e) {
|
} catch (java.io.IOException e) {
|
||||||
throw new StingException("Failed to open BED file for writing. "+ e.getMessage());
|
throw new UserError.CouldNotReadInputFile(bedOutput, "Failed to open BED file for writing.", e);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if ( verboseOutput != null ) verboseWriter = new FileWriter(verboseOutput);
|
if ( verboseOutput != null ) verboseWriter = new FileWriter(verboseOutput);
|
||||||
} catch (java.io.IOException e) {
|
} catch (java.io.IOException e) {
|
||||||
throw new StingException("Failed to open verbose file for writing. "+ e.getMessage());
|
throw new UserError.CouldNotReadInputFile(verboseOutput, "Failed to open BED file for writing.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
vcf_writer.writeHeader(new VCFHeader(getVCFHeaderInfo(), SampleUtils.getSAMFileSamples(getToolkit().getSAMFileHeader()))) ;
|
vcf_writer.writeHeader(new VCFHeader(getVCFHeaderInfo(), SampleUtils.getSAMFileSamples(getToolkit().getSAMFileHeader()))) ;
|
||||||
|
|
@ -301,7 +299,7 @@ public class IndelGenotyperV2Walker extends ReadWalker<Integer,Integer> {
|
||||||
// we just jumped onto a new contig
|
// we just jumped onto a new contig
|
||||||
if ( DEBUG ) System.out.println("DEBUG>>> Moved to contig "+read.getReferenceName());
|
if ( DEBUG ) System.out.println("DEBUG>>> Moved to contig "+read.getReferenceName());
|
||||||
if ( read.getReferenceIndex() < currentContigIndex ) // paranoidal
|
if ( read.getReferenceIndex() < currentContigIndex ) // paranoidal
|
||||||
throw new StingException("Read "+read.getReadName()+": contig is out of order; input BAM file is unsorted");
|
throw new UserError.MissortedBAM(SAMFileHeader.SortOrder.coordinate, read, "Read "+read.getReadName()+": contig is out of order; input BAM file is unsorted");
|
||||||
|
|
||||||
// print remaining indels from the previous contig (if any);
|
// print remaining indels from the previous contig (if any);
|
||||||
if ( call_somatic ) emit_somatic(1000000000, true);
|
if ( call_somatic ) emit_somatic(1000000000, true);
|
||||||
|
|
@ -329,10 +327,10 @@ public class IndelGenotyperV2Walker extends ReadWalker<Integer,Integer> {
|
||||||
// tumor_context are synchronized exactly (windows are always shifted together by emit_somatic), so it's safe
|
// tumor_context are synchronized exactly (windows are always shifted together by emit_somatic), so it's safe
|
||||||
|
|
||||||
if ( read.getAlignmentStart() < currentPosition ) // oops, read out of order?
|
if ( read.getAlignmentStart() < currentPosition ) // oops, read out of order?
|
||||||
throw new StingException("Read "+read.getReadName() +" out of order on the contig\n"+
|
throw new UserError.MissortedBAM(SAMFileHeader.SortOrder.coordinate, read, "Read "+read.getReadName() +" out of order on the contig\n"+
|
||||||
"Read starts at "+refName+":"+read.getAlignmentStart()+"; last read seen started at "+refName+":"+currentPosition
|
"Read starts at "+refName+":"+read.getAlignmentStart()+"; last read seen started at "+refName+":"+currentPosition
|
||||||
+"\nLast read was: "+lastRead.getReadName()+" RG="+lastRead.getAttribute("RG")+" at "+lastRead.getAlignmentStart()+"-"
|
+"\nLast read was: "+lastRead.getReadName()+" RG="+lastRead.getAttribute("RG")+" at "+lastRead.getAlignmentStart()+"-"
|
||||||
+lastRead.getAlignmentEnd()+" cigar="+lastRead.getCigarString());
|
+lastRead.getAlignmentEnd()+" cigar="+lastRead.getCigarString());
|
||||||
|
|
||||||
currentPosition = read.getAlignmentStart();
|
currentPosition = read.getAlignmentStart();
|
||||||
lastRead = read;
|
lastRead = read;
|
||||||
|
|
@ -384,7 +382,7 @@ public class IndelGenotyperV2Walker extends ReadWalker<Integer,Integer> {
|
||||||
// let's double check now that the read fits after the shift
|
// let's double check now that the read fits after the shift
|
||||||
if ( read.getAlignmentEnd() > normal_context.getStop()) {
|
if ( read.getAlignmentEnd() > normal_context.getStop()) {
|
||||||
// ooops, looks like the read does not fit into the window even after the latter was shifted!!
|
// ooops, looks like the read does not fit into the window even after the latter was shifted!!
|
||||||
throw new StingException("Read "+read.getReadName()+": out of coverage window bounds. Probably window is too small.\n"+
|
throw new UserError.MissortedBAM(SAMFileHeader.SortOrder.coordinate, read, "Read "+read.getReadName()+": out of coverage window bounds. Probably window is too small.\n"+
|
||||||
"Read length="+read.getReadLength()+"; cigar="+read.getCigarString()+"; start="+
|
"Read length="+read.getReadLength()+"; cigar="+read.getCigarString()+"; start="+
|
||||||
read.getAlignmentStart()+"; end="+read.getAlignmentEnd()+
|
read.getAlignmentStart()+"; end="+read.getAlignmentEnd()+
|
||||||
"; window start (after trying to accomodate the read)="+normal_context.getStart()+
|
"; window start (after trying to accomodate the read)="+normal_context.getStart()+
|
||||||
|
|
@ -395,14 +393,15 @@ public class IndelGenotyperV2Walker extends ReadWalker<Integer,Integer> {
|
||||||
if ( call_somatic ) {
|
if ( call_somatic ) {
|
||||||
|
|
||||||
String rg = (String)read.getAttribute("RG");
|
String rg = (String)read.getAttribute("RG");
|
||||||
if ( rg == null ) throw new StingException("Read "+read.getReadName()+" has no read group in merged stream. RG is required for somatic calls.");
|
if ( rg == null )
|
||||||
|
throw new UserError.MalformedBam(read, "Read "+read.getReadName()+" has no read group in merged stream. RG is required for somatic calls.");
|
||||||
|
|
||||||
if ( normalReadGroups.contains(rg) ) {
|
if ( normalReadGroups.contains(rg) ) {
|
||||||
normal_context.add(read,ref.getBases());
|
normal_context.add(read,ref.getBases());
|
||||||
} else if ( tumorReadGroups.contains(rg) ) {
|
} else if ( tumorReadGroups.contains(rg) ) {
|
||||||
tumor_context.add(read,ref.getBases());
|
tumor_context.add(read,ref.getBases());
|
||||||
} else {
|
} else {
|
||||||
throw new StingException("Unrecognized read group in merged stream: "+rg);
|
throw new UserError.MalformedBam(read, "Unrecognized read group in merged stream: "+rg);
|
||||||
}
|
}
|
||||||
if ( tumor_context.getReads().size() > MAX_READ_NUMBER ) {
|
if ( tumor_context.getReads().size() > MAX_READ_NUMBER ) {
|
||||||
System.out.println("WARNING: a count of "+MAX_READ_NUMBER+" reads reached in a window "+
|
System.out.println("WARNING: a count of "+MAX_READ_NUMBER+" reads reached in a window "+
|
||||||
|
|
@ -504,7 +503,7 @@ public class IndelGenotyperV2Walker extends ReadWalker<Integer,Integer> {
|
||||||
verboseWriter.write(fullRecord.toString());
|
verboseWriter.write(fullRecord.toString());
|
||||||
verboseWriter.write('\n');
|
verboseWriter.write('\n');
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new StingException("Write failed (verbose writer). "+e.getMessage());
|
throw new UserError.CouldNotCreateOutputFile(verboseOutput, "Write failed", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -664,7 +663,7 @@ public class IndelGenotyperV2Walker extends ReadWalker<Integer,Integer> {
|
||||||
verboseWriter.write(fullRecord + "\t"+ annotationString);
|
verboseWriter.write(fullRecord + "\t"+ annotationString);
|
||||||
verboseWriter.write('\n');
|
verboseWriter.write('\n');
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new StingException("Write failed (verbose writer). "+e.getMessage());
|
throw new UserError.CouldNotCreateOutputFile(verboseOutput, "Write failed", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1223,7 +1222,7 @@ public class IndelGenotyperV2Walker extends ReadWalker<Integer,Integer> {
|
||||||
try {
|
try {
|
||||||
bed.write(message.toString()+"\n");
|
bed.write(message.toString()+"\n");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new StingException("Error encountered while writing into output BED file");
|
throw new UserError.CouldNotCreateOutputFile(bedOutput, "Error encountered while writing into output BED file", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ import net.sf.samtools.util.SequenceUtil;
|
||||||
import net.sf.picard.reference.IndexedFastaSequenceFile;
|
import net.sf.picard.reference.IndexedFastaSequenceFile;
|
||||||
import org.broad.tribble.util.variantcontext.VariantContext;
|
import org.broad.tribble.util.variantcontext.VariantContext;
|
||||||
import org.broadinstitute.sting.commandline.*;
|
import org.broadinstitute.sting.commandline.*;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
import org.broadinstitute.sting.utils.interval.IntervalMergingRule;
|
import org.broadinstitute.sting.utils.interval.IntervalMergingRule;
|
||||||
import org.broadinstitute.sting.utils.interval.IntervalUtils;
|
import org.broadinstitute.sting.utils.interval.IntervalUtils;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
|
|
@ -333,7 +334,7 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
|
||||||
currentInterval = intervals.hasNext() ? intervals.next() : null;
|
currentInterval = intervals.hasNext() ? intervals.next() : null;
|
||||||
} while ( currentInterval != null && (readLoc == null || currentInterval.isBefore(readLoc)) );
|
} while ( currentInterval != null && (readLoc == null || currentInterval.isBefore(readLoc)) );
|
||||||
} catch (StingException e) {
|
} catch (StingException e) {
|
||||||
throw new StingException(e.getMessage() + " *** Are you sure that your interval file is sorted? If not, you must use the --targetIntervalsAreNotSorted argument. ***");
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -531,7 +532,7 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
|
||||||
statsOutput.write("\n");
|
statsOutput.write("\n");
|
||||||
statsOutput.flush();
|
statsOutput.flush();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new StingException(e.getMessage());
|
throw new UserError.CouldNotCreateOutputFile("statsOutput", "Failed to write stats output file", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -558,7 +559,7 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
|
||||||
indelOutput.write(str.toString());
|
indelOutput.write(str.toString());
|
||||||
indelOutput.flush();
|
indelOutput.flush();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new StingException(e.getMessage());
|
throw new UserError.CouldNotCreateOutputFile("indelOutput", "Failed to write indel output file", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( statsOutput != null ) {
|
if ( statsOutput != null ) {
|
||||||
|
|
@ -572,7 +573,7 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
|
||||||
statsOutput.write("\n");
|
statsOutput.write("\n");
|
||||||
statsOutput.flush();
|
statsOutput.flush();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new StingException(e.getMessage());
|
throw new UserError.CouldNotCreateOutputFile("statsOutput", "Failed to write stats output file", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -607,7 +608,7 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
|
||||||
currentInterval.toString(), improvement));
|
currentInterval.toString(), improvement));
|
||||||
statsOutput.flush();
|
statsOutput.flush();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new StingException(e.getMessage());
|
throw new UserError.CouldNotCreateOutputFile("statsOutput", "Failed to write stats output file", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1047,7 +1048,7 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
|
||||||
snpsOutput.write(sb.toString());
|
snpsOutput.write(sb.toString());
|
||||||
snpsOutput.flush();
|
snpsOutput.flush();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new StingException(e.getMessage());
|
throw new UserError.CouldNotCreateOutputFile("snpsOutput", "Failed to write SNPs output file", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return reduces;
|
return reduces;
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,13 @@ import org.broadinstitute.sting.gatk.filters.ZeroMappingQualityReadFilter;
|
||||||
import org.broadinstitute.sting.gatk.filters.BadMateFilter;
|
import org.broadinstitute.sting.gatk.filters.BadMateFilter;
|
||||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||||
import org.broadinstitute.sting.gatk.walkers.*;
|
import org.broadinstitute.sting.gatk.walkers.*;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.commandline.Output;
|
import org.broadinstitute.sting.commandline.Output;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
import org.broadinstitute.sting.utils.pileup.ExtendedEventPileupElement;
|
import org.broadinstitute.sting.utils.pileup.ExtendedEventPileupElement;
|
||||||
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
||||||
import org.broadinstitute.sting.utils.pileup.ReadBackedExtendedEventPileup;
|
import org.broadinstitute.sting.utils.pileup.ReadBackedExtendedEventPileup;
|
||||||
|
|
@ -83,7 +85,7 @@ public class RealignerTargetCreator extends RodWalker<RealignerTargetCreator.Eve
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
if ( windowSize < 2 )
|
if ( windowSize < 2 )
|
||||||
throw new StingException("Window Size must be an integer greater than 1");
|
throw new UserError.BadArgumentValue("windowSize", "Window Size must be an integer greater than 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Event map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
public Event map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,10 @@ import org.broadinstitute.sting.gatk.walkers.DataSource;
|
||||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.utils.collections.PrimitivePair;
|
import org.broadinstitute.sting.utils.collections.PrimitivePair;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.commandline.Output;
|
import org.broadinstitute.sting.commandline.Output;
|
||||||
|
|
@ -80,7 +82,7 @@ public class CycleQualityWalker extends ReadWalker<Integer,Integer> {
|
||||||
private Map<String,CycleStats[]> cyclesByLibraryMapOrig = null;
|
private Map<String,CycleStats[]> cyclesByLibraryMapOrig = null;
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
if ( PREFIX == null ) throw new StingException("Prefix for output file(s) must be specified");
|
if ( PREFIX == null ) throw new GATKException("Prefix for output file(s) must be specified");
|
||||||
cyclesByLaneMap = new HashMap<String,CycleStats[]>();
|
cyclesByLaneMap = new HashMap<String,CycleStats[]>();
|
||||||
cyclesByLibraryMap = new HashMap<String,CycleStats[]>();
|
cyclesByLibraryMap = new HashMap<String,CycleStats[]>();
|
||||||
cyclesByLaneMapOrig = new HashMap<String,CycleStats[]>();
|
cyclesByLaneMapOrig = new HashMap<String,CycleStats[]>();
|
||||||
|
|
@ -94,23 +96,25 @@ public class CycleQualityWalker extends ReadWalker<Integer,Integer> {
|
||||||
|
|
||||||
SAMReadGroupRecord rg = read.getReadGroup();
|
SAMReadGroupRecord rg = read.getReadGroup();
|
||||||
|
|
||||||
if ( rg == null ) throw new StingException("Read "+read.getReadName()+" is not assigned to any read group");
|
if ( rg == null ) throw new UserError.ReadMissingReadGroup(read);
|
||||||
|
|
||||||
String lane = read.getReadGroup().getPlatformUnit();
|
String lane = read.getReadGroup().getPlatformUnit();
|
||||||
String library = read.getReadGroup().getLibrary();
|
String library = read.getReadGroup().getLibrary();
|
||||||
|
|
||||||
if ( lane == null ) throw new StingException("Read "+read.getReadName()+" has no platform unit information");
|
if ( lane == null ) throw new UserError.MalformedBam(read, "Read "+read.getReadName()+" has no platform unit information");
|
||||||
if ( library == null ) throw new StingException("Read "+read.getReadName()+" has no library information");
|
if ( library == null ) throw new UserError.MalformedBam(read, "Read "+read.getReadName()+" has no library information");
|
||||||
|
|
||||||
int end = 0;
|
int end = 0;
|
||||||
|
|
||||||
if ( read.getReadPairedFlag() ) {
|
if ( read.getReadPairedFlag() ) {
|
||||||
|
|
||||||
if ( read.getFirstOfPairFlag() ) {
|
if ( read.getFirstOfPairFlag() ) {
|
||||||
if ( read.getSecondOfPairFlag() ) throw new StingException("Read "+read.getReadName()+" has conflicting first/second in pair attributes");
|
if ( read.getSecondOfPairFlag() )
|
||||||
|
throw new UserError.MalformedBam(read, "Read "+read.getReadName()+" has conflicting first/second in pair attributes");
|
||||||
end = 1;
|
end = 1;
|
||||||
} else {
|
} else {
|
||||||
if ( ! read.getSecondOfPairFlag() ) throw new StingException("Read "+read.getReadName()+" has conflicting first/second in pair attributes");
|
if ( ! read.getSecondOfPairFlag() )
|
||||||
|
throw new UserError.MalformedBam(read, "Read "+read.getReadName()+" has conflicting first/second in pair attributes");
|
||||||
end = 2;
|
end = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -357,7 +361,7 @@ public class CycleQualityWalker extends ReadWalker<Integer,Integer> {
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
throw new StingException("Failed to write report into the file "+f+":\n"+ioe.getMessage());
|
throw new UserError.CouldNotCreateOutputFile(f, "Failed to write report", ioe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -403,8 +407,8 @@ public class CycleQualityWalker extends ReadWalker<Integer,Integer> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(byte[] quals) {
|
public void add(byte[] quals) {
|
||||||
if ( quals.length > cycleQualsAv.length ) throw new StingException("A read of length "+quals.length+
|
if ( quals.length > cycleQualsAv.length )
|
||||||
" encountered, which exceeds specified maximum read length");
|
throw new UserError("A read of length "+quals.length+" encountered, which exceeds specified maximum read length");
|
||||||
if ( quals.length > maxL ) maxL = quals.length;
|
if ( quals.length > maxL ) maxL = quals.length;
|
||||||
if ( quals.length < minL ) minL = quals.length;
|
if ( quals.length < minL ) minL = quals.length;
|
||||||
readCount++;
|
readCount++;
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
import org.broadinstitute.sting.utils.Utils;
|
||||||
import org.broadinstitute.sting.utils.MathUtils;
|
import org.broadinstitute.sting.utils.MathUtils;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.commandline.Output;
|
import org.broadinstitute.sting.commandline.Output;
|
||||||
|
|
@ -76,7 +77,7 @@ public class ReadClippingStatsWalker extends ReadWalker<ReadClippingStatsWalker.
|
||||||
ReadClippingInfo info = new ReadClippingInfo();
|
ReadClippingInfo info = new ReadClippingInfo();
|
||||||
info.rg = read.getReadGroup();
|
info.rg = read.getReadGroup();
|
||||||
|
|
||||||
if ( info.rg == null ) throw new StingException("Read "+read.getReadName()+" is not assigned to any read group");
|
if ( info.rg == null ) throw new UserError.ReadMissingReadGroup(read);
|
||||||
|
|
||||||
for ( CigarElement elt : read.getCigar().getCigarElements() ) {
|
for ( CigarElement elt : read.getCigar().getCigarElements() ) {
|
||||||
if ( elt.getOperator() != CigarOperator.N )
|
if ( elt.getOperator() != CigarOperator.N )
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package org.broadinstitute.sting.gatk.walkers.qc;
|
||||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
import net.sf.samtools.SAMFileWriter;
|
import net.sf.samtools.SAMFileWriter;
|
||||||
|
|
@ -58,7 +59,7 @@ public class ReadValidationWalker extends ReadWalker<SAMRecord, SAMRecord> {
|
||||||
try {
|
try {
|
||||||
m = MessageDigest.getInstance("MD5");
|
m = MessageDigest.getInstance("MD5");
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (NoSuchAlgorithmException e) {
|
||||||
throw new StingException("Unable to get the MD5 algorithm. Get a more eXtreme version of JAVA!@!@!!");
|
throw new GATKException("Unable to get the MD5 algorithm. Get a more eXtreme version of JAVA!@!@!!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,12 +30,10 @@ import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||||
import org.broadinstitute.sting.gatk.refdata.features.sampileup.SAMPileupFeature;
|
import org.broadinstitute.sting.gatk.refdata.features.sampileup.SAMPileupFeature;
|
||||||
import org.broadinstitute.sting.gatk.walkers.*;
|
import org.broadinstitute.sting.gatk.walkers.*;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.*;
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
|
||||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.commandline.Output;
|
import org.broadinstitute.sting.commandline.Output;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
|
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -61,8 +59,8 @@ public class ValidatingPileupWalker extends LocusWalker<Integer, ValidationStats
|
||||||
if ( truePileup == null ) {
|
if ( truePileup == null ) {
|
||||||
out.printf("No truth pileup data available at %s%n", pileup.getPileupString(ref.getBaseAsChar()));
|
out.printf("No truth pileup data available at %s%n", pileup.getPileupString(ref.getBaseAsChar()));
|
||||||
if ( ! CONTINUE_AFTER_AN_ERROR ) {
|
if ( ! CONTINUE_AFTER_AN_ERROR ) {
|
||||||
Utils.scareUser(String.format("No pileup data available at %s given GATK's output of %s -- this walker requires samtools pileup data over all bases",
|
throw new UserError.CommandLineError(String.format("No pileup data available at %s given GATK's output of %s -- this walker requires samtools pileup data over all bases",
|
||||||
context.getLocation(), new String(pileup.getBases())));
|
context.getLocation(), new String(pileup.getBases())));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String pileupDiff = pileupDiff(pileup, truePileup, true);
|
String pileupDiff = pileupDiff(pileup, truePileup, true);
|
||||||
|
|
@ -141,7 +139,7 @@ public class ValidatingPileupWalker extends LocusWalker<Integer, ValidationStats
|
||||||
else if( pileup.hasIndelGenotype() )
|
else if( pileup.hasIndelGenotype() )
|
||||||
return pileup.getIndelGenotype();
|
return pileup.getIndelGenotype();
|
||||||
else
|
else
|
||||||
throw new StingException("Unsupported pileup type: " + pileup);
|
throw new GATKException("Unsupported pileup type: " + pileup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ import org.broadinstitute.sting.utils.classloader.PackageUtils;
|
||||||
import org.broadinstitute.sting.utils.collections.NestedHashMap;
|
import org.broadinstitute.sting.utils.collections.NestedHashMap;
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.commandline.ArgumentCollection;
|
import org.broadinstitute.sting.commandline.ArgumentCollection;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
||||||
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
||||||
|
|
||||||
|
|
@ -186,7 +187,7 @@ public class CovariateCounterWalker extends LocusWalker<CovariateCounterWalker.C
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( !foundDBSNP && !RUN_WITHOUT_DBSNP ) {
|
if( !foundDBSNP && !RUN_WITHOUT_DBSNP ) {
|
||||||
throw new StingException("This calculation is critically dependent on being able to skip over known variant sites. Please provide a dbSNP ROD or a VCF file containing known sites of genetic variation.");
|
throw new UserError.CommandLineError("This calculation is critically dependent on being able to skip over known variant sites. Please provide a dbSNP ROD or a VCF file containing known sites of genetic variation.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the requested covariates by parsing the -cov argument
|
// Initialize the requested covariates by parsing the -cov argument
|
||||||
|
|
@ -195,7 +196,7 @@ public class CovariateCounterWalker extends LocusWalker<CovariateCounterWalker.C
|
||||||
requestedCovariates.add( new ReadGroupCovariate() ); // Order is important here
|
requestedCovariates.add( new ReadGroupCovariate() ); // Order is important here
|
||||||
requestedCovariates.add( new QualityScoreCovariate() );
|
requestedCovariates.add( new QualityScoreCovariate() );
|
||||||
} else {
|
} else {
|
||||||
throw new StingException("There are more required covariates than expected. The instantiation list needs to be updated with the new required covariate and in the correct order.");
|
throw new UserError.CommandLineError("There are more required covariates than expected. The instantiation list needs to be updated with the new required covariate and in the correct order.");
|
||||||
}
|
}
|
||||||
// Next add the standard covariates if -standard was specified by the user
|
// Next add the standard covariates if -standard was specified by the user
|
||||||
if( USE_STANDARD_COVARIATES ) {
|
if( USE_STANDARD_COVARIATES ) {
|
||||||
|
|
@ -213,9 +214,9 @@ public class CovariateCounterWalker extends LocusWalker<CovariateCounterWalker.C
|
||||||
final Covariate covariate = (Covariate)covClass.newInstance();
|
final Covariate covariate = (Covariate)covClass.newInstance();
|
||||||
requestedCovariates.add( covariate );
|
requestedCovariates.add( covariate );
|
||||||
} catch ( InstantiationException e ) {
|
} catch ( InstantiationException e ) {
|
||||||
throw new StingException( String.format("Can not instantiate covariate class '%s': must be concrete class.", covClass.getSimpleName()) );
|
throw new UserError.CommandLineError( String.format("Can not instantiate covariate class '%s': must be concrete class.", covClass.getSimpleName()) );
|
||||||
} catch ( IllegalAccessException e ) {
|
} catch ( IllegalAccessException e ) {
|
||||||
throw new StingException( String.format("Can not instantiate covariate class '%s': must have no-arg constructor.", covClass.getSimpleName()) );
|
throw new UserError.CommandLineError( String.format("Can not instantiate covariate class '%s': must have no-arg constructor.", covClass.getSimpleName()) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -234,16 +235,16 @@ public class CovariateCounterWalker extends LocusWalker<CovariateCounterWalker.C
|
||||||
final Covariate covariate = (Covariate)covClass.newInstance();
|
final Covariate covariate = (Covariate)covClass.newInstance();
|
||||||
requestedCovariates.add( covariate );
|
requestedCovariates.add( covariate );
|
||||||
} catch ( InstantiationException e ) {
|
} catch ( InstantiationException e ) {
|
||||||
throw new StingException( String.format("Can not instantiate covariate class '%s': must be concrete class.", covClass.getSimpleName()) );
|
throw new UserError.CommandLineError( String.format("Can not instantiate covariate class '%s': must be concrete class.", covClass.getSimpleName()) );
|
||||||
} catch ( IllegalAccessException e ) {
|
} catch ( IllegalAccessException e ) {
|
||||||
throw new StingException( String.format("Can not instantiate covariate class '%s': must have no-arg constructor.", covClass.getSimpleName()) );
|
throw new UserError.CommandLineError( String.format("Can not instantiate covariate class '%s': must have no-arg constructor.", covClass.getSimpleName()) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !foundClass ) {
|
if( !foundClass ) {
|
||||||
throw new StingException( "The requested covariate type (" + requestedCovariateString + ") isn't a valid covariate option. Use --list to see possible covariates." );
|
throw new UserError.CommandLineError( "The requested covariate type (" + requestedCovariateString + ") isn't a valid covariate option. Use --list to see possible covariates." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import net.sf.samtools.SAMRecord;
|
||||||
import org.broadinstitute.sting.utils.BaseUtils;
|
import org.broadinstitute.sting.utils.BaseUtils;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
import org.broadinstitute.sting.utils.Utils;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009 The Broad Institute
|
* Copyright (c) 2009 The Broad Institute
|
||||||
|
|
@ -52,7 +53,7 @@ public class CycleCovariate implements StandardCovariate {
|
||||||
RAC.DEFAULT_PLATFORM.contains( "454" ) || RAC.DEFAULT_PLATFORM.equalsIgnoreCase( "SOLID" ) || RAC.DEFAULT_PLATFORM.equalsIgnoreCase( "ABI_SOLID" ) ) {
|
RAC.DEFAULT_PLATFORM.contains( "454" ) || RAC.DEFAULT_PLATFORM.equalsIgnoreCase( "SOLID" ) || RAC.DEFAULT_PLATFORM.equalsIgnoreCase( "ABI_SOLID" ) ) {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
} else {
|
} else {
|
||||||
throw new StingException( "The requested default platform (" + RAC.DEFAULT_PLATFORM +") is not a recognized platform. Implemented options are illumina, 454, and solid");
|
throw new UserError.CommandLineError("The requested default platform (" + RAC.DEFAULT_PLATFORM +") is not a recognized platform. Implemented options are illumina, 454, and solid");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.gatk.walkers.recalibration;
|
package org.broadinstitute.sting.gatk.walkers.recalibration;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
||||||
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
||||||
import org.broadinstitute.sting.utils.*;
|
import org.broadinstitute.sting.utils.*;
|
||||||
|
|
@ -233,7 +234,7 @@ public class RecalDataManager {
|
||||||
readGroup.setPlatform( RAC.DEFAULT_PLATFORM );
|
readGroup.setPlatform( RAC.DEFAULT_PLATFORM );
|
||||||
((GATKSAMRecord)read).setReadGroup( readGroup );
|
((GATKSAMRecord)read).setReadGroup( readGroup );
|
||||||
} else {
|
} else {
|
||||||
throw new StingException("The input .bam file contains reads with no read group. First observed at read with name = " + read.getReadName() +
|
throw new UserError.MalformedBam(read, "The input .bam file contains reads with no read group. First observed at read with name = " + read.getReadName() +
|
||||||
" Users must set both the default read group using the --default_read_group <String> argument and the default platform using the --default_platform <String> argument." );
|
" Users must set both the default read group using the --default_read_group <String> argument and the default platform using the --default_platform <String> argument." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -259,7 +260,7 @@ public class RecalDataManager {
|
||||||
}
|
}
|
||||||
readGroup.setPlatform( RAC.DEFAULT_PLATFORM );
|
readGroup.setPlatform( RAC.DEFAULT_PLATFORM );
|
||||||
} else {
|
} else {
|
||||||
throw new StingException("The input .bam file contains reads with no platform information. First observed at read with name = " + read.getReadName() +
|
throw new UserError.MalformedBam(read, "The input .bam file contains reads with no platform information. First observed at read with name = " + read.getReadName() +
|
||||||
" Users must set the default platform using the --default_platform <String> argument." );
|
" Users must set the default platform using the --default_platform <String> argument." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -292,14 +293,14 @@ public class RecalDataManager {
|
||||||
int iii;
|
int iii;
|
||||||
byte prevBase = colorSpace[0]; // The sentinel
|
byte prevBase = colorSpace[0]; // The sentinel
|
||||||
for( iii = 0; iii < readBases.length; iii++ ) {
|
for( iii = 0; iii < readBases.length; iii++ ) {
|
||||||
final byte thisBase = getNextBaseFromColor( prevBase, colorSpace[iii + 1] );
|
final byte thisBase = getNextBaseFromColor( read, prevBase, colorSpace[iii + 1] );
|
||||||
inconsistency[iii] = (byte)( thisBase == readBases[iii] ? 0 : 1 );
|
inconsistency[iii] = (byte)( thisBase == readBases[iii] ? 0 : 1 );
|
||||||
prevBase = readBases[iii];
|
prevBase = readBases[iii];
|
||||||
}
|
}
|
||||||
read.setAttribute( RecalDataManager.COLOR_SPACE_INCONSISTENCY_TAG, inconsistency );
|
read.setAttribute( RecalDataManager.COLOR_SPACE_INCONSISTENCY_TAG, inconsistency );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new StingException("Unable to find color space information in SOLiD read. First observed at read with name = " + read.getReadName() +
|
throw new UserError.MalformedBam(read, "Unable to find color space information in SOLiD read. First observed at read with name = " + read.getReadName() +
|
||||||
" Unfortunately this .bam file can not be recalibrated without color space information because of potential reference bias.");
|
" Unfortunately this .bam file can not be recalibrated without color space information because of potential reference bias.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -324,7 +325,7 @@ public class RecalDataManager {
|
||||||
if( attr instanceof String ) {
|
if( attr instanceof String ) {
|
||||||
colorSpace = ((String)attr).getBytes();
|
colorSpace = ((String)attr).getBytes();
|
||||||
} else {
|
} 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 GATKException(String.format("Value encoded by %s in %s isn't a string!", RecalDataManager.COLOR_SPACE_ATTRIBUTE_TAG, read.getReadName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop over the read and calculate first the inferred bases from the color and then check if it is consistent with the read
|
// Loop over the read and calculate first the inferred bases from the color and then check if it is consistent with the read
|
||||||
|
|
@ -338,7 +339,7 @@ public class RecalDataManager {
|
||||||
final int[] inconsistency = new int[readBases.length];
|
final int[] inconsistency = new int[readBases.length];
|
||||||
byte prevBase = colorSpace[0]; // The sentinel
|
byte prevBase = colorSpace[0]; // The sentinel
|
||||||
for( int iii = 0; iii < readBases.length; iii++ ) {
|
for( int iii = 0; iii < readBases.length; iii++ ) {
|
||||||
final byte thisBase = getNextBaseFromColor( prevBase, colorSpace[iii + 1] );
|
final byte thisBase = getNextBaseFromColor( read, prevBase, colorSpace[iii + 1] );
|
||||||
colorImpliedBases[iii] = thisBase;
|
colorImpliedBases[iii] = thisBase;
|
||||||
inconsistency[iii] = ( thisBase == readBases[iii] ? 0 : 1 );
|
inconsistency[iii] = ( thisBase == readBases[iii] ? 0 : 1 );
|
||||||
prevBase = readBases[iii];
|
prevBase = readBases[iii];
|
||||||
|
|
@ -356,8 +357,8 @@ public class RecalDataManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new StingException("Unable to find color space information in SOLiD read. First observed at read with name = " + read.getReadName() +
|
throw new UserError.MalformedBam(read, "Unable to find color space information in SOLiD read. First observed at read with name = " + read.getReadName() +
|
||||||
" Unfortunately this .bam file can not be recalibrated without color space information because of potential reference bias.");
|
" Unfortunately this .bam file can not be recalibrated without color space information because of potential reference bias.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return originalQualScores;
|
return originalQualScores;
|
||||||
|
|
@ -371,7 +372,7 @@ public class RecalDataManager {
|
||||||
if( attr instanceof String ) {
|
if( attr instanceof String ) {
|
||||||
colorSpace = ((String)attr).substring(1).getBytes(); // trim off the Sentinel
|
colorSpace = ((String)attr).substring(1).getBytes(); // trim off the Sentinel
|
||||||
} else {
|
} 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 GATKException(String.format("Value encoded by %s in %s isn't a string!", RecalDataManager.COLOR_SPACE_ATTRIBUTE_TAG, read.getReadName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
for( byte color : colorSpace ) {
|
for( byte color : colorSpace ) {
|
||||||
|
|
@ -381,7 +382,7 @@ public class RecalDataManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new StingException("Unable to find color space information in SOLiD read. First observed at read with name = " + read.getReadName() +
|
throw new UserError.MalformedBam(read, "Unable to find color space information in SOLiD read. First observed at read with name = " + read.getReadName() +
|
||||||
" Unfortunately this .bam file can not be recalibrated without color space information because of potential reference bias.");
|
" Unfortunately this .bam file can not be recalibrated without color space information because of potential reference bias.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -446,7 +447,7 @@ public class RecalDataManager {
|
||||||
colorSpaceQuals = x.getBytes();
|
colorSpaceQuals = x.getBytes();
|
||||||
SAMUtils.fastqToPhred(colorSpaceQuals);
|
SAMUtils.fastqToPhred(colorSpaceQuals);
|
||||||
} else {
|
} else {
|
||||||
throw new StingException(String.format("Value encoded by %s in %s isn't a string!", RecalDataManager.COLOR_SPACE_QUAL_ATTRIBUTE_TAG, read.getReadName()));
|
throw new GATKException(String.format("Value encoded by %s in %s isn't a string!", RecalDataManager.COLOR_SPACE_QUAL_ATTRIBUTE_TAG, read.getReadName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int iii = 1; iii < inconsistency.length - 1; iii++ ) {
|
for( int iii = 1; iii < inconsistency.length - 1; iii++ ) {
|
||||||
|
|
@ -491,7 +492,7 @@ public class RecalDataManager {
|
||||||
}
|
}
|
||||||
read.setReadBases( readBases );
|
read.setReadBases( readBases );
|
||||||
} else { // No color space quality tag in file
|
} else { // No color space quality tag in file
|
||||||
throw new StingException("REMOVE_REF_BIAS recal mode requires color space qualities but they can't be found for read: " + read.getReadName());
|
throw new UserError.MalformedBam(read, "REMOVE_REF_BIAS recal mode requires color space qualities but they can't be found for read: " + read.getReadName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -501,7 +502,7 @@ public class RecalDataManager {
|
||||||
* @param color The color
|
* @param color The color
|
||||||
* @return The next base in the sequence
|
* @return The next base in the sequence
|
||||||
*/
|
*/
|
||||||
private static byte getNextBaseFromColor( final byte prevBase, final byte color ) {
|
private static byte getNextBaseFromColor( SAMRecord read, final byte prevBase, final byte color ) {
|
||||||
switch(color) {
|
switch(color) {
|
||||||
case '0':
|
case '0':
|
||||||
return prevBase;
|
return prevBase;
|
||||||
|
|
@ -512,7 +513,7 @@ public class RecalDataManager {
|
||||||
case '3':
|
case '3':
|
||||||
return performColorThree( prevBase );
|
return performColorThree( prevBase );
|
||||||
default:
|
default:
|
||||||
throw new StingException( "Unrecognized color space in SOLID read, color = " + (char)color +
|
throw new UserError.MalformedBam(read, "Unrecognized color space in SOLID read, color = " + (char)color +
|
||||||
" Unfortunately this bam file can not be recalibrated without full color space information because of potential reference bias.");
|
" Unfortunately this bam file can not be recalibrated without full color space information because of potential reference bias.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ import org.broadinstitute.sting.utils.classloader.PackageUtils;
|
||||||
import org.broadinstitute.sting.utils.collections.NestedHashMap;
|
import org.broadinstitute.sting.utils.collections.NestedHashMap;
|
||||||
import org.broadinstitute.sting.utils.QualityUtils;
|
import org.broadinstitute.sting.utils.QualityUtils;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
import org.broadinstitute.sting.utils.text.TextFormattingUtils;
|
import org.broadinstitute.sting.utils.text.TextFormattingUtils;
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
import org.broadinstitute.sting.utils.Utils;
|
||||||
import org.broadinstitute.sting.utils.text.XReadLines;
|
import org.broadinstitute.sting.utils.text.XReadLines;
|
||||||
|
|
@ -179,7 +180,7 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
|
||||||
// Read in the covariates that were used from the input file
|
// Read in the covariates that were used from the input file
|
||||||
else if( COVARIATE_PATTERN.matcher(line).matches() ) { // The line string is either specifying a covariate or is giving csv data
|
else if( COVARIATE_PATTERN.matcher(line).matches() ) { // The line string is either specifying a covariate or is giving csv data
|
||||||
if( foundAllCovariates ) {
|
if( foundAllCovariates ) {
|
||||||
throw new StingException( "Malformed input recalibration file. Found covariate names intermingled with data in file: " + RECAL_FILE );
|
throw new UserError.MalformedFile( RECAL_FILE, "Malformed input recalibration file. Found covariate names intermingled with data in file: " + RECAL_FILE );
|
||||||
} else { // Found the covariate list in input file, loop through all of them and instantiate them
|
} else { // Found the covariate list in input file, loop through all of them and instantiate them
|
||||||
String[] vals = line.split(",");
|
String[] vals = line.split(",");
|
||||||
for( int iii = 0; iii < vals.length - 3; iii++ ) { // There are n-3 covariates. The last three items are nObservations, nMismatch, and Qempirical
|
for( int iii = 0; iii < vals.length - 3; iii++ ) { // There are n-3 covariates. The last three items are nObservations, nMismatch, and Qempirical
|
||||||
|
|
@ -192,15 +193,15 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
|
||||||
requestedCovariates.add( covariate );
|
requestedCovariates.add( covariate );
|
||||||
|
|
||||||
} catch ( InstantiationException e ) {
|
} catch ( InstantiationException e ) {
|
||||||
throw new StingException( String.format("Can not instantiate covariate class '%s': must be concrete class.", covClass.getSimpleName()) );
|
throw new UserError.CommandLineError( String.format("Can not instantiate covariate class '%s': must be concrete class.", covClass.getSimpleName()) );
|
||||||
} catch ( IllegalAccessException e ) {
|
} catch ( IllegalAccessException e ) {
|
||||||
throw new StingException( String.format("Can not instantiate covariate class '%s': must have no-arg constructor.", covClass.getSimpleName()) );
|
throw new UserError.CommandLineError( String.format("Can not instantiate covariate class '%s': must have no-arg constructor.", covClass.getSimpleName()) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !foundClass ) {
|
if( !foundClass ) {
|
||||||
throw new StingException( "Malformed input recalibration file. The requested covariate type (" + (vals[iii] + "Covariate") + ") isn't a valid covariate option." );
|
throw new UserError.MalformedFile(RECAL_FILE, "Malformed input recalibration file. The requested covariate type (" + (vals[iii] + "Covariate") + ") isn't a valid covariate option." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -211,7 +212,7 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
|
||||||
|
|
||||||
// At this point all the covariates should have been found and initialized
|
// At this point all the covariates should have been found and initialized
|
||||||
if( requestedCovariates.size() < 2 ) {
|
if( requestedCovariates.size() < 2 ) {
|
||||||
throw new StingException( "Malformed input recalibration csv file. Covariate names can't be found in file: " + RECAL_FILE );
|
throw new UserError.MalformedFile(RECAL_FILE, "Malformed input recalibration csv file. Covariate names can't be found in file: " + RECAL_FILE );
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean createCollapsedTables = true;
|
final boolean createCollapsedTables = true;
|
||||||
|
|
@ -224,21 +225,21 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
|
||||||
dataManager = new RecalDataManager( createCollapsedTables, requestedCovariates.size() );
|
dataManager = new RecalDataManager( createCollapsedTables, requestedCovariates.size() );
|
||||||
|
|
||||||
}
|
}
|
||||||
addCSVData(line); // Parse the line and add the data to the HashMap
|
addCSVData(RECAL_FILE, line); // Parse the line and add the data to the HashMap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch ( FileNotFoundException e ) {
|
} catch ( FileNotFoundException e ) {
|
||||||
throw new StingException("Can not find input file: " + RECAL_FILE);
|
throw new UserError.CouldNotReadInputFile(RECAL_FILE, "Can not find input file", e);
|
||||||
} catch ( NumberFormatException e ) {
|
} catch ( NumberFormatException e ) {
|
||||||
throw new StingException("Error parsing recalibration data at line " + lineNumber + ". Perhaps your table was generated by an older version of CovariateCounterWalker.");
|
throw new UserError.MalformedFile(RECAL_FILE, "Error parsing recalibration data at line " + lineNumber + ". Perhaps your table was generated by an older version of CovariateCounterWalker.");
|
||||||
}
|
}
|
||||||
logger.info( "...done!" );
|
logger.info( "...done!" );
|
||||||
|
|
||||||
if ( !sawEOF ) {
|
if ( !sawEOF ) {
|
||||||
final String errorMessage = "No EOF marker was present in the recal covariates table; this could mean that the file is corrupted or was generated with an old version of the CountCovariates tool.";
|
final String errorMessage = "No EOF marker was present in the recal covariates table; this could mean that the file is corrupted or was generated with an old version of the CountCovariates tool.";
|
||||||
if ( REQUIRE_EOF )
|
if ( REQUIRE_EOF )
|
||||||
throw new StingException(errorMessage);
|
throw new UserError.MalformedFile(RECAL_FILE, errorMessage);
|
||||||
logger.warn(errorMessage);
|
logger.warn(errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -248,7 +249,7 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
|
||||||
}
|
}
|
||||||
|
|
||||||
if( dataManager == null ) {
|
if( dataManager == null ) {
|
||||||
throw new StingException("Can't initialize the data manager. Perhaps the recal csv file contains no data?");
|
throw new UserError.MalformedFile(RECAL_FILE, "Can't initialize the data manager. Perhaps the recal csv file contains no data?");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the tables of empirical quality scores that will be used in the sequential calculation
|
// Create the tables of empirical quality scores that will be used in the sequential calculation
|
||||||
|
|
@ -298,12 +299,12 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
|
||||||
* For each covariate read in a value and parse it. Associate those values with the data itself (num observation and num mismatches)
|
* For each covariate read in a value and parse it. Associate those values with the data itself (num observation and num mismatches)
|
||||||
* @param line A line of CSV data read from the recalibration table data file
|
* @param line A line of CSV data read from the recalibration table data file
|
||||||
*/
|
*/
|
||||||
private void addCSVData(final String line) {
|
private void addCSVData(final File file, final String line) {
|
||||||
final String[] vals = line.split(",");
|
final String[] vals = line.split(",");
|
||||||
|
|
||||||
// Check if the data line is malformed, for example if the read group string contains a comma then it won't be parsed correctly
|
// Check if the data line is malformed, for example if the read group string contains a comma then it won't be parsed correctly
|
||||||
if( vals.length != requestedCovariates.size() + 3 ) { // +3 because of nObservations, nMismatch, and Qempirical
|
if( vals.length != requestedCovariates.size() + 3 ) { // +3 because of nObservations, nMismatch, and Qempirical
|
||||||
throw new StingException("Malformed input recalibration file. Found data line with too many fields: " + line +
|
throw new UserError.MalformedFile(file, "Malformed input recalibration file. Found data line with too many fields: " + line +
|
||||||
" --Perhaps the read group string contains a comma and isn't being parsed correctly.");
|
" --Perhaps the read group string contains a comma and isn't being parsed correctly.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ package org.broadinstitute.sting.gatk.walkers.recalibration;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
import net.sf.picard.util.IlluminaUtil;
|
import net.sf.picard.util.IlluminaUtil;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.UserError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author alecw@broadinstitute.org
|
* @author alecw@broadinstitute.org
|
||||||
|
|
@ -47,7 +48,7 @@ public class TileCovariate implements ExperimentalCovariate {
|
||||||
Integer tile = IlluminaUtil.getTileFromReadName(read.getReadName());
|
Integer tile = IlluminaUtil.getTileFromReadName(read.getReadName());
|
||||||
if (tile == null) {
|
if (tile == null) {
|
||||||
if( exceptionWhenNoTile ) {
|
if( exceptionWhenNoTile ) {
|
||||||
throw new StingException( "Tile number not defined for read: " + read.getReadName() );
|
throw new UserError.MalformedBam(read, "Tile covariate specified but tile number not defined for read: " + read.getReadName() );
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.playground.utils.report.tags.Analysis;
|
import org.broadinstitute.sting.playground.utils.report.tags.Analysis;
|
||||||
import org.broadinstitute.sting.playground.utils.report.tags.DataPoint;
|
import org.broadinstitute.sting.playground.utils.report.tags.DataPoint;
|
||||||
|
import org.broadinstitute.sting.utils.GATKException;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -112,7 +113,7 @@ public class CountVariants extends VariantEvaluator implements StandardEval {
|
||||||
nComplex++;
|
nComplex++;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new StingException("Unexpected VariantContext type " + vc1.getType());
|
throw new GATKException("Unexpected VariantContext type " + vc1.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Genotype g : vc1.getGenotypes().values()) {
|
for (Genotype g : vc1.getGenotypes().values()) {
|
||||||
|
|
@ -130,7 +131,7 @@ public class CountVariants extends VariantEvaluator implements StandardEval {
|
||||||
nHomVar++;
|
nHomVar++;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new StingException("BUG: Unexpected genotype type: " + g);
|
throw new GATKException("BUG: Unexpected genotype type: " + g);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue