Java Code Examples for htsjdk.variant.variantcontext.VariantContext#getFilters()

The following examples show how to use htsjdk.variant.variantcontext.VariantContext#getFilters() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EvaluateCopyNumberTriStateCallsIntegrationTest.java    From gatk-protected with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void assertOutputVariantFilters(EvaluationFiltersArgumentCollection filteringOptions, List<Target> overlappingTargets, VariantContext matchingOutput, double[] truthAF) {
    final Set<String> filters = new HashSet<>(matchingOutput.getFilters());
    filters.remove(VCFConstants.PASSES_FILTERS_v4); // don't if PASS is kept as a filter, just making sure that is not.
    if (overlappingTargets.size() < filteringOptions.minimumTruthSegmentLength) {
        Assert.assertTrue(filters.remove(EvaluationFilter.ShortEvent.name()));
    }
    if (truthAF[CopyNumberTriStateAllele.DEL.index() - 1] > 0 && truthAF[CopyNumberTriStateAllele.DUP.index() - 1] > 0 && filteringOptions.applyMultiAllelicTruthFilter) {
        Assert.assertTrue(filters.remove(EvaluationFilter.MultiAllelicTruth.name()));
    }
    if (MathUtils.sum(truthAF) > filteringOptions.maximumTruthEventFrequency) {
        Assert.assertTrue(filters.remove(EvaluationFilter.CommonEvent.name()));
    }
    Assert.assertTrue(filters.isEmpty(), "Remaining filters not explained: " + filters.stream().collect(Collectors.joining(",")));
}
 
Example 2
Source File: TestFilterVcf.java    From picard with MIT License 5 votes vote down vote up
/**
 * Consumes a VCF and returns a ListMap where each they keys are the IDs of filtered out sites and the values are the set of filters.
 */
private ListMap<String, String> slurpFilters(final File vcf) {
    final ListMap<String, String> map = new ListMap<>();
    final VCFFileReader in = new VCFFileReader(vcf, false);
    for (final VariantContext ctx : in) {
        if (ctx.isNotFiltered()) continue;
        for (final String filter : ctx.getFilters()) {
            map.add(ctx.getID(), filter);
        }
    }
    in.close();
    return map;
}
 
Example 3
Source File: KataegisEnrichment.java    From hmftools with GNU General Public License v3.0 4 votes vote down vote up
private static boolean isNotFiltered(@NotNull final VariantContext context) {
    final Set<String> filters = context.getFilters();
    return filters.isEmpty() || (filters.size() == 1 && filters.contains("PASS"));
}
 
Example 4
Source File: RecoveredVariantFactory.java    From hmftools with GNU General Public License v3.0 4 votes vote down vote up
@VisibleForTesting
static boolean isAppropriatelyFiltered(@NotNull VariantContext variantContext) {
    final Set<String> filters = variantContext.getFilters();
    return !filters.isEmpty() && filters.stream().noneMatch(DO_NOT_RESCUE::contains);
}