Trigger cleaning of duplicate reads. Also beeter debug output.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3246 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2010-04-23 15:12:28 +00:00
parent 3adf7fbf64
commit e0b51d0df0
1 changed files with 6 additions and 4 deletions

View File

@ -285,7 +285,6 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
} }
else if ( readLoc.overlapsP(currentInterval) ) { else if ( readLoc.overlapsP(currentInterval) ) {
if ( read.getReadUnmappedFlag() || if ( read.getReadUnmappedFlag() ||
read.getDuplicateReadFlag() ||
read.getNotPrimaryAlignmentFlag() || read.getNotPrimaryAlignmentFlag() ||
read.getMappingQuality() == 0 || read.getMappingQuality() == 0 ||
read.getAlignmentStart() == SAMRecord.NO_ALIGNMENT_START ) { read.getAlignmentStart() == SAMRecord.NO_ALIGNMENT_START ) {
@ -483,6 +482,7 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
// if this doesn't match perfectly to the reference, let's try to clean it // if this doesn't match perfectly to the reference, let's try to clean it
if ( rawMismatchScore > 0 ) { if ( rawMismatchScore > 0 ) {
altReads.add(aRead); altReads.add(aRead);
//logger.debug("Adding " + aRead.getRead().getReadName() + " with raw mismatch score " + rawMismatchScore + " to non-ref reads");
if ( !read.getDuplicateReadFlag() ) if ( !read.getDuplicateReadFlag() )
totalRawMismatchSum += rawMismatchScore; totalRawMismatchSum += rawMismatchScore;
aRead.setMismatchScoreToReference(rawMismatchScore); aRead.setMismatchScoreToReference(rawMismatchScore);
@ -502,6 +502,7 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
// otherwise, we can emit it as is // otherwise, we can emit it as is
else { else {
// if ( debugOn ) System.out.println("Emitting as is..."); // if ( debugOn ) System.out.println("Emitting as is...");
//logger.debug("Adding " + aRead.getRead().getReadName() + " with raw mismatch score " + rawMismatchScore + " to ref reads");
refReads.add(read); refReads.add(read);
} }
} }
@ -540,6 +541,7 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
while ( iter.hasNext() ) { while ( iter.hasNext() ) {
Consensus consensus = iter.next(); Consensus consensus = iter.next();
//logger.debug("Trying new consensus: " + AlignmentUtils.cigarToString(consensus.cigar) + " " + new String(consensus.str));
// if ( DEBUG ) { // if ( DEBUG ) {
// System.out.println("Checking consensus with alignment at "+consensus.positionOnReference+" cigar "+consensus.cigar); // System.out.println("Checking consensus with alignment at "+consensus.positionOnReference+" cigar "+consensus.cigar);
@ -567,7 +569,7 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
else else
consensus.readIndexes.add(new Pair<Integer, Integer>(j, altAlignment.first)); consensus.readIndexes.add(new Pair<Integer, Integer>(j, altAlignment.first));
//logger.debug(consensus.str + " vs. " + toTest.getRead().getReadString() + " => " + myScore + " - " + altAlignment.first); //logger.debug(AlignmentUtils.cigarToString(consensus.cigar) + " vs. " + toTest.getRead().getReadName() + "-" + toTest.getRead().getReadString() + " => " + myScore + " vs. " + altAlignment.first);
if ( !toTest.getRead().getDuplicateReadFlag() ) if ( !toTest.getRead().getDuplicateReadFlag() )
consensus.mismatchSum += myScore; consensus.mismatchSum += myScore;
@ -577,13 +579,13 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
break; break;
} }
//logger.debug(consensus.str + " " + consensus.mismatchSum); //logger.debug("Mismatch sum of new consensus: " + consensus.mismatchSum);
if ( bestConsensus == null || bestConsensus.mismatchSum > consensus.mismatchSum) { if ( bestConsensus == null || bestConsensus.mismatchSum > consensus.mismatchSum) {
// we do not need this alt consensus, release memory right away!! // we do not need this alt consensus, release memory right away!!
if ( bestConsensus != null ) if ( bestConsensus != null )
bestConsensus.readIndexes.clear(); bestConsensus.readIndexes.clear();
bestConsensus = consensus; bestConsensus = consensus;
//logger.debug(consensus.str + " " + consensus.mismatchSum); //logger.debug("New consensus " + AlignmentUtils.cigarToString(bestConsensus.cigar) + " is now best consensus");
} else { } else {
// we do not need this alt consensus, release memory right away!! // we do not need this alt consensus, release memory right away!!
consensus.readIndexes.clear(); consensus.readIndexes.clear();