From 897ef07183049223af88426cd462700851603fa1 Mon Sep 17 00:00:00 2001 From: Steve Huang Date: Tue, 5 Sep 2017 17:57:16 -0400 Subject: [PATCH] ready to go --- .../SimpleStrandSwitchVariantDetector.java | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/broadinstitute/hellbender/tools/spark/sv/discovery/prototype/SimpleStrandSwitchVariantDetector.java b/src/main/java/org/broadinstitute/hellbender/tools/spark/sv/discovery/prototype/SimpleStrandSwitchVariantDetector.java index 8a6bf7ad7ef..7563e1f542c 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/spark/sv/discovery/prototype/SimpleStrandSwitchVariantDetector.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/spark/sv/discovery/prototype/SimpleStrandSwitchVariantDetector.java @@ -76,7 +76,6 @@ public boolean test(final AlignedContig contig) { /** * Removes overlap from a designated alignment interval, so that the inverted duplicated reference span is minimal. * If the two alignment intervals are NOT overlapping, return the original aligned contig. - * For algorithm {@see computeNewRefSpanAndCigar(final AlignmentIn // deal with cigar first newMiddleSection.add( new CigarElement(clipLengthOnRead, CigarOperator.S) ); - final int a = readBasesConsumed + ce.getLength() - clipLengthOnRead; - if (a!=0) newMiddleSection.add( new CigarElement(a, ce.getOperator().isAlignment() ? CigarOperator.M : CigarOperator.S) ); + // # of bases left, for the current operation, after requested clipping is done, + // may be 0 because we probably don't need the entire current operation to have the requested + // number of read bases clipped, e.g. we only 15 more bases from the current operation, + // but its length is 20, then 5 bases should be "left over" + final int leftOverBasesForCurrOp = readBasesConsumed + ce.getLength() - clipLengthOnRead; + if (leftOverBasesForCurrOp!=0) { + newMiddleSection.add(// again note that here we can have only either 'M' or 'I' + new CigarElement(leftOverBasesForCurrOp, ce.getOperator().isAlignment() ? CigarOperator.M + : CigarOperator.S) ); + } newMiddleSection.addAll( cigarElements.subList(idx+1, cigarElements.size()) ); // then deal with ref span