diff --git a/playground/java/src/org/broadinstitute/sting/indels/IndelRecordPileCollector.java b/playground/java/src/org/broadinstitute/sting/indels/IndelRecordPileCollector.java index 5a1997b3b..b86645403 100755 --- a/playground/java/src/org/broadinstitute/sting/indels/IndelRecordPileCollector.java +++ b/playground/java/src/org/broadinstitute/sting/indels/IndelRecordPileCollector.java @@ -305,24 +305,26 @@ public class IndelRecordPileCollector implements RecordReceiver { // we are done with current indel, get next one if any: if ( i_iter.hasNext() ) { indel = i_iter.next(); - if ( curr_stop < indel.getObject().getStart() ) { - // all alignments that overlapped with the previous indel ended before the current indel started, - // this means that the current train and pile of reads overlapping with it are fully built; - // emit into indel receiver if the train is interesting enough, or into the nonindel receiver: - - if ( shouldAcceptForOutput(finalTrain ) ) { - System.out.print(mLastContig+":"+ finalTrain.get(0).getObject().getStart() + "-" + - finalTrain.get(finalTrain.size()-1).getObject().getStop() + " " + - finalTrain.size() + " indels; "); - System.out.print(finalPile.size() + " reads in the pile;") ; - System.out.println(formatRange(finalTrain)); - indelPileReceiver.receive(finalPile); - } else for ( SAMRecord r : finalPile ) defaultReceiver.receive(r); - finalPile.clear(); - finalTrain.clear(); - curr_stop = -1; - } // ELSE: otherwise we have reads that overlap with both previous and current indel, so we just continue } else indel = null; + if ( indel == null || curr_stop < indel.getObject().getStart() ) { + // if there are no more indels or + // all alignments that overlapped with the previous indel ended before the current indel started, + // this means that the current train and pile of reads overlapping with it are fully built + // and can be emitted + + if ( shouldAcceptForOutput(finalTrain ) ) { + System.out.print(mLastContig+":"+ finalTrain.get(0).getObject().getStart() + "-" + + finalTrain.get(finalTrain.size()-1).getObject().getStop() + " " + + finalTrain.size() + " indels; "); + System.out.print(finalPile.size() + " reads in the pile;") ; + System.out.println(formatRange(finalTrain)); + indelPileReceiver.receive(finalPile); + } else for ( SAMRecord r : finalPile ) defaultReceiver.receive(r); + finalPile.clear(); + finalTrain.clear(); + curr_stop = -1; + } // ELSE: otherwise we have reads that overlap with both previous and current indel, so we just continue + // with building the indel train } setWaitState(); diff --git a/playground/java/src/org/broadinstitute/sting/indels/PileBuilder.java b/playground/java/src/org/broadinstitute/sting/indels/PileBuilder.java index 772157aba..801f7c504 100755 --- a/playground/java/src/org/broadinstitute/sting/indels/PileBuilder.java +++ b/playground/java/src/org/broadinstitute/sting/indels/PileBuilder.java @@ -262,18 +262,19 @@ public class PileBuilder implements RecordPileReceiver { //System.out.println( distances.format("%8.4g ")); - /* - SelectedPair pworst = pb.findWorst(); + + SelectedPair pworst = findWorst(); pile1.add(seqs[pworst.i()].getSequence(), pworst.i()); pile2.add(seqs[pworst.j()].getSequence(), pworst.j()); -*/ - + +/* // initialize piles with best and next-best pairs SelectedPair p_best = findClosestPair(); SelectedPair p_nextbest = findNextClosestPairAfter(p_best); pile1.add( alignments.get(p_best.i(), p_best.j()),p_best.i(),p_best.j()); pile2.add( alignments.get(p_nextbest.i(), p_nextbest.j()),p_nextbest.i(),p_nextbest.j()); +*/ /* System.out.println("Best pair ("+p_best.i() + "," + p_best.j()+", d="+p_best.d()+"):"); System.out.println(pile1.toString());