Merge pull request #1295 from broadinstitute/rhl_sv_error_output_1194
Correct error messages and error handling in multiple tools
This commit is contained in:
commit
5e2ffc188b
|
|
@ -264,14 +264,14 @@ public class ContEst extends RodWalker<Map<String, Map<String, ContaminationStat
|
||||||
useSequencingGenotypes = true;
|
useSequencingGenotypes = true;
|
||||||
// if were not using arrays, we need to figure out what samples are what
|
// if were not using arrays, we need to figure out what samples are what
|
||||||
for(SAMReaderID id : getToolkit().getReadsDataSource().getReaderIDs()) {
|
for(SAMReaderID id : getToolkit().getReadsDataSource().getReaderIDs()) {
|
||||||
if (id.getTags().getPositionalTags().size() == 0)
|
if (id.getTags().getPositionalTags().isEmpty())
|
||||||
throw new UserException.BadInput("BAMs must be tagged with " + GENOTYPE_BAM_TAG + " and " + EVAL_BAM_TAG + " when running in array-free mode. Please see the ContEst documentation for more details");
|
throw new UserException.BadInput("BAMs must be tagged with " + GENOTYPE_BAM_TAG + " and " + EVAL_BAM_TAG + " when running in array-free mode. Please see the ContEst documentation for more details");
|
||||||
|
|
||||||
// now sort out what tags go with what bam
|
// now sort out what tags go with what bam
|
||||||
for (String tag : id.getTags().getPositionalTags()) {
|
for (String tag : id.getTags().getPositionalTags()) {
|
||||||
if (GENOTYPE_BAM_TAG.equalsIgnoreCase(tag)) {
|
if (GENOTYPE_BAM_TAG.equalsIgnoreCase(tag)) {
|
||||||
try {
|
try {
|
||||||
if (getToolkit().getReadsDataSource().getHeader(id).getReadGroups().size() == 0)
|
if (getToolkit().getReadsDataSource().getHeader(id).getReadGroups().isEmpty())
|
||||||
throw new RuntimeException("No Read Groups found for Genotyping BAM -- Read Groups are Required in sequencing genotype mode!");
|
throw new RuntimeException("No Read Groups found for Genotyping BAM -- Read Groups are Required in sequencing genotype mode!");
|
||||||
genotypeSample = getToolkit().getReadsDataSource().getHeader(id).getReadGroups().get(0).getSample();
|
genotypeSample = getToolkit().getReadsDataSource().getHeader(id).getReadGroups().get(0).getSample();
|
||||||
} catch (NullPointerException npe) {
|
} catch (NullPointerException npe) {
|
||||||
|
|
@ -279,7 +279,7 @@ public class ContEst extends RodWalker<Map<String, Map<String, ContaminationStat
|
||||||
}
|
}
|
||||||
} else if (EVAL_BAM_TAG.equalsIgnoreCase(tag)) {
|
} else if (EVAL_BAM_TAG.equalsIgnoreCase(tag)) {
|
||||||
try {
|
try {
|
||||||
if (getToolkit().getReadsDataSource().getHeader(id).getReadGroups().size() == 0)
|
if (getToolkit().getReadsDataSource().getHeader(id).getReadGroups().isEmpty())
|
||||||
throw new RuntimeException("No Read Groups found for Genotyping BAM -- Read Groups are Required in sequencing genotype mode!");
|
throw new RuntimeException("No Read Groups found for Genotyping BAM -- Read Groups are Required in sequencing genotype mode!");
|
||||||
evalSample = getToolkit().getReadsDataSource().getHeader(id).getReadGroups().get(0).getSample();
|
evalSample = getToolkit().getReadsDataSource().getHeader(id).getReadGroups().get(0).getSample();
|
||||||
} catch (NullPointerException npe) {
|
} catch (NullPointerException npe) {
|
||||||
|
|
@ -410,7 +410,7 @@ public class ContEst extends RodWalker<Map<String, Map<String, ContaminationStat
|
||||||
namePair.getKey(),
|
namePair.getKey(),
|
||||||
populationsToEvaluate);
|
populationsToEvaluate);
|
||||||
|
|
||||||
if (results.size() > 0) {
|
if (!results.isEmpty()) {
|
||||||
countResults++;
|
countResults++;
|
||||||
stats.put(namePair.getKey(), results);
|
stats.put(namePair.getKey(), results);
|
||||||
}
|
}
|
||||||
|
|
@ -498,7 +498,7 @@ public class ContEst extends RodWalker<Map<String, Map<String, ContaminationStat
|
||||||
private static Genotype getGenotypeFromArray(RefMetaDataTracker tracker, RodBinding<VariantContext> genotypes, boolean verifiedSampleName, boolean verifySample, String sampleName) {
|
private static Genotype getGenotypeFromArray(RefMetaDataTracker tracker, RodBinding<VariantContext> genotypes, boolean verifiedSampleName, boolean verifySample, String sampleName) {
|
||||||
// get the truthForSample and the hapmap information for this site; if either are null we can't move forward
|
// get the truthForSample and the hapmap information for this site; if either are null we can't move forward
|
||||||
Collection<VariantContext> truths = tracker.getValues(genotypes);
|
Collection<VariantContext> truths = tracker.getValues(genotypes);
|
||||||
if (truths == null || truths.size() == 0) return null;
|
if (truths == null || truths.isEmpty()) return null;
|
||||||
|
|
||||||
VariantContext truthForSample = truths.iterator().next();
|
VariantContext truthForSample = truths.iterator().next();
|
||||||
|
|
||||||
|
|
@ -506,7 +506,7 @@ public class ContEst extends RodWalker<Map<String, Map<String, ContaminationStat
|
||||||
if (!verifiedSampleName && verifySample) {
|
if (!verifiedSampleName && verifySample) {
|
||||||
if (!truthForSample.getSampleNames().contains(sampleName))
|
if (!truthForSample.getSampleNames().contains(sampleName))
|
||||||
throw new UserException.BadInput("The sample name was set to " + sampleName + " but this sample isn't in your genotypes file. Please Verify your sample name");
|
throw new UserException.BadInput("The sample name was set to " + sampleName + " but this sample isn't in your genotypes file. Please Verify your sample name");
|
||||||
verifiedSampleName = true;
|
verifiedSampleName = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
GenotypesContext gt = truthForSample.getGenotypes();
|
GenotypesContext gt = truthForSample.getGenotypes();
|
||||||
|
|
@ -622,6 +622,9 @@ public class ContEst extends RodWalker<Map<String, Map<String, ContaminationStat
|
||||||
|
|
||||||
for (String pop : pops) {
|
for (String pop : pops) {
|
||||||
PopulationFrequencyInfo info = parsePopulationFrequencyInfo(popVC, pop);
|
PopulationFrequencyInfo info = parsePopulationFrequencyInfo(popVC, pop);
|
||||||
|
if ( info == null )
|
||||||
|
throw new RuntimeException("No population frequency annotation for " + pop + " in " + popVC.toString());
|
||||||
|
|
||||||
double alleleFreq = info.getMinorAlleleFrequency();
|
double alleleFreq = info.getMinorAlleleFrequency();
|
||||||
if (alleleFreq > 0.5) {
|
if (alleleFreq > 0.5) {
|
||||||
throw new RuntimeException("Minor allele frequency is greater than 0.5, this is an error; we saw AF of " + alleleFreq);
|
throw new RuntimeException("Minor allele frequency is greater than 0.5, this is an error; we saw AF of " + alleleFreq);
|
||||||
|
|
@ -708,7 +711,7 @@ public class ContEst extends RodWalker<Map<String, Map<String, ContaminationStat
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (newMap.size() > 0)
|
if (!newMap.isEmpty())
|
||||||
cleanedMap.put(entry.getKey(), newMap);
|
cleanedMap.put(entry.getKey(), newMap);
|
||||||
else
|
else
|
||||||
out.println("Warning: We're throwing out lane " + entry.getKey() + " since it has fewer than " + minBaseCount +
|
out.println("Warning: We're throwing out lane " + entry.getKey() + " since it has fewer than " + minBaseCount +
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@
|
||||||
package org.broadinstitute.gatk.tools.walkers.cancer.contamination;
|
package org.broadinstitute.gatk.tools.walkers.cancer.contamination;
|
||||||
|
|
||||||
import org.broadinstitute.gatk.engine.walkers.WalkerTest;
|
import org.broadinstitute.gatk.engine.walkers.WalkerTest;
|
||||||
|
import org.broadinstitute.gatk.utils.exceptions.UserException;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -100,4 +101,17 @@ public class ContEstIntegrationTest extends WalkerTest {
|
||||||
" -isr INTERSECTION",md5sums);
|
" -isr INTERSECTION",md5sums);
|
||||||
executeTest("testArrayFree",spec);
|
executeTest("testArrayFree",spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(enabled = true)
|
||||||
|
public void testArrayNoPop(){
|
||||||
|
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||||
|
"-T ContEst" +
|
||||||
|
" -I:eval " + ContaminatedBamsDirectory + "HCC1143_BL.small.0.05.contaminated.with.SM-612V3.small.0.95.bam" +
|
||||||
|
" -I:genotype " + NormalBamsDirectory + "SM-612V4.bam" +
|
||||||
|
" -R " + b37KGReference +
|
||||||
|
" --popfile " + validationDataLocation + "hg19_population_stratified_af_hapmap_3.3.fixed_no_pop.vcf",
|
||||||
|
0,
|
||||||
|
UserException.class);
|
||||||
|
executeTest("testArrayNoPop",spec);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,7 @@ public class ASEReadCounter extends LocusWalker<String, Integer> {
|
||||||
final List<VariantContext> VCs = tracker.getValues(sites, context.getLocation());
|
final List<VariantContext> VCs = tracker.getValues(sites, context.getLocation());
|
||||||
if(VCs != null && VCs.size() > 1)
|
if(VCs != null && VCs.size() > 1)
|
||||||
throw new UserException("More then one variant context at position: "+contig+":"+position);
|
throw new UserException("More then one variant context at position: "+contig+":"+position);
|
||||||
if(VCs == null || VCs.size() == 0)
|
if(VCs == null || VCs.isEmpty())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
final VariantContext vc = VCs.get(0);
|
final VariantContext vc = VCs.get(0);
|
||||||
|
|
@ -211,7 +211,11 @@ public class ASEReadCounter extends LocusWalker<String, Integer> {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( vc.getNAlleles() == 1 || vc.getAlternateAllele(0).getBases().length == 0 )
|
||||||
|
throw new UserException("The file of variant sites must contain heterozygous sites and cannot be a GVCF file containing <NON_REF> alleles.");
|
||||||
|
|
||||||
final char altAllele = (char)vc.getAlternateAllele(0).getBases()[0];
|
final char altAllele = (char)vc.getAlternateAllele(0).getBases()[0];
|
||||||
|
|
||||||
final String siteID = vc.getID();
|
final String siteID = vc.getID();
|
||||||
final ReadBackedPileup pileup = filterPileup(context.getBasePileup(), countType, includeReadsWithDeletionAtLoci());
|
final ReadBackedPileup pileup = filterPileup(context.getBasePileup(), countType, includeReadsWithDeletionAtLoci());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -664,7 +664,7 @@ public class SelectVariants extends RodWalker<Integer, Integer> implements TreeR
|
||||||
"Samples entered on command line (through -sf or -sn) that are not present in the VCF.",
|
"Samples entered on command line (through -sf or -sn) that are not present in the VCF.",
|
||||||
"A list of these samples:",
|
"A list of these samples:",
|
||||||
Utils.join(",", commandLineUniqueSamples),
|
Utils.join(",", commandLineUniqueSamples),
|
||||||
"To ignore these samples, run with --allowNonOverlappingCommandLineSamples"));
|
"To ignore these samples, run with --ALLOW_NONOVERLAPPING_COMMAND_LINE_SAMPLES"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
package org.broadinstitute.gatk.tools.walkers.rnaseq;
|
package org.broadinstitute.gatk.tools.walkers.rnaseq;
|
||||||
|
|
||||||
import org.broadinstitute.gatk.engine.walkers.WalkerTest;
|
import org.broadinstitute.gatk.engine.walkers.WalkerTest;
|
||||||
|
import org.broadinstitute.gatk.utils.exceptions.UserException;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -100,6 +101,14 @@ public class ASEReadCounterIntegrationTest extends WalkerTest {
|
||||||
executeTest("test high mq with no read passing", spec);
|
executeTest("test high mq with no read passing", spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testASEReadCounterNonRef() {
|
||||||
|
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||||
|
"-T ASEReadCounter -R " + b37KGReference + " -I " + privateTestDir + "NA12878.RNAseq.bam -sites "+privateTestDir +"NA12878.chr20_2444518_2637800.RNAseq.NonRef.vcf -U ALLOW_N_CIGAR_READS", 0,
|
||||||
|
UserException.class);
|
||||||
|
executeTest("test <NON_REF> sites VCF file", spec);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -373,7 +373,7 @@ public class UserException extends ReviewedGATKException {
|
||||||
|
|
||||||
public static class LexicographicallySortedSequenceDictionary extends UserException {
|
public static class LexicographicallySortedSequenceDictionary extends UserException {
|
||||||
public LexicographicallySortedSequenceDictionary(String name, SAMSequenceDictionary dict) {
|
public LexicographicallySortedSequenceDictionary(String name, SAMSequenceDictionary dict) {
|
||||||
super(String.format("Lexicographically sorted human genome sequence detected in %s. Please see " + HelpConstants.forumPost("discussion/58/companion-utilities-reordersam") + "for more information. Error details: %s contigs = %s",
|
super(String.format("Lexicographically sorted human genome sequence detected in %s. Please see " + HelpConstants.articlePost("1328") + "for more information. Error details: %s contigs = %s",
|
||||||
name, name, ReadUtils.prettyPrintSequenceRecords(dict)));
|
name, name, ReadUtils.prettyPrintSequenceRecords(dict)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ public class HelpConstants {
|
||||||
|
|
||||||
public final static String BASE_GATK_URL = "http://www.broadinstitute.org/gatk";
|
public final static String BASE_GATK_URL = "http://www.broadinstitute.org/gatk";
|
||||||
public final static String GATK_DOCS_URL = BASE_GATK_URL + "/guide/tooldocs/";
|
public final static String GATK_DOCS_URL = BASE_GATK_URL + "/guide/tooldocs/";
|
||||||
|
public final static String GATK_ARTICLE_URL = BASE_GATK_URL + "/guide/article";
|
||||||
public final static String GATK_FORUM_URL = "http://gatkforums.broadinstitute.org/";
|
public final static String GATK_FORUM_URL = "http://gatkforums.broadinstitute.org/";
|
||||||
public final static String GATK_FORUM_API_URL = "https://gatkforums.broadinstitute.org/api/v1/";
|
public final static String GATK_FORUM_API_URL = "https://gatkforums.broadinstitute.org/api/v1/";
|
||||||
|
|
||||||
|
|
@ -61,6 +62,10 @@ public class HelpConstants {
|
||||||
return GATK_FORUM_URL + post;
|
return GATK_FORUM_URL + post;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String articlePost(String id) {
|
||||||
|
return GATK_ARTICLE_URL + "?id=" + id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Go-to developer name codes for tracking and display purposes. Only current team members should be in this list.
|
* Go-to developer name codes for tracking and display purposes. Only current team members should be in this list.
|
||||||
* When someone leaves, their charges should be redistributed. The actual string should be closest to the dev's
|
* When someone leaves, their charges should be redistributed. The actual string should be closest to the dev's
|
||||||
|
|
|
||||||
|
|
@ -372,7 +372,7 @@ public abstract class PairHMM {
|
||||||
{
|
{
|
||||||
doProfiling = (numThreads == 1);
|
doProfiling = (numThreads == 1);
|
||||||
if(numThreads > 1)
|
if(numThreads > 1)
|
||||||
logger.info("Performance profiling for PairHMM is disabled because HaplotypeCaller is being run with multiple threads (-nct>1) option\nProfiling is enabled only when running in single thread mode\n");
|
logger.info("Performance profiling for PairHMM is disabled because the program is being run with multiple threads (-nct>1) option\nProfiling is enabled only when running in single thread mode\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue