Merge pull request #458 from broadinstitute/eb_dont_fail_when_using_incompatible_annotation
Don't fail in annotations if the wrong tools are calling them, just silently skip them.
This commit is contained in:
commit
9355598129
|
|
@ -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<VCFFormatHeaderLine> 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());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue