From a18e31f5b8f1a935034e0a425c98f0b422f3fb9d Mon Sep 17 00:00:00 2001 From: asivache Date: Wed, 30 Dec 2009 21:56:25 +0000 Subject: [PATCH] If alignment context at the locus holds extended event, get rod metadata and (importantly) reference bases for the whole span of the event (if it is a deletion that is, insertions still have length 0 on the ref!) git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2489 348d0f76-0448-11de-a6fe-93d51630548a --- .../sting/gatk/traversals/TraverseLoci.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/java/src/org/broadinstitute/sting/gatk/traversals/TraverseLoci.java b/java/src/org/broadinstitute/sting/gatk/traversals/TraverseLoci.java index d0cf22977..c3cab6944 100755 --- a/java/src/org/broadinstitute/sting/gatk/traversals/TraverseLoci.java +++ b/java/src/org/broadinstitute/sting/gatk/traversals/TraverseLoci.java @@ -12,6 +12,7 @@ import org.broadinstitute.sting.gatk.walkers.LocusWalker; import org.broadinstitute.sting.gatk.walkers.Walker; import org.broadinstitute.sting.utils.GenomeLoc; import org.broadinstitute.sting.utils.Utils; +import org.broadinstitute.sting.utils.GenomeLocParser; import java.util.ArrayList; @@ -66,13 +67,23 @@ public class TraverseLoci extends TraversalEngine { // We keep processing while the next reference location is within the interval while( locusView.hasNext() ) { AlignmentContext locus = locusView.next(); + GenomeLoc location = locus.getLocation(); TraversalStatistics.nRecords++; - // Iterate forward to get all reference ordered data covering this locus - final RefMetaDataTracker tracker = referenceOrderedDataView.getReferenceOrderedDataAtLocus(locus.getLocation()); + if ( locus.hasExtendedEventPileup() ) { + // if the alignment context we received holds an "extended" pileup (i.e. pileup of insertions/deletions + // associated with the current site), we need to update the location. The updated location still starts + // at the current genomic position, but it has to span the length of the longest deletion (if any). + location = GenomeLocParser.setStop(location,location.getStop()+locus.getExtendedEventPileup().getMaxDeletionLength()); + } - ReferenceContext refContext = referenceView.getReferenceContext(locus.getLocation()); + // Iterate forward to get all reference ordered data covering this location + final RefMetaDataTracker tracker = referenceOrderedDataView.getReferenceOrderedDataAtLocus(location); + + // create reference context. Note that if we have a pileup of "extended events", the context will + // hold the (longest) stretch of deleted reference bases (if deletions are present in the pileup). + ReferenceContext refContext = referenceView.getReferenceContext(location); final boolean keepMeP = locusWalker.filter(tracker, refContext, locus); if (keepMeP) {