/** * Tells this builder that the resulting VariantContext should have PASS filters * * @return this builder */ public VariantContextBuilder passFilters() { return filters(VariantContext.PASSES_FILTERS); }
/** * Tells this builder that the resulting VariantContext should have PASS filters * * @return this builder */ public VariantContextBuilder passFilters() { return filters(VariantContext.PASSES_FILTERS); }
/** * Tells this builder that the resulting VariantContext should have PASS filters * * @return */ public VariantContextBuilder passFilters() { return filters(VariantContext.PASSES_FILTERS); }
/** * {@link #filters} * * @param filters Set of strings to set as the filters for this builder * @return this builder */ public VariantContextBuilder filters(final String ... filters) { filters(new LinkedHashSet<String>(Arrays.asList(filters))); return this; }
/** * {@link #filters} * * @param filters * @return */ public VariantContextBuilder filters(final String ... filters) { filters(new LinkedHashSet<String>(Arrays.asList(filters))); return this; }
/** * {@link #filters} * * @param filters Set of strings to set as the filters for this builder * @return this builder */ public VariantContextBuilder filters(final String ... filters) { filters(new LinkedHashSet<String>(Arrays.asList(filters))); return this; }
public VariantContextBuilder(final VariantContextBuilder parent) { if ( parent == null ) throw new IllegalArgumentException("BUG: VariantContext parent argument cannot be null in VariantContextBuilder"); this.alleles = parent.alleles; this.attributesCanBeModified = false; this.contig = parent.contig; this.genotypes = parent.genotypes; this.ID = parent.ID; this.log10PError = parent.log10PError; this.source = parent.source; this.start = parent.start; this.stop = parent.stop; this.fullyDecoded = parent.fullyDecoded; this.attributes(parent.attributes); this.filters(parent.filters); }
public VariantContextBuilder(VariantContextBuilder parent) { if ( parent == null ) throw new IllegalArgumentException("BUG: VariantContext parent argument cannot be null in VariantContextBuilder"); this.alleles = parent.alleles; this.attributesCanBeModified = false; this.contig = parent.contig; this.genotypes = parent.genotypes; this.ID = parent.ID; this.log10PError = parent.log10PError; this.source = parent.source; this.start = parent.start; this.stop = parent.stop; this.fullyDecoded = parent.fullyDecoded; this.attributes(parent.attributes); this.filters(parent.filters); }
public VariantContextBuilder(final VariantContextBuilder parent) { if ( parent == null ) throw new IllegalArgumentException("BUG: VariantContext parent argument cannot be null in VariantContextBuilder"); this.alleles = parent.alleles; this.attributesCanBeModified = false; this.contig = parent.contig; this.genotypes = parent.genotypes; this.ID = parent.ID; this.log10PError = parent.log10PError; this.source = parent.source; this.start = parent.start; this.stop = parent.stop; this.fullyDecoded = parent.fullyDecoded; this.attributes(parent.attributes); this.filters(parent.filters); }
/** * Add mask to variant context filters if it covers its location. * @param vc VariantContext * @param genomeLoc genome location * @param maskName name of the mask * @param maskExtension bases beyond the mask * @param locStart if true, start at genome location and end at VariantContext. If false, do the opposite. * @return VariantContext with the mask added if the VariantContext is within the extended mask area */ private VariantContext addMaskIfCoversVariant(VariantContext vc, final GenomeLoc genomeLoc, final String maskName, final int maskExtension, final boolean locStart) { if (doesMaskCoverVariant(vc, genomeLoc, maskName, maskExtension, locStart) ) { final Set<String> filters = new LinkedHashSet<>(vc.getFilters()); filters.add(maskName); vc = new VariantContextBuilder(vc).filters(filters).make(); } return vc; }
public VariantContext toVariantContext() { GenotypesContext gc = GenotypesContext.copy(this.genotypes.values()); return new VariantContextBuilder(name, contig, start, stop, alleles).id(id) .genotypes(gc).log10PError(log10PError).filters(filters).attributes(attributes).make(); }
private VariantContext makeVC(String source, List<Allele> alleles, Genotype... genotypes) { int start = 10; int stop = start; // alleles.contains(ATC) ? start + 3 : start; return new VariantContextBuilder(source, "1", start, stop, alleles).genotypes(Arrays.asList(genotypes)).filters((String)null).make(); }
private VariantContext makeVC(String source, List<Allele> alleles, Genotype... genotypes) { int start = 10; int stop = start; // alleles.contains(ATC) ? start + 3 : start; return new VariantContextBuilder(source, "1", start, stop, alleles) .genotypes(Arrays.asList(genotypes)) .filters((String)null) .make(); }
@DataProvider() public Iterator<Object[]> variantProvider() { final VariantContextBuilder vc_builder = new VariantContextBuilder("test", "chr1", 1, 1, Arrays.asList(refA, G)); final List<Object[]> variants = new ArrayList<Object[]>(10); // unfiltered variants.add(new Object[]{vc_builder.alleles(Arrays.asList(refA, G)).make(), true}); // passing variants.add(new Object[]{vc_builder.alleles(Arrays.asList(refA, G)).passFilters().make(), true}); // failing variants.add(new Object[]{vc_builder.alleles(Arrays.asList(refA, G)).filters(Collections.singleton("FILTER")).make(), false}); return variants.iterator(); }
private VariantContext makeVC(String source, List<Allele> alleles, Genotype... genotypes) { int start = 10; int stop = start; // alleles.contains(ATC) ? start + 3 : start; return new VariantContextBuilder(source, "1", start, stop, alleles) .genotypes(Arrays.asList(genotypes)) .filters((String)null) .make(); }
private VariantContext makeVC(String source, List<Allele> alleles, Genotype... genotypes) { int start = 10; int stop = start; // alleles.contains(ATC) ? start + 3 : start; return new VariantContextBuilder(source, "1", start, stop, alleles) .genotypes(Arrays.asList(genotypes)) .filters((String) null) .make(); }
/** * 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; } }
private VariantContext makeVC(String source, List<Allele> alleles, Collection<Genotype> genotypes, Set<String> filters) { int start = 10; int stop = start + alleles.get(0).length() - 1; // alleles.contains(ATC) ? start + 3 : start; return new VariantContextBuilder(source, "1", start, stop, alleles).genotypes(genotypes).filters(filters).make(); }
@Test public void testApplyGenotypeFilters(){ final VariantContext vc = buildDataForFilters().make(); final String filterName = "LowZ"; //an attribute that doesn't appear in the VariantContext, so there isn't any chance of confusion like with the INFO DP final String filterExpr = "Z < 10"; final List<VariantContextUtils.JexlVCMatchExp> genotypeFilterExps = VariantContextUtils.initializeMatchExps(Arrays.asList(filterName), Arrays.asList(filterExpr)); final VariantContextBuilder anotherVCBuilder = VariantFiltration.applyGenotypeFilters(vc, genotypeFilterExps, false, false, false); final VariantContext anotherVC = anotherVCBuilder.filters().make(); Assert.assertEquals(anotherVC.getGenotype("one").isFiltered(), true); Assert.assertTrue(anotherVC.getGenotype("one").getFilters().equals(filterName)); Assert.assertEquals(anotherVC.getGenotype("two").isFiltered(), false); Assert.assertEquals(anotherVC.getGenotype("three").isFiltered(), false); Assert.assertEquals(anotherVC.getGenotype("four").isFiltered(), false); Assert.assertEquals(anotherVC.getGenotype("five").isFiltered(), false); Assert.assertEquals(anotherVC.getGenotype("six").isFiltered(), false); final VariantContextBuilder yetAnotherVCBuilder = VariantFiltration.applyGenotypeFilters(anotherVC, genotypeFilterExps, false, true, false); final VariantContext yetAnotherVC = yetAnotherVCBuilder.filters().make(); Assert.assertEquals(yetAnotherVC.getGenotype("six").isFiltered(), true); Assert.assertTrue(yetAnotherVC.getGenotype("six").getFilters().equals(filterName)); }