builder.noAttributes(); } else { builder.attributes(attributes);
gb.noAD(); gb.noPL(); gb.noAttributes(); break; case USE_PLS_TO_ASSIGN:
/** * @return a generic one-based position variant context with a heterozygous genotype having no attributes. */ private VariantContext buildVariantContext(int chr, int pos, String ref, String alt, double qual, String sampleName) { Allele refAllele = Allele.create(ref, true); Allele altAllele = Allele.create(alt); List<Allele> alleles = Arrays.asList(refAllele, altAllele); VariantContextBuilder vcBuilder = new VariantContextBuilder(); // build Genotype GenotypeBuilder gtBuilder = new GenotypeBuilder(sampleName).noAttributes(); //default to HETEROZYGOUS gtBuilder.alleles(alleles); // build VariantContext vcBuilder.loc("chr" + chr, pos, pos - 1L + ref.length()); vcBuilder.alleles(alleles); vcBuilder.genotypes(gtBuilder.make()); vcBuilder.log10PError(-0.1 * qual); return vcBuilder.make(); }
recoveredGs.add(builder.noAttributes().attributes(attrs).make());
public static VariantContextBuilder pruneVariantContext(final VariantContextBuilder builder, Collection<String> keysToPreserve ) { final VariantContext vc = builder.make(); if ( keysToPreserve == null ) keysToPreserve = Collections.emptyList(); // VC info final Map<String, Object> attributes = subsetAttributes(vc.getCommonInfo(), keysToPreserve); // Genotypes final GenotypesContext genotypes = GenotypesContext.create(vc.getNSamples()); for ( final Genotype g : vc.getGenotypes() ) { final GenotypeBuilder gb = new GenotypeBuilder(g); // remove AD, DP, PL, and all extended attributes, keeping just GT and GQ gb.noAD().noDP().noPL().noAttributes(); genotypes.add(gb.make()); } return builder.genotypes(genotypes).attributes(attributes); }
tests.add(new Object[]{dropMissing, vc, "./.:a", alleleMap, formatKeys}); tests.add(new Object[]{keepMissing, vc, "./.:a:.", alleleMap, formatKeys}); baseGT.noAttributes(); baseGT.noAttributes(); baseGT.noAttributes(); baseGT.noAttributes();
.noAttributes() .PL(haplotypeProbabilities.getLogLikelihoods()) .AD(new int[]{haplotypeProbabilities.getObsAllele1(), haplotypeProbabilities.getObsAllele2()})
.noAttributes() .PL(haplotypeProbabilities.getLogLikelihoods()) .AD(new int[]{haplotypeProbabilities.getObsAllele1(), haplotypeProbabilities.getObsAllele2()})
/** * Convert a HomRefBlock into a VariantContext * * @param block the block to convert * @return a VariantContext representing the gVCF encoding for this block. * It will return {@code null} if input {@code block} is {@code null}, indicating that there * is no variant-context to be output into the VCF. */ private VariantContext blockToVCF(final HomRefBlock block) { if ( block == null ) return null; final VariantContextBuilder vcb = new VariantContextBuilder(block.getStartingVC()); vcb.attributes(new HashMap<String, Object>(2)); // clear the attributes vcb.stop(block.getStop()); vcb.attribute(VCFConstants.END_KEY, block.getStop()); // create the single Genotype with GQ and DP annotations final GenotypeBuilder gb = new GenotypeBuilder(sampleName, GATKVariantContextUtils.homozygousAlleleList(block.getRef(),block.getPloidy())); gb.noAD().noPL().noAttributes(); // clear all attributes final int[] minPLs = block.getMinPLs(); gb.PL(minPLs); final int gq = GATKVariantContextUtils.calculateGQFromPLs(minPLs); gb.GQ(gq); gb.DP(block.getMedianDP()); gb.attribute(GATKVCFConstants.MIN_DP_FORMAT_KEY, block.getMinDP()); // This annotation is no longer standard //gb.attribute(MIN_GQ_FORMAT_FIELD, block.getMinGQ()); return vcb.genotypes(gb.make()).make(); }