Package org.broadinstitute.gatk.utils.haplotype

Examples of org.broadinstitute.gatk.utils.haplotype.Haplotype$Event


            if ( needsToBeFinalized )
                finalizeActiveRegion(region);
            filterNonPassingReads(region);

            final GenomeLoc paddedLoc = region.getExtendedLoc();
            final Haplotype refHaplotype = createReferenceHaplotype(region, paddedLoc);
            final List<Haplotype> haplotypes = Collections.singletonList(refHaplotype);
            return referenceConfidenceModel.calculateRefConfidence(refHaplotype, haplotypes,
                    paddedLoc, region, createDummyStratifiedReadMap(refHaplotype, samplesList, region),
                    genotypingEngine.getPloidyModel(), genotypingEngine.getGenotypingModel(), Collections.<VariantContext>emptyList());
        } else
View Full Code Here


            assembler.setPruneFactor(0);
        }

        public void addSequence(final byte[] bases, final boolean isRef) {
            if ( isRef ) {
                refHaplotype = new Haplotype(bases, true);
            } else {
                final GATKSAMRecord read = ArtificialSAMUtils.createArtificialRead(bases, Utils.dupBytes((byte)30,bases.length), bases.length + "M");
                reads.add(read);
            }
        }
View Full Code Here

                   final Map<String,Civar> civarBySequence = new HashMap<>(haplotypes.size());
                   final Map<String,Haplotype> haplotypeBySequence = new HashMap<>(haplotypes.size());
                   civarByAllele = new HashMap<>(haplotypes.size());
                   final List<Civar> unrolledCivars = dataSet.unrolledCivars();
                   for (int i = 0; i < haplotypes.size(); i++)  {
                       final Haplotype h = haplotypes.get(i);
                       haplotypeBySequence.put(h.getBaseString(),h);
                       civarBySequence.put(h.getBaseString(),unrolledCivars.get(i));
                   }
                   for (final Allele a : loglessLks.getAllelesSet()) {
                       alleleByHaplotype.put(haplotypeBySequence.get(a.getBaseString()),a);
                       civarByAllele.put(a,civarBySequence.get(a.getBaseString()));
                   }
