/** * Tells us that the resulting VariantContext should not have an ID * @return this builder */ public VariantContextBuilder noID() { return id(VCFConstants.EMPTY_ID_FIELD); }
/** * Tells us that the resulting VariantContext should not have an ID * @return this builder */ public VariantContextBuilder noID() { return id(VCFConstants.EMPTY_ID_FIELD); }
/** * Tells us that the resulting VariantContext should not have an ID * @return */ public VariantContextBuilder noID() { return id(VCFConstants.EMPTY_ID_FIELD); }
/** * Decode the id field in this BCF2 file and store it in the builder * @param builder */ private void decodeID( final VariantContextBuilder builder ) throws IOException { final String id = (String)decoder.decodeTypedValue(); if ( id == null ) builder.noID(); else builder.id(id); }
/** * Decode the id field in this BCF2 file and store it in the builder * @param builder */ private void decodeID( final VariantContextBuilder builder ) throws IOException { final String id = (String)decoder.decodeTypedValue(); if ( id == null ) builder.noID(); else builder.id(id); }
/** * Decode the id field in this BCF2 file and store it in the builder * @param builder */ private void decodeID( final VariantContextBuilder builder ) throws IOException { final String id = (String)decoder.decodeTypedValue(); if ( id == null ) builder.noID(); else builder.id(id); }
@Test (expectedExceptions = Exception.class) public void testBadID2() { new VariantContextBuilder("test", delLoc, delLocStart, delLocStop, Arrays.asList(Aref, T)).id("").make(); }
@Test (expectedExceptions = Throwable.class) public void testBadID1() { new VariantContextBuilder("test", delLoc, delLocStart, delLocStop, Arrays.asList(Aref, T)).id(null).make(); }
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(); }
@Test(enabled = !DEBUG, dataProvider = "simplemergersiddata") public void testRSIDMerge(SimpleMergeRSIDTest cfg) { VariantContext snpVC1 = makeVC("snpvc1", Arrays.asList(Aref, T)); final List<VariantContext> inputs = new ArrayList<VariantContext>(); for ( final String id : cfg.inputs ) { inputs.add(new VariantContextBuilder(snpVC1).id(id).make()); } final VariantContext merged = GATKVariantContextUtils.simpleMerge( inputs, null, GATKVariantContextUtils.FilteredRecordMergeType.KEEP_IF_ANY_UNFILTERED, GATKVariantContextUtils.GenotypeMergeType.UNSORTED, false, false, "set", false, false); Assert.assertEquals(merged.getID(), cfg.expected); }
private VariantContext makeVC(final String source, final String id, final List<String> alleles) { final VariantContext vc = GATKVariantContextUtils.makeFromAlleles(source, "20", 10, alleles); return new VariantContextBuilder(vc).id(id).make(); }
@Test public void TestMergeIntoMNPvalidationDiffContigs() { final String contig = new String("2"); final VariantContext vc = new VariantContextBuilder().chr(contig).id("id1").source("TC").start(start+1).stop(start+1).alleles(alleleList2).genotypes(genotype2).make(); Assert.assertFalse(PhasingUtils.mergeIntoMNPvalidationCheck(genomeLocParser, vc1, vc)); }
@Test public void TestAllGenotypesAreUnfilteredAndCalled(){ final VariantContext vc = new VariantContextBuilder().chr(contig).id("id1").source("TC").start(start).stop(start).alleles(alleleList1).genotypes(genotype1).make(); Assert.assertTrue(PhasingUtils.allGenotypesAreUnfilteredAndCalled(vc)); }
@Test public void TestMergeIntoMNPvalidationCheckLocBefore() { final VariantContext vc1before = new VariantContextBuilder().chr(contig).id("id1").source("TC").start(start+1).stop(start+1).alleles(alleleList1).make(); final VariantContext vc2after = new VariantContextBuilder().chr(contig).id("id2").source("GA").start(start).stop(start).alleles(alleleList2).make(); Assert.assertFalse(PhasingUtils.mergeIntoMNPvalidationCheck(genomeLocParser, vc1before, vc2after)); }
@Test public void TestMergeIntoMNPvalidationFilterNoCall() { final List<String> filters = Arrays.asList("filter"); final List<Allele> alleleList = Arrays.asList(Allele.create("T", true), Allele.create(".", false)); final Genotype genotype = new GenotypeBuilder().name("sample").attribute("HP", new String[]{"10-1", "10-2"}).alleles(alleleList).filters(filters).make(); final VariantContext vc = new VariantContextBuilder().chr(contig).id("id1").source("TC").start(start).stop(start).alleles(alleleList1).genotypes(genotype).make(); Assert.assertFalse(PhasingUtils.mergeIntoMNPvalidationCheck(genomeLocParser, vc, vc2)); }
@Test public void TestMergeIntoMNPvalidationFiltered() { final List<String> filters = Arrays.asList("filter"); final Genotype genotype = new GenotypeBuilder().name("sample").attribute("HP", new String[]{"10-1", "10-2"}).alleles(alleleList1).filters(filters).make(); final VariantContext vc = new VariantContextBuilder().chr(contig).id("id1").source("TC").start(start).stop(start).alleles(alleleList1).genotypes(genotype).make(); Assert.assertFalse(PhasingUtils.mergeIntoMNPvalidationCheck(genomeLocParser, vc, vc2)); }
@Test public void TestSomeSampleHasDoubleNonReferenceAlleleTrue(){ Genotype genotype = new GenotypeBuilder().name("sample").attribute("HP", new String[]{"10-1", "10-2"}).alleles(alleleList2).make(); VariantContext vc = new VariantContextBuilder().chr(contig).id("id2").source("GA").start(start+1).stop(start+1).alleles(alleleList2).genotypes(genotype).make(); Assert.assertTrue(PhasingUtils.someSampleHasDoubleNonReferenceAllele(vc1, vc)); }
@Test public void TestMergeIntoMNPvalidationDiffSampleNames() { final Genotype genotype = new GenotypeBuilder().name("sample1").attribute("HP", new String[]{"10-1", "10-2"}).alleles(alleleList1).make(); final VariantContext vc = new VariantContextBuilder().chr(contig).id("id1").source("TC").start(start).stop(start).alleles(alleleList1).genotypes(genotype).make(); Assert.assertFalse(PhasingUtils.mergeIntoMNPvalidationCheck(genomeLocParser, vc, vc2)); }
@Test public void TestDoubleAllelesSegregatePerfectlyAmongSamples(){ final Genotype genotype = new GenotypeBuilder().name("sample").attribute("HP", new String[]{"10-1", "10-2"}).alleles(alleleList2).make(); final VariantContext vc = new VariantContextBuilder().chr(contig).id("id2").source("GA").start(start+1).stop(start+1).alleles(alleleList2).genotypes(genotype).make(); Assert.assertTrue(PhasingUtils.doubleAllelesSegregatePerfectlyAmongSamples(vc1, vc)); }
@BeforeSuite public void init() throws FileNotFoundException { referenceFile = new CachingIndexedFastaSequenceFile(new File(b37KGReference)); genomeLocParser = new GenomeLocParser(referenceFile); alleleList1 = Arrays.asList(Allele.create("T", true), Allele.create("C", false)); alleleList2 = Arrays.asList(Allele.create("G", true), Allele.create("A", false)); genotype1 = new GenotypeBuilder().name("sample").attribute("HP", new String[]{"10-1", "10-2"}).attribute("PQ", 100.0).alleles(alleleList1).make(); genotype2 = new GenotypeBuilder().name("sample").attribute("HP", new String[]{"10-2", "10-1"}).attribute("PQ", 200.0).alleles(alleleList2).make(); contig = new String("1"); vc1 = new VariantContextBuilder().chr(contig).id("id1").source("TC").start(start).stop(start).alleles(alleleList1).genotypes(genotype1).make(); vc2 = new VariantContextBuilder().chr(contig).id("id2").source("GA").start(start+1).stop(start+1).alleles(alleleList2).genotypes(genotype2).make(); }