@Override public void decode(final List<Allele> siteAlleles, final String field, final BCF2Decoder decoder, final byte typeDescriptor, final int numElements, final GenotypeBuilder[] gbs) throws IOException { for ( final GenotypeBuilder gb : gbs ) { gb.PL(decoder.decodeIntArray(typeDescriptor, numElements)); } } }
@Override public void decode(final List<Allele> siteAlleles, final String field, final BCF2Decoder decoder, final byte typeDescriptor, final int numElements, final GenotypeBuilder[] gbs) throws IOException { for ( final GenotypeBuilder gb : gbs ) { gb.PL(decoder.decodeIntArray(typeDescriptor, numElements)); } } }
@Override public void decode(final List<Allele> siteAlleles, final String field, final BCF2Decoder decoder, final byte typeDescriptor, final int numElements, final GenotypeBuilder[] gbs) throws IOException { for ( final GenotypeBuilder gb : gbs ) { gb.PL(decoder.decodeIntArray(typeDescriptor, numElements)); } } }
protected static Genotype create(final String sampleName, final List<Allele> alleles, final double[] gls) { return new GenotypeBuilder(sampleName, alleles).PL(gls).make(); }
protected static Genotype create(final String sampleName, final List<Allele> alleles, final double[] gls) { return new GenotypeBuilder(sampleName, alleles).PL(gls).make(); }
protected static Genotype create(final String sampleName, final List<Allele> alleles, final double[] gls) { return new GenotypeBuilder(sampleName, alleles).PL(gls).make(); }
public Genotype makePL(final List<Allele> expectedGT, int ... pls) { GenotypeBuilder gb = new GenotypeBuilder("sample" + sampleNameCounter++); gb.alleles(expectedGT); gb.PL(pls); return gb.make(); }
private static Genotype createGenotype(String name, double[] gls, int ploidy) { Allele[] alleles = new Allele[ploidy]; for (int i=0; i < ploidy; i++) alleles[i] = Allele.NO_CALL; return new GenotypeBuilder(name, Arrays.asList(alleles)).PL(gls).make(); }
private Genotype makeGwithPLs(String sample, Allele a1, Allele a2, double[] pls) { Genotype gt = new GenotypeBuilder(sample, Arrays.asList(a1, a2)).PL(pls).make(); if (pls != null && pls.length > 0) { Assert.assertNotNull(gt.getPL()); Assert.assertTrue(gt.getPL().length > 0); for (int i : gt.getPL()) { Assert.assertTrue(i >= 0); } Assert.assertNotEquals(Arrays.toString(gt.getPL()), "[0]"); } return gt; }
private Genotype makeGwithPLs(String sample, Allele a1, Allele a2, double[] pls) { Genotype gt = new GenotypeBuilder(sample, Arrays.asList(a1, a2)).PL(pls).make(); if ( pls != null && pls.length > 0 ) { Assert.assertNotNull(gt.getPL()); Assert.assertTrue(gt.getPL().length > 0); for ( int i : gt.getPL() ) { Assert.assertTrue(i >= 0); } Assert.assertNotEquals(Arrays.toString(gt.getPL()),"[0]"); } return gt; }
private Genotype makeGwithPLs(String sample, Allele a1, Allele a2, double[] pls) { Genotype gt = new GenotypeBuilder(sample, Arrays.asList(a1, a2)).PL(pls).make(); if ( pls != null && pls.length > 0 ) { Assert.assertNotNull(gt.getPL()); Assert.assertTrue(gt.getPL().length > 0); for ( int i : gt.getPL() ) { Assert.assertTrue(i >= 0); } Assert.assertNotEquals(Arrays.toString(gt.getPL()),"[0]"); } return gt; }
private Genotype makeGwithPLs(String sample, Allele a1, Allele a2, double[] pls) { Genotype gt = new GenotypeBuilder(sample, Arrays.asList(a1, a2)).PL(pls).make(); if ( pls != null && pls.length > 0 ) { Assert.assertNotNull(gt.getPL()); Assert.assertTrue(gt.getPL().length > 0); for ( int i : gt.getPL() ) { Assert.assertTrue(i >= 0); } Assert.assertNotEquals(Arrays.toString(gt.getPL()),"[0]"); } return gt; }
protected static Genotype makePL(final List<Allele> expectedGT, int ... pls) { GenotypeBuilder gb = new GenotypeBuilder("sample" + sampleNameCounter++); gb.alleles(expectedGT); gb.PL(pls); return gb.make(); }
public PNonRefData scale(final int scaleFactor) { if ( canScale ) { final int[] PLs = new int[g.getPL().length]; for ( int i = 0; i < PLs.length; i++ ) PLs[i] = g.getPL()[i] * ((int)Math.log10(scaleFactor)+1); final Genotype scaledG = new GenotypeBuilder(g).PL(PLs).make(); final double scaledPNonRef = pNonRef < 0.5 ? pNonRef / scaleFactor : 1 - ((1-pNonRef) / scaleFactor); return new PNonRefData(vc, scaledG, scaledPNonRef, tolerance, true); } else { return this; } } }
private VariantContext makeHomRefAlt(final String contig, final int start, final int GQ) { final VariantContextBuilder vcb = new VariantContextBuilder("test", contig, start, start, Arrays.asList(REF, ALT)); final GenotypeBuilder gb = new GenotypeBuilder(SAMPLE_NAME, Arrays.asList(REF, REF)); gb.GQ(GQ); gb.DP(10); gb.AD(new int[]{1, 2}); gb.PL(new int[]{0, 10, 100}); return vcb.genotypes(gb.make()).make(); }
private VariantContext makeNonRef(final String contig, final int start, final int GQ) { final VariantContextBuilder vcb = new VariantContextBuilder("test", contig, start, start, Arrays.asList(REF, ALT)); final GenotypeBuilder gb = new GenotypeBuilder(SAMPLE_NAME, Arrays.asList(REF, ALT)); gb.GQ(GQ); gb.DP(10); gb.AD(new int[]{1, 2}); gb.PL(new int[]{0, 10, 100}); return vcb.genotypes(gb.make()).make(); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testBadAdd() { final HomRefBlock band = new HomRefBlock(vc, 10, 20, HomoSapiensConstants.DEFAULT_PLOIDY); final GenotypeBuilder gb = new GenotypeBuilder("NA12878"); band.add(vc.getStart() + 10, gb.DP(10).GQ(11).PL(new int[]{0,10,100}).make()); }
private VariantContext makeDeletion(final String contig, final int start, final int size) { final String del = Utils.dupString("A", size); final String alt = del.substring(0, 1); final VariantContext vc = GATKVariantContextUtils.makeFromAlleles("test", contig, start, Arrays.asList(del, alt)); final VariantContextBuilder vcb = new VariantContextBuilder(vc); final GenotypeBuilder gb = new GenotypeBuilder(SAMPLE_NAME, Arrays.asList(vc.getReference(), vc.getAlternateAllele(0))); gb.GQ(50); gb.DP(10); gb.AD(new int[]{1, 2}); gb.PL(new int[]{0, 10, 100}); return vcb.genotypes(gb.make()).make(); }
private VariantContext makeHomRef(final String contig, final int start, final int GQ) { final VariantContextBuilder vcb = new VariantContextBuilder("test", contig, start, start, ALLELES); final GenotypeBuilder gb = new GenotypeBuilder(SAMPLE_NAME, Arrays.asList(REF, REF)); gb.GQ(GQ); gb.DP(10); gb.AD(new int[]{1, 2}); gb.PL(new int[]{0, 10, 100}); return vcb.genotypes(gb.make()).make(); }
@Test public void testBigGQIsCapped() { final HomRefBlock band = new HomRefBlock(vc, 10, 20, HomoSapiensConstants.DEFAULT_PLOIDY); final GenotypeBuilder gb = new GenotypeBuilder("NA12878"); gb.alleles(vc.getAlleles()); band.add(vc.getStart(), gb.DP(1000).GQ(1000).PL(new int[]{0,10,100}).make()); assertValues(band, 1000, 1000, 99, 99); }