diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/StrandBiasBySample.java b/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/StrandBiasBySample.java index fde344e9f..4b1e48a36 100644 --- a/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/StrandBiasBySample.java +++ b/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/StrandBiasBySample.java @@ -80,12 +80,9 @@ public class StrandBiasBySample extends GenotypeAnnotation implements Experiment final Genotype g, final GenotypeBuilder gb, final PerReadAlleleLikelihoodMap alleleLikelihoodMap) { - if ( g == null || !g.isCalled() || ( stratifiedContext == null && alleleLikelihoodMap == null) ) + if ( ! isAppropriateInput(alleleLikelihoodMap, g) ) return; - if (alleleLikelihoodMap == null ) - throw new IllegalStateException("StrandBiasBySample can only be used with likelihood based annotations in the HaplotypeCaller"); - final int[][] table = FisherStrand.getContingencyTable(Collections.singletonMap(g.getSampleName(), alleleLikelihoodMap), vc); gb.attribute(STRAND_BIAS_BY_SAMPLE_KEY_NAME, FisherStrand.getContingencyArray(table)); @@ -97,4 +94,7 @@ public class StrandBiasBySample extends GenotypeAnnotation implements Experiment @Override public List getDescriptions() { return Collections.singletonList(new VCFFormatHeaderLine(getKeyNames().get(0), 4, VCFHeaderLineType.Integer, "Per-sample component statistics which comprise the Fisher's Exact Test to detect strand bias.")); } + private boolean isAppropriateInput(final PerReadAlleleLikelihoodMap map, final Genotype g) { + return ! (map == null || g == null || !g.isCalled()); + } }