/** * Update the FILTER field of <code>builder</code> given the * {@link VariantEvaluation}. */ private void updateFilterField(VariantContextBuilder builder, VariantEvaluation variantEvaluation, ModeOfInheritance modeOfInheritance) { switch (variantEvaluation.getFilterStatusForMode(modeOfInheritance)) { case FAILED: builder.filters(makeFailedFilters(variantEvaluation.getFailedFilterTypesForMode(modeOfInheritance))); break; case PASSED: builder.filter("PASS"); break; case UNFILTERED: default: builder.filter("."); break; } }
/** * Decode the filter field of this BCF2 file and store the result in the builder * @param builder */ private void decodeFilter( final VariantContextBuilder builder ) throws IOException { final Object value = decoder.decodeTypedValue(); if ( value == null ) builder.unfiltered(); else { if ( value instanceof Integer ) { // fast path for single integer result final String filterString = getDictionaryString((Integer)value); if ( VCFConstants.PASSES_FILTERS_v4.equals(filterString)) builder.passFilters(); else builder.filter(filterString); } else { for ( final int offset : (List<Integer>)value ) builder.filter(getDictionaryString(offset)); } } }
/** * Decode the filter field of this BCF2 file and store the result in the builder * @param builder */ private void decodeFilter( final VariantContextBuilder builder ) throws IOException { final Object value = decoder.decodeTypedValue(); if ( value == null ) builder.unfiltered(); else { if ( value instanceof Integer ) { // fast path for single integer result final String filterString = getDictionaryString((Integer)value); if ( VCFConstants.PASSES_FILTERS_v4.equals(filterString)) builder.passFilters(); else builder.filter(filterString); } else { for ( final int offset : (List<Integer>)value ) builder.filter(getDictionaryString(offset)); } } }
/** * Decode the filter field of this BCF2 file and store the result in the builder * @param builder */ private void decodeFilter( final VariantContextBuilder builder ) throws IOException { final Object value = decoder.decodeTypedValue(); if ( value == null ) builder.unfiltered(); else { if ( value instanceof Integer ) { // fast path for single integer result final String filterString = getDictionaryString((Integer)value); if ( VCFConstants.PASSES_FILTERS_v4.equals(filterString)) builder.passFilters(); else builder.filter(filterString); } else { for ( final int offset : (List<Integer>)value ) builder.filter(getDictionaryString(offset)); } } }
if (len > b.length) b = new byte[len]; in.readFully(b, 0, len); builder.filter(new String(b, 0, len, "UTF-8"));
if (len > b.length) b = new byte[len]; in.readFully(b, 0, len); builder.filter(new String(b, 0, len, "UTF-8"));
if (len > b.length) b = new byte[len]; in.readFully(b, 0, len); builder.filter(new String(b, 0, len, "UTF-8"));
private void rejectVariant(final VariantContext ctx, final String reason) { rejects.add(new VariantContextBuilder(ctx).filter(reason).make()); failedLiftover++; trackLiftedVariantContig(rejectsByContig, ctx.getContig()); }
private void rejectVariant(final VariantContext ctx, final String reason) { rejects.add(new VariantContextBuilder(ctx).filter(reason).make()); failedLiftover++; trackLiftedVariantContig(rejectsByContig, ctx.getContig()); }
public VariantContextDirectedEvidence applyFilters(VariantContextDirectedEvidence variant) { List<VcfFilter> filters = processContext.getVariantCallingParameters().calculateCommonFilters(variant); if (variant instanceof VariantContextDirectedBreakpoint) { filters.addAll(processContext.getVariantCallingParameters().calculateBreakpointFilters((VariantContextDirectedBreakpoint)variant)); } else { filters.addAll(processContext.getVariantCallingParameters().calculateSingleBreakendFilters(variant)); } if (!filters.isEmpty()) { VariantContextBuilder builder = new VariantContextBuilder(variant); for (VcfFilter f : filters) { builder.filter(f.filter()); } variant = (VariantContextDirectedEvidence)IdsvVariantContext.create(processContext, variant.source, builder.make()); } return variant; } private static Ordering<DirectedEvidence> ByBestBreakendDesc = new Ordering<DirectedEvidence>() {
builder.filter(VcfFilter.REFERENCE_ALLELE.filter()); } else { int homBefore = homLenBefore(e.type, e.size, e.start);
.filter(filter); // TODO jmmut: join attributes from different source entries? what to do on a collision?
/** * @return Variant context indicating error */ private VariantContext buildErrorVariantContext(String origString, String message) { Allele alleleRef = Allele.create("N", true); Allele alleleAlt = Allele.create("<ERROR>", false); return new VariantContextBuilder().loc("1", 1, 1).alleles(Lists.newArrayList(alleleRef, alleleAlt)) .filter("PARSE_ERROR").attribute("ORIG_VAR", urlEncode(origString)) .attribute("ERROR_MESSAGE", urlEncode(message)).make(); }
tests.add(new Object[]{callNoIDAT, Arrays.asList(dbSNP_AC_AG), VCFConstants.EMPTY_ID_FIELD, false}); final VariantContext dbSNP_AC_FAIL = new VariantContextBuilder(makeVC("DBSNP", "rsID1", Arrays.asList("A", "C"))).filter("FAIL").make(); tests.add(new Object[]{callNoIDAC, Arrays.asList(dbSNP_AC_FAIL), VCFConstants.EMPTY_ID_FIELD, false});
builder.filter(filter);
/** * Test doesMaskCoverVariant() logic * * @param contig chromosome or contig name * @param start variant context start * @param stop variant context stop * @param maskName mask or filter name * @param maskExtension bases beyond the mask * @param vcBeforeLoc if true, variant context is before the genome location; if false, the converse is true. * @param expectedValue return the expected return value from doesMaskCoverVariant() */ @Test(dataProvider = "doesMaskCoverVariantTestData") public void testDoesMaskCoverVariant(final String contig, final int start, final int stop, final String maskName, final int maskExtension, final boolean vcBeforeLoc, final boolean expectedValue) { // Build VariantContext final byte[] allele1 = Utils.dupBytes((byte) 'A', 1); final byte[] allele2 = Utils.dupBytes((byte) 'T', 2); final List<Allele> alleles = new ArrayList<Allele>(2); final Allele ref = Allele.create(allele1, true); final Allele alt = Allele.create(allele2, false); alleles.add(ref); alleles.add(alt); final VariantContext vc = new VariantContextBuilder("test", contig, start, stop, alleles).filter(vcFilter).make(); boolean coversVariant = VariantFiltration.doesMaskCoverVariant(vc, genomeLoc, maskName, maskExtension, vcBeforeLoc); Assert.assertEquals(coversVariant, expectedValue); }
.filter(FILTER_MISMATCHING_REF_ALLELE) .attribute(ATTEMPTED_LOCUS, String.format("%s:%d-%d", vc.getContig(), vc.getStart(), vc.getEnd())) .attribute(ATTEMPTED_ALLELES, vc.getReference().toString() + "->" + String.join(",", vc.getAlternateAlleles().stream().map(Allele::toString).collect(Collectors.toList())))
.filter(FILTER_MISMATCHING_REF_ALLELE) .attribute(ATTEMPTED_LOCUS, String.format("%s:%d-%d", vc.getContig(), vc.getStart(), vc.getEnd())) .attribute(ATTEMPTED_ALLELES, vc.getReference().toString() + "->" + String.join(",", vc.getAlternateAlleles().stream().map(Allele::toString).collect(Collectors.toList())))
callVcb.attribute(GATKVCFConstants.NORMAL_LOD_KEY, normalLods.getAlt(alleleWithHighestTumorLOD)); if (normalLods.getAlt(alleleWithHighestTumorLOD) < normalLodFilterThreshold) { callVcb.filter(GATKVCFConstants.GERMLINE_RISK_FILTER_NAME); callVcb.filter(GATKVCFConstants.STRAND_ARTIFACT_FILTER_NAME); callVcb.filter(GATKVCFConstants.TRIALLELIC_SITE_FILTER_NAME);
builder.filter(GATKVCFConstants.LOW_QUAL_FILTER_NAME);