Package htsjdk.variant.variantcontext

Examples of htsjdk.variant.variantcontext.VariantContext


                                                                          final RodBinding<VariantContext> allelesBinding) {
        if ( tracker == null ) throw new IllegalArgumentException("the tracker cannot be null");
        if ( loc == null ) throw new IllegalArgumentException("the location cannot be null");
        if ( allelesBinding == null ) throw new IllegalArgumentException("the alleles binding cannot be null");

        VariantContext vc = null;

        // search for usable record
        for ( final VariantContext rodVc : tracker.getValues(allelesBinding, loc) ) {
            if ( rodVc != null && ! rodVc.isFiltered() && (! snpsOnly || rodVc.isSNP() )) {
                if ( vc == null )
View Full Code Here


    @Test(dataProvider = "ScalingTests")
    private void testScaling(final AFCalculatorTestBuilder testBuilder, final List<Integer> ACs, final int nonTypePL) {
        final AFCalculator calc = testBuilder.makeModel();
        final double[] priors = testBuilder.makePriors();
        final VariantContext vc = testBuilder.makeACTest(ACs, 0, nonTypePL);
        final AFCalculationResult result = calc.getLog10PNonRef(vc, HomoSapiensConstants.DEFAULT_PLOIDY, testBuilder.numAltAlleles, priors);
        final Pair<Integer, Integer> expectedNEvaluation = estNumberOfEvaluations(testBuilder, vc, nonTypePL);
        final int minEvals = expectedNEvaluation.getFirst();
        final int maxEvals = expectedNEvaluation.getSecond();
View Full Code Here

        final List<VariantContext> biAllelicVCs = calc.makeAlleleConditionalContexts(vc);

        Assert.assertEquals(biAllelicVCs.size(), expectedVCs.size());

        for ( int i = 0; i < biAllelicVCs.size(); i++ ) {
            final VariantContext actual = biAllelicVCs.get(i);
            final VariantContext expected = expectedVCs.get(i);
            Assert.assertEquals(actual.getAlleles(), expected.getAlleles());

            for ( int j = 0; j < actual.getNSamples(); j++ )
                Assert.assertEquals(actual.getGenotype(j).getPL(), expected.getGenotype(j).getPL(),
                        "expected PLs " + Utils.join(",", expected.getGenotype(j).getPL()) + " not equal to actual " + Utils.join(",", actual.getGenotype(j).getPL()));
        }
    }
View Full Code Here

        final AFCalculatorTestBuilder testBuilder = new AFCalculatorTestBuilder(nSamples, 1,
                AFCalculatorImplementation.EXACT_INDEPENDENT,
                AFCalculatorTestBuilder.PriorType.human);

        final VariantContext vc = testBuilder.makeACTest(new int[]{ac}, 0, 100);

        final SimpleTimer timer = new SimpleTimer().start();
        final AFCalculationResult resultTracker = testBuilder.makeModel().getLog10PNonRef(vc, HomoSapiensConstants.DEFAULT_PLOIDY, testBuilder.numAltAlleles, testBuilder.makePriors());
        final long runtime = timer.getElapsedTimeNano();
        logger.info("result " + resultTracker.getLog10PosteriorOfAFGT0());
View Full Code Here

            for ( final int nonTypePL : Arrays.asList(100) ) {
                final AFCalculator calc = testBuilder.makeModel();
                final double[] priors = testBuilder.makePriors();

                for ( int[] ACs : makeACs(testBuilder.numAltAlleles, testBuilder.nSamples*2) ) {
                    final VariantContext vc = testBuilder.makeACTest(ACs, 0, nonTypePL);

                    timer.start();
                    final AFCalculationResult resultTracker = calc.getLog10PNonRef(vc, HomoSapiensConstants.DEFAULT_PLOIDY, testBuilder.numAltAlleles, priors);
                    final long runtime = timer.getElapsedTimeNano();

View Full Code Here

                final AFCalculator calc = testBuilder.makeModel();
                final double[] priors = testBuilder.makePriors();

                final int[] ac = new int[testBuilder.numAltAlleles];
                ac[0] = 1;
                final VariantContext vc = testBuilder.makeACTest(ac, 0, nonTypePL);

                for ( final int position : MathUtils.log10LinearRange(0, vc.getNSamples(), 0.1) ) {
                    final VariantContextBuilder vcb = new VariantContextBuilder(vc);
                    final List<Genotype> genotypes = new ArrayList<Genotype>(vc.getGenotypes());
                    Collections.rotate(genotypes, position);
                    vcb.genotypes(genotypes);

                    timer.start();
                    final AFCalculationResult resultTracker = calc.getLog10PNonRef(vcb.make(), HomoSapiensConstants.DEFAULT_PLOIDY, testBuilder.numAltAlleles, priors);
View Full Code Here

                final int[] ac = new int[testBuilder.numAltAlleles];
                ac[0] = 1;

                for ( int nNonInformative = 0; nNonInformative < testBuilder.nSamples; nNonInformative++ ) {
                    final VariantContext vc = testBuilder.makeACTest(ac, nNonInformative, nonTypePL);

                    timer.start();
                    final AFCalculationResult resultTracker = calc.getLog10PNonRef(vc, HomoSapiensConstants.DEFAULT_PLOIDY, testBuilder.numAltAlleles, priors);
                    final long runtime = timer.getElapsedTimeNano();
View Full Code Here

        }
    }

    @Test
    public void testOverlappingVariantContext() {
        final VariantContext vc10 = GATKVariantContextUtils.makeFromAlleles("test", "chr1", 10, Arrays.asList("A", "C"));
        final VariantContext vc13 = GATKVariantContextUtils.makeFromAlleles("test", "chr1", 13, Arrays.asList("A", "C"));
        final VariantContext vc12_15 = GATKVariantContextUtils.makeFromAlleles("test", "chr1", 12, Arrays.asList("ACAT", "A"));
        final VariantContext vc18 = GATKVariantContextUtils.makeFromAlleles("test", "chr1", 18, Arrays.asList("A", "ACAT"));

        final List<VariantContext> calls = Arrays.asList(vc13, vc12_15, vc18, vc10);

        checkOverlapping(8, calls, null);
        checkOverlapping(9, calls, null);
View Full Code Here

        checkOverlapping(20, calls, null);
    }

    private void checkOverlapping(final int pos, Collection<VariantContext> calls, final VariantContext expected) {
        final GenomeLoc loc = parser.createGenomeLoc(parser.getContigs().getSequences().get(0).getSequenceName(), pos, pos);
        final VariantContext actual = model.getOverlappingVariantContext(loc, calls);
        Assert.assertEquals(actual, expected);
    }
View Full Code Here

        final PloidyModel ploidyModel = new HomogeneousPloidyModel(samples,2);
        final GenotypingModel genotypingModel = new InfiniteRandomMatingPopulationModel();

        for ( int nReads = 0; nReads < 2; nReads++ ) {

            final VariantContext vcStart = GATKVariantContextUtils.makeFromAlleles("test", "chr1", start, Arrays.asList("A", "C"));
            final VariantContext vcEnd = GATKVariantContextUtils.makeFromAlleles("test", "chr1", stop, Arrays.asList("A", "C"));
            final VariantContext vcMiddle = GATKVariantContextUtils.makeFromAlleles("test", "chr1", start + 2, Arrays.asList("A", "C"));
            final VariantContext vcDel = GATKVariantContextUtils.makeFromAlleles("test", "chr1", start + 4, Arrays.asList("AAC", "A"));
            final VariantContext vcIns = GATKVariantContextUtils.makeFromAlleles("test", "chr1", start + 8, Arrays.asList("G", "GCG"));

            final List<VariantContext> allCalls = Arrays.asList(vcStart, vcEnd, vcMiddle, vcDel, vcIns);

            for ( int n = 1; n <= allCalls.size(); n++ ) {
                for ( final List<VariantContext> calls : Utils.makePermutations(allCalls, n, false) ) {
View Full Code Here

TOP

Related Classes of htsjdk.variant.variantcontext.VariantContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.