View Full Code Here

    }

    @Test
    public void testAddReferenceHaplotype() {

        final Haplotype ref = new Haplotype("ACGT".getBytes(),true);
        ref.setGenomeLocation(genomeLocParser.createGenomeLoc("chr1",1,ref.length() + 1 ));
        final AssemblyResultSet subject = new AssemblyResultSet();

        Assert.assertTrue(subject.add(ref));
        Assert.assertFalse(subject.add(ref));
View Full Code Here

            final AssemblyResult ar = new AssemblyResult(AssemblyResult.Status.ASSEMBLED_SOME_VARIATION,rtg.convertToSequenceGraph());
            ar.setThreadingGraph(rtg);
            final Object[] haplotypeStrings = (Object[]) THREE_KS_GRAPH_AND_HAPLOTYPES[i][1];
            final Haplotype[] haplotypes = new Haplotype[haplotypeStrings.length];
            for (int j = 0; j < haplotypeStrings.length; j++) {
                haplotypes[j] = new Haplotype(((String)haplotypeStrings[j]).getBytes(),j == 0);
                haplotypes[j].setGenomeLocation(genomeLocParser.createGenomeLoc("chr1",1,haplotypes[j].length() + 1));
            }
            result[i] = new Object[] { Collections.singletonList(ar),Arrays.asList(Arrays.asList(haplotypes))};
            for (int j = 0; j < TEN_KS_GRAPH_AND_HAPLOTYPES.length; j++) {
                final ReadThreadingGraph rtg10 = new ReadThreadingGraph((String) TEN_KS_GRAPH_AND_HAPLOTYPES[j][0]);
                final AssemblyResult ar10 = new AssemblyResult(AssemblyResult.Status.ASSEMBLED_SOME_VARIATION,rtg10.convertToSequenceGraph());
                ar10.setThreadingGraph(rtg10);
                final Object[] haplotypeStrings10 = (Object[]) TEN_KS_GRAPH_AND_HAPLOTYPES[j][1];
                final Haplotype[] haplotype10 = new Haplotype[haplotypeStrings10.length];
                for (int k = 0; k < haplotypeStrings10.length; k++) {
                    haplotype10[k] = new Haplotype(((String)haplotypeStrings10[k]).getBytes(),false);
                    haplotype10[k].setGenomeLocation(genomeLocParser.createGenomeLoc("chr1", 1, haplotype10[k].length() + 1));
                }

                result[THREE_KS_GRAPH_AND_HAPLOTYPES.length + i * TEN_KS_GRAPH_AND_HAPLOTYPES.length + j] = new Object[] { Arrays.asList(ar,ar10),
                        Arrays.asList( Arrays.asList(haplotypes), Arrays.asList(haplotype10)) };
View Full Code Here

     * @param refBases the ref bases
     * @param paddedReferenceLoc the location spanning of the refBases -- can be longer than activeRegion.getLocation()
     * @return a reference haplotype
     */
    public static Haplotype createReferenceHaplotype(final ActiveRegion activeRegion, final byte[] refBases, final GenomeLoc paddedReferenceLoc) {
        final Haplotype refHaplotype = new Haplotype(refBases, true);
        final int alignmentStart = activeRegion.getExtendedLoc().getStart() - paddedReferenceLoc.getStart();
        if ( alignmentStart < 0 ) throw new IllegalStateException("Bad alignment start in createReferenceHaplotype " + alignmentStart);
        refHaplotype.setAlignmentStartHapwrtRef(alignmentStart);
        final Cigar c = new Cigar();
        c.add(new CigarElement(refHaplotype.getBases().length, CigarOperator.M));
        refHaplotype.setCigar(c);
        return refHaplotype;
    }
View Full Code Here

        if (refHaplotype == null) throw new IllegalStateException();
        if (trimmedActiveRegion == null) throw new NullPointerException();
        final AssemblyResultSet result = new AssemblyResultSet();

        for (final Haplotype trimmed : originalByTrimmedHaplotypes.keySet()) {
            final Haplotype original = originalByTrimmedHaplotypes.get(trimmed);
            if (original == null)
                throw new NullPointerException("all trimmed haplotypes must have an original one");
            final AssemblyResult as = assemblyResultByHaplotype.get(original);
            if (as == null) result.add(trimmed); else result.add(trimmed, as);
        }
View Full Code Here

        // trim down the haplotypes
        final Map<Haplotype,Haplotype> originalByTrimmedHaplotypes = new HashMap<>();

        for ( final Haplotype h : haplotypeList ) {
            final Haplotype trimmed = h.trim(trimmedActiveRegion.getExtendedLoc());

            if ( trimmed != null ) {
                if (originalByTrimmedHaplotypes.containsKey(trimmed)) {
                    if (trimmed.isReference()) {
                        originalByTrimmedHaplotypes.remove(trimmed);
                        originalByTrimmedHaplotypes.put(trimmed, h);
                    }
                } else
                    originalByTrimmedHaplotypes.put(trimmed,h);
View Full Code Here

            final GATKSAMRecord read = ArtificialSAMUtils.createArtificialRead(header, loc.getContig(), loc.getContigIndex(), loc.getStart(), bases, quals, cigar);
            reads.add(read);
        }

        // TODO -- generalize to all assemblers
        final Haplotype refHaplotype = new Haplotype(refBases, true);
        final List<Haplotype> haplotypes = assemble(assembler, refBases, loc, reads);
        Assert.assertEquals(haplotypes, Collections.singletonList(refHaplotype));
    }
View Full Code Here

            final String cigar = altBases.length + "M";
            final GATKSAMRecord read = ArtificialSAMUtils.createArtificialRead(header, loc.getContig(), loc.getContigIndex(), loc.getStart(), bases, quals, cigar);
            reads.add(read);
        }

        final Haplotype refHaplotype = new Haplotype(refBases, true);
        final Haplotype altHaplotype = new Haplotype(altBases, false);
        final List<Haplotype> haplotypes = assemble(assembler, refBases, loc, reads);
        Assert.assertEquals(haplotypes, Arrays.asList(refHaplotype, altHaplotype));
    }
View Full Code Here

TOP

Related Classes of org.broadinstitute.gatk.utils.haplotype.Haplotype$Event

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.