use of htsjdk.variant.variantcontext.VariantContextBuilder in project gatk by broadinstitute.
the class MappingQualityZeroUnitTest method makeVC.
private VariantContext makeVC() {
final GenotypesContext testGC = GenotypesContext.create(2);
final Allele refAllele = Allele.create("A", true);
final Allele altAllele = Allele.create("T");
return (new VariantContextBuilder()).alleles(Arrays.asList(refAllele, altAllele)).chr("1").start(15L).stop(15L).genotypes(testGC).make();
}
use of htsjdk.variant.variantcontext.VariantContextBuilder in project gatk by broadinstitute.
the class ReadThreadingAssemblerUnitTest method testAssembleRefAndSNP.
@Test(dataProvider = "AssembleIntervalsWithVariantData")
public void testAssembleRefAndSNP(final ReadThreadingAssembler assembler, final SimpleInterval loc, final int nReadsToUse, final int variantSite) {
final byte[] refBases = seq.getSubsequenceAt(loc.getContig(), loc.getStart(), loc.getEnd()).getBases();
final Allele refBase = Allele.create(refBases[variantSite], true);
final Allele altBase = Allele.create((byte) (refBase.getBases()[0] == 'A' ? 'C' : 'A'), false);
final VariantContextBuilder vcb = new VariantContextBuilder("x", loc.getContig(), variantSite, variantSite, Arrays.asList(refBase, altBase));
testAssemblyWithVariant(assembler, refBases, loc, nReadsToUse, vcb.make());
}
use of htsjdk.variant.variantcontext.VariantContextBuilder in project gatk by broadinstitute.
the class SVVariantConsensusDiscovery method discoverVariantsFromConsensus.
// TODO: 12/12/16 does not handle translocation yet
/**
* Produces a VC from a {@link NovelAdjacencyReferenceLocations} (consensus among different assemblies if they all point to the same breakpoint).
*
* @param breakpointPairAndItsEvidence consensus among different assemblies if they all point to the same breakpoint
* @param broadcastReference broadcasted reference
* @throws IOException due to read operations on the reference
*/
public static VariantContext discoverVariantsFromConsensus(final Tuple2<NovelAdjacencyReferenceLocations, Iterable<ChimericAlignment>> breakpointPairAndItsEvidence, final Broadcast<ReferenceMultiSource> broadcastReference) throws IOException {
final NovelAdjacencyReferenceLocations novelAdjacencyReferenceLocations = breakpointPairAndItsEvidence._1;
final Iterable<ChimericAlignment> evidence = breakpointPairAndItsEvidence._2();
final String contig = novelAdjacencyReferenceLocations.leftJustifiedLeftRefLoc.getContig();
final int start = novelAdjacencyReferenceLocations.leftJustifiedLeftRefLoc.getEnd();
final int end = novelAdjacencyReferenceLocations.leftJustifiedRightRefLoc.getStart();
Utils.validateArg(start <= end, "An identified breakpoint pair has left breakpoint positioned to the right of right breakpoint: " + novelAdjacencyReferenceLocations.toString());
final SvType variant = getType(novelAdjacencyReferenceLocations);
final VariantContextBuilder vcBuilder = new VariantContextBuilder().chr(contig).start(start).stop(end).alleles(produceAlleles(novelAdjacencyReferenceLocations, broadcastReference.getValue(), variant)).id(variant.getVariantId()).attribute(VCFConstants.END_KEY, end).attribute(GATKSVVCFHeaderLines.SVTYPE, variant.toString()).attribute(GATKSVVCFHeaderLines.SVLEN, variant.getSVLength());
variant.getTypeSpecificAttributes().forEach(vcBuilder::attribute);
parseComplicationsAndMakeThemAttributeMap(novelAdjacencyReferenceLocations).forEach(vcBuilder::attribute);
getEvidenceRelatedAnnotations(evidence).forEach(vcBuilder::attribute);
return vcBuilder.make();
}
use of htsjdk.variant.variantcontext.VariantContextBuilder in project gatk by broadinstitute.
the class GenotypingEngineUnitTest method init.
@BeforeTest
public void init() {
genotypingEngine = getGenotypingEngine();
final int deletionSize = refAllele.length() - altT.length();
final int start = 1;
final VariantContext deletionVC = new VariantContextBuilder("testDeletion", "1", start, start + deletionSize, allelesDel).make();
genotypingEngine.recordDeletion(deletionSize, deletionVC);
}
use of htsjdk.variant.variantcontext.VariantContextBuilder in project gatk by broadinstitute.
the class FilterMutectCalls method onTraversalSuccess.
@Override
public Object onTraversalSuccess() {
final String tumorSample = getHeaderForVariants().getMetaDataLine(Mutect2Engine.TUMOR_SAMPLE_KEY_IN_VCF_HEADER).getValue();
final Mutect2FilteringEngine filteringEngine = new Mutect2FilteringEngine(MTFAC, tumorSample);
// TODO: implement sophisticated filtering
for (final VariantContext vc : unfilteredCalls) {
final VariantContextBuilder vcb = new VariantContextBuilder(vc);
vcb.filters(filteringEngine.calculateFilters(MTFAC, vc));
vcfWriter.add(vcb.make());
}
return "SUCCESS";
}
Aggregations