Package org.broadinstitute.gatk.utils

Examples of org.broadinstitute.gatk.utils.GenomeLoc


        if (kb == null) {
            initKB();
        }

        //Convert from 0-based to 1-based
        GenomeLoc loc = this.parser.createGenomeLoc(chromoNameToStandard(chr), start + 1, end);
        GenomeLocSortedSet glss = new GenomeLocSortedSet(this.parser, loc);
        SiteManager manager = new SiteManager(parser, glss, parser.getContigs());

        SiteIterator<MongoVariantContext> iterator;
        if (consensusOnly) {
View Full Code Here


        final List<SeqGraph> nonRefGraphs = new LinkedList<>();
        final AssemblyResultSet resultSet = new AssemblyResultSet();
        resultSet.setRegionForGenotyping(activeRegion);
        resultSet.setFullReferenceWithPadding(fullReferenceWithPadding);
        resultSet.setPaddedReferenceLoc(refLoc);
        final GenomeLoc activeRegionExtendedLocation = activeRegion.getExtendedLoc();
        refHaplotype.setGenomeLocation(activeRegionExtendedLocation);
        resultSet.add(refHaplotype);
        final Map<SeqGraph,AssemblyResult> assemblyResultByGraph = new HashMap<>();
        // create the graphs by calling our subclass assemble method
        for ( final AssemblyResult result : assemble(correctedReads, refHaplotype, givenHaplotypes) ) {
View Full Code Here

        // TODO -- this needs to be computed in a more accurate manner
        // We currently look only at direct runs of the alternate allele adjacent to this position

        byte[] bases = ref.getBases();
        GenomeLoc window = ref.getWindow();
        GenomeLoc locus = ref.getLocus();

        int refBasePos = (int)(locus.getStart() - window.getStart());

        int leftRun = 0;
        for ( int i = refBasePos - 1; i >= 0; i--) {
            if ( bases[i] != altAllele )
                break;
View Full Code Here

        return Math.max(leftRun, rightRun);
     }

    private static int computeIndelHomopolymerRun(VariantContext vc, ReferenceContext ref) {
        byte[] bases = ref.getBases();
        GenomeLoc locus = ref.getLocus();
        GenomeLoc window = ref.getWindow();
        int refBasePos = (int) (locus.getStart() - window.getStart())+1;
        if ( vc.isSimpleDeletion() ) {
            // check that deleted bases are the same
            byte dBase = bases[refBasePos];
            for ( int i = 0; i < vc.getReference().length(); i ++ ) {
                if ( bases[refBasePos+i] != dBase ) {
View Full Code Here

        if ( allVariantsWithinExtendedRegion.isEmpty() ) // no variants,
            return Result.noVariation(emitReferenceConfidence,originalRegion,snpPadding, usableExtension);

        final List<VariantContext> withinActiveRegion = new LinkedList<>();
        final GenomeLoc originalRegionRange = originalRegion.getLocation();
        boolean foundNonSnp = false;
        GenomeLoc variantSpan = null;
        for ( final VariantContext vc : allVariantsWithinExtendedRegion ) {
            final GenomeLoc vcLoc = locParser.createGenomeLoc(vc);
            if ( originalRegionRange.overlapsP(vcLoc) ) {
                foundNonSnp = foundNonSnp || ! vc.isSNP();
                variantSpan = variantSpan == null ? vcLoc : variantSpan.endpointSpan(vcLoc);
                withinActiveRegion.add(vc);
            }
        }
        final int padding = foundNonSnp ? indelPadding : snpPadding;

        // we don't actually have anything in the region after skipping out variants that don't overlap
        // the region's full location
        if ( variantSpan == null )
            return Result.noVariation(emitReferenceConfidence,originalRegion,padding, usableExtension);

        if ( dontTrimActiveRegions)
            return Result.noTrimming(emitReferenceConfidence,originalRegion, padding, usableExtension, withinActiveRegion);

        final GenomeLoc maximumSpan = locParser.createPaddedGenomeLoc(originalRegionRange, usableExtension);
        final GenomeLoc idealSpan = locParser.createPaddedGenomeLoc(variantSpan, padding);
        final GenomeLoc finalSpan = maximumSpan.intersect(idealSpan).union(variantSpan);

        // Make double sure that, if we are emitting GVCF we won't call non-variable positions beyond the target active region span.
        // In regular call we don't do so so we don't care and we want to maintain behavior, so the conditional.
        final GenomeLoc callableSpan = emitReferenceConfidence ? variantSpan.intersect(originalRegionRange) : variantSpan;

        final Pair<GenomeLoc,GenomeLoc> nonVariantRegions = nonVariantTargetRegions(originalRegion, callableSpan);

        if ( debug ) {
            logger.info("events       : " + withinActiveRegion);
View Full Code Here

     * @param targetRegion region for which to generate the flanking regions.
     * @param variantSpan the span of the core region containing relevant variation and required padding.
     * @return never {@code null}; 0, 1 or 2 element list.
     */
    private Pair<GenomeLoc,GenomeLoc> nonVariantTargetRegions(final ActiveRegion targetRegion, final GenomeLoc variantSpan) {
        final GenomeLoc targetRegionRange = targetRegion.getLocation();
        final int finalStart = variantSpan.getStart();
        final int finalStop = variantSpan.getStop();

        final int targetStart = targetRegionRange.getStart();
        final int targetStop = targetRegionRange.getStop();

        final boolean preTrimmingRequired = targetStart < finalStart;
        final boolean postTrimmingRequired = targetStop > finalStop;
        if (preTrimmingRequired) {
            final String contig = targetRegionRange.getContig();
            return postTrimmingRequired ? new Pair<>(
                    locParser.createGenomeLoc(contig, targetStart, finalStart - 1),
                    locParser.createGenomeLoc(contig, finalStop + 1, targetStop)) :
                    new Pair<>(locParser.createGenomeLoc(contig, targetStart, finalStart - 1),GenomeLoc.UNMAPPED);
        } else if (postTrimmingRequired)
            return new Pair<>(GenomeLoc.UNMAPPED,locParser.createGenomeLoc(targetRegionRange.getContig(), finalStop + 1, targetStop));
        else
            return new Pair<>(GenomeLoc.UNMAPPED,GenomeLoc.UNMAPPED);
    }
View Full Code Here

         * Creates a result indicating that there was no trimming to be done.
         */
        protected static Result noTrimming(final boolean emitReferenceConfidence,
                                           final ActiveRegion targetRegion, final int padding,
                                           final int usableExtension,final List<VariantContext> events) {
            final GenomeLoc targetRegionLoc = targetRegion.getLocation();
            final Result result = new Result(emitReferenceConfidence,false,targetRegion,padding,usableExtension,events,new Pair<>(GenomeLoc.UNMAPPED,GenomeLoc.UNMAPPED),
                    targetRegionLoc,targetRegionLoc,targetRegionLoc,targetRegionLoc);
            result.callableRegion = targetRegion;
            return result;
        }
View Full Code Here

                mbc.incrementBaseCount(newBase);

        }

        public void outputMultipleBaseCounts() {
            GenomeLoc nextToPhaseLoc = null;
            if (!unphasedSiteQueue.isEmpty())
                nextToPhaseLoc = GATKVariantContextUtils.getLocation(getToolkit().getGenomeLocParser(), unphasedSiteQueue.peek().variant);

            outputMultipleBaseCounts(nextToPhaseLoc);
        }
View Full Code Here

    protected AssemblyResultSet assembleReads(final ActiveRegion activeRegion, final List<VariantContext> giveAlleles) {
        // Create the reference haplotype which is the bases from the reference that make up the active region
        finalizeActiveRegion(activeRegion); // handle overlapping fragments, clip adapter and low qual tails

        final byte[] fullReferenceWithPadding = activeRegion.getActiveRegionReference(referenceReader, REFERENCE_PADDING);
        final GenomeLoc paddedReferenceLoc = getPaddedLoc(activeRegion);
        final Haplotype referenceHaplotype = createReferenceHaplotype(activeRegion, paddedReferenceLoc);

        // Create ReadErrorCorrector object if requested - will be used within assembly engine.
        ReadErrorCorrector readErrorCorrector = null;
        if (errorCorrectReads)
View Full Code Here

            //TODO - perhaps we can remove the last parameter of this method and the three lines bellow?
            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());
View Full Code Here

TOP

Related Classes of org.broadinstitute.gatk.utils.GenomeLoc

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.