Henious bug fixed: only rookies forget that external conditions need to be re-checked after loop ends on some other condition, duh! In addition, msa piles are now seeded with a single read sequence each (if there are less then 4 reads it might be hard to seed with two pairs)

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@129 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
asivache 2009-03-21 18:32:18 +00:00
parent 411e5cf647
commit df2a7039cb
2 changed files with 24 additions and 21 deletions

View File

@ -305,24 +305,26 @@ public class IndelRecordPileCollector implements RecordReceiver {
// we are done with current indel, get next one if any: // we are done with current indel, get next one if any:
if ( i_iter.hasNext() ) { if ( i_iter.hasNext() ) {
indel = i_iter.next(); 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; } 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(); setWaitState();

View File

@ -262,18 +262,19 @@ public class PileBuilder implements RecordPileReceiver {
//System.out.println( distances.format("%8.4g ")); //System.out.println( distances.format("%8.4g "));
/*
SelectedPair pworst = pb.findWorst(); SelectedPair pworst = findWorst();
pile1.add(seqs[pworst.i()].getSequence(), pworst.i()); pile1.add(seqs[pworst.i()].getSequence(), pworst.i());
pile2.add(seqs[pworst.j()].getSequence(), pworst.j()); pile2.add(seqs[pworst.j()].getSequence(), pworst.j());
*/
/*
// initialize piles with best and next-best pairs // initialize piles with best and next-best pairs
SelectedPair p_best = findClosestPair(); SelectedPair p_best = findClosestPair();
SelectedPair p_nextbest = findNextClosestPairAfter(p_best); SelectedPair p_nextbest = findNextClosestPairAfter(p_best);
pile1.add( alignments.get(p_best.i(), p_best.j()),p_best.i(),p_best.j()); 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()); 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("Best pair ("+p_best.i() + "," + p_best.j()+", d="+p_best.d()+"):");
System.out.println(pile1.toString()); System.out.println(pile1.toString());