Package htsjdk.variant.variantcontext

Examples of htsjdk.variant.variantcontext.Allele


        if (!hasReferenceSampleData) {
            readHaplotypeLikelihoods = pairModel.computeGeneralReadHaplotypeLikelihoods(pileup, haplotypeMap, refContext, eventLength, perReadAlleleLikelihoodMap);
            n = readHaplotypeLikelihoods.length;
        } else {
            Allele refAllele = null;
            for (Allele a:alleles) {
                numSeenBases.add(0);
                if (a.isReference())
                    refAllele = a;
            }
View Full Code Here


        for (int i = 0; i < targetAlleleList.alleleCount(); i++)
            Assert.assertEquals(subset.fromIndex(i), originalAlleleList.alleleIndex(targetAlleleList.alleleAt(i)));

        for (int j = 0; j < originalAlleleList.alleleCount(); j++) {
            final Allele allele = originalAlleleList.alleleAt(j);
            Assert.assertEquals(subset.toIndex(j),targetAlleleList.alleleIndex(allele));
        }

        Assert.assertTrue(AlleleListUtils.equals(subset,targetAlleleList));
    }
View Full Code Here

            fromIndex[i] = i;

        for (int i = 0; i < targetAlleleArray.length - 1; i++) {
            final int swapIndex = rnd.nextInt(targetAlleleArray.length - i - 1);
            final int otherIndex = fromIndex[swapIndex + i + 1];
            final Allele other = targetAlleleArray[swapIndex + i + 1];
            fromIndex[swapIndex + i + 1] = fromIndex[i];
            fromIndex[i] = otherIndex;
            targetAlleleArray[swapIndex + i + 1] = targetAlleleArray[i];
            targetAlleleArray[i] = other;
        }
View Full Code Here

                return Collections.nCopies(ploidy,allelesToUse.get(sortedAlleleCounts[0]));
        } else {
            final Allele[] myAlleles = new Allele[ploidy];
            int nextIndex = 0;
            for (int i = 0, ii = 0; i < distinctAlleleCount; i++) {
                final Allele allele = allelesToUse.get(sortedAlleleCounts[ii++]);
                final int repeats = sortedAlleleCounts[ii++];
                for (int j = 0; j < repeats; j++)
                    myAlleles[nextIndex++] = allele;
            }
            return (List<T>) Arrays.asList(myAlleles);
View Full Code Here

        else {
            hasData = true;
            int matches = 0;
            int coverage = 0;

            Allele refAllele = refSampleVC.getReference();

            if ( refSampleVC.isIndel()) {
                //perReadLikelihoods = new double[readCounts.length][refSampleVC.getAlleles().size()];
                final int eventLength = IndelGenotypeLikelihoodsCalculationModel.getEventLength(refSampleVC.getAlleles());
                if (!haplotypeMap.isEmpty())
View Full Code Here

                return null;
            }
        }


        final Allele refAllele = Allele.create( ArrayUtils.subarray(refBases, iii, refBases.length), true );
        final Allele altAllele =  Allele.create( ArrayUtils.subarray(altBases, iii, altBases.length), false );
        return new VariantContextBuilder("merged", thisVC.getChr(), thisVC.getStart() + iii, nextVC.getEnd(), Arrays.asList(refAllele, altAllele)).make();
    }
View Full Code Here

                                               final VariantContext vc,
                                               final int minCount) {
        if( stratifiedPerReadAlleleLikelihoodMap == null ) { throw new IllegalArgumentException("stratifiedPerReadAlleleLikelihoodMap cannot be null"); }
        if( vc == null ) { throw new IllegalArgumentException("input vc cannot be null"); }

        final Allele ref = vc.getReference();
        final Allele alt = vc.getAltAlleleWithHighestAlleleCount();
        final int[][] table = new int[2][2];

        for (final PerReadAlleleLikelihoodMap maps : stratifiedPerReadAlleleLikelihoodMap.values() ) {
            final int[] myTable = new int[4];
            for (final Map.Entry<GATKSAMRecord,Map<Allele,Double>> el : maps.getLikelihoodReadMap().entrySet()) {
View Full Code Here

        super(alleles, logLikelihoods, ploidy, perLaneErrorModels, ignoreLaneInformation);
        this.useBAQedPileup = useBQAedPileup;

        myAlleles = new ArrayList<Allele>(alleles);

        Allele refAllele = alleles.get(0);
        //sanity check: by construction, first allele should ALWAYS be the reference alleles
        if (!refAllele.isReference())
            throw new ReviewedGATKException("BUG: First allele in list passed to GeneralPloidySNPGenotypeLikelihoods should be reference!");

        refByte = refAllele.getBases()[0]// by construction, first allele in list is always ref!

        if (myAlleles.size() < BaseUtils.BASES.length) {
            // likelihood only defined for subset of possible alleles. Fill then with other alleles to have all possible ones,
            for (byte b : BaseUtils.BASES) {
                // if base is not included in myAlleles, add new allele
View Full Code Here

    }

    @Test(dataProvider = "AssembleIntervalsWithVariantData")
    public void testAssembleRefAndSNP(final ReadThreadingAssembler assembler, final GenomeLoc loc, final int nReadsToUse, final int variantSite) {
        final byte[] refBases = seq.getSubsequenceAt(loc.getContig(), loc.getStart(), loc.getStop()).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());
    }
View Full Code Here

    @Test(dataProvider = "AssembleIntervalsWithVariantData")
    public void testAssembleRefAndDeletion(final ReadThreadingAssembler assembler, final GenomeLoc loc, final int nReadsToUse, final int variantSite) {
        final byte[] refBases = seq.getSubsequenceAt(loc.getContig(), loc.getStart(), loc.getStop()).getBases();
        for ( int deletionLength = 1; deletionLength < 10; deletionLength++ ) {
            final Allele refBase = Allele.create(new String(refBases).substring(variantSite, variantSite + deletionLength + 1), true);
            final Allele altBase = Allele.create(refBase.getBases()[0], false);
            final VariantContextBuilder vcb = new VariantContextBuilder("x", loc.getContig(), variantSite, variantSite + deletionLength, Arrays.asList(refBase, altBase));
            testAssemblyWithVariant(assembler, refBases, loc, nReadsToUse, vcb.make());
        }
    }
View Full Code Here

TOP

Related Classes of htsjdk.variant.variantcontext.Allele

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.