Make sure that too many alternate alleles aren't being passed to the genotyper (10 for now) and exit with a UserError if there are.

This commit is contained in:
Eric Banks 2011-12-05 16:18:52 -05:00
parent 7fac4afab3
commit 7a0f6feda4
1 changed files with 10 additions and 1 deletions

View File

@ -38,6 +38,7 @@ import org.broadinstitute.sting.utils.*;
import org.broadinstitute.sting.utils.baq.BAQ;
import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.broadinstitute.sting.utils.pileup.PileupElement;
import org.broadinstitute.sting.utils.pileup.ReadBackedExtendedEventPileup;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
@ -80,7 +81,7 @@ public class UnifiedGenotyperEngine {
private ThreadLocal<double[][]> log10AlleleFrequencyPosteriors = new ThreadLocal<double[][]>();
// the maximum number of alternate alleles for genotyping supported by the genotyper; we fix this here so that the AF priors and posteriors can be initialized at startup
private static final int MAX_NUMBER_OF_ALTERNATE_ALLELES = 5;
private static final int MAX_NUMBER_OF_ALTERNATE_ALLELES = 10;
// the priors object
private final GenotypePriors genotypePriorsSNPs;
@ -302,6 +303,10 @@ public class UnifiedGenotyperEngine {
afcm.set(getAlleleFrequencyCalculationObject(N, logger, verboseWriter, UAC));
}
// don't try to genotype too many alternate alleles
if ( vc.getAlternateAlleles().size() > MAX_NUMBER_OF_ALTERNATE_ALLELES )
throw new UserException("the Unified Genotyper is currently not equipped to genotype more than " + MAX_NUMBER_OF_ALTERNATE_ALLELES + " alternate alleles in a given context, but the context at " + vc.getChr() + ":" + vc.getStart() + " has " + vc.getAlternateAlleles().size() + " alternate alleles");
// estimate our confidence in a reference call and return
if ( vc.getNSamples() == 0 )
return (UAC.OutputMode != OUTPUT_MODE.EMIT_ALL_SITES ?
@ -447,6 +452,10 @@ public class UnifiedGenotyperEngine {
afcm.set(getAlleleFrequencyCalculationObject(N, logger, verboseWriter, UAC));
}
// don't try to genotype too many alternate alleles
if ( vc.getAlternateAlleles().size() > MAX_NUMBER_OF_ALTERNATE_ALLELES )
throw new UserException("the Unified Genotyper is currently not equipped to genotype more than " + MAX_NUMBER_OF_ALTERNATE_ALLELES + " alternate alleles in a given context, but the context at " + vc.getChr() + ":" + vc.getStart() + " has " + vc.getAlternateAlleles().size() + " alternate alleles");
// estimate our confidence in a reference call and return
if ( vc.getNSamples() == 0 )
return null;