From 010304fe4484f117f737ed7b947c2a250b22a77b Mon Sep 17 00:00:00 2001 From: asivache Date: Tue, 16 Jun 2009 18:08:56 +0000 Subject: [PATCH] bug: printing incorrect coordinates into output, finally fixed (?) git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1017 348d0f76-0448-11de-a6fe-93d51630548a --- .../walkers/indels/IndelGenotyperWalker.java | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/indels/IndelGenotyperWalker.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/indels/IndelGenotyperWalker.java index 26037cf6c..33efe5f73 100644 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/indels/IndelGenotyperWalker.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/indels/IndelGenotyperWalker.java @@ -155,11 +155,18 @@ public class IndelGenotyperWalker extends ReadWalker { return -1; } +// if ( read.getAlignmentStart() < 112337549 && read.getAlignmentEnd() > 112337550 ) { +// System.out.print("adding "+read.getReadString()+" "+read.getCigarString()); +// } + if ( read.getReadUnmappedFlag() || read.getDuplicateReadFlag() || read.getNotPrimaryAlignmentFlag() || - read.getMappingQuality() == 0 ) return 0; // we do not need those reads! - + read.getMappingQuality() == 0 ) { +// System.out.println(" ignored"); + return 0; // we do not need those reads! + } +// System.out.print(" added"); if ( read.getReferenceIndex() != currentContigIndex ) { // we just jumped onto a new contig @@ -227,8 +234,10 @@ public class IndelGenotyperWalker extends ReadWalker { if ( rg == null ) throw new StingException("Read "+read.getReadName()+" has no read group in merged stream"); if ( normal_samples.contains(rg) ) { +// System.out.println(" TO NORMAL"); normal_coverage.add(read,ref); } else if ( tumor_samples.contains(rg) ) { +// System.out.println(" TO TUMOR"); coverage.add(read,ref); } else { throw new StingException("Unrecognized read group in merged stream: "+rg); @@ -404,14 +413,15 @@ public class IndelGenotyperWalker extends ReadWalker { if ( (double)total_variant_count_tumor > minFraction * tumor_cov && (double) max_variant_count_tumor > minConsensusFraction*total_variant_count_tumor ) { String annotationString = getAnnotationString(annotation); -/* - int leftpos = pos-1; - int rightpos = pos-1; - if ( event_length_tumor > 0 ) { - leftpos -= event_length; + + long leftpos = pos; + long rightpos = pos+event_length_tumor-1; + if ( event_length_tumor == 0 ) { // insertion + leftpos--; + rightpos = leftpos; } -*/ - String message = refName+"\t"+(pos-1)+"\t"+(event_length_tumor > 0 ? pos-1+event_length_tumor : pos-1)+ + + String message = refName+"\t"+leftpos+"\t"+rightpos+ "\t"+(event_length_tumor >0? "-":"+")+indelStringTumor +":"+total_variant_count_tumor+"/"+tumor_cov; if ( normal_variants.size() == 0 ) { @@ -434,8 +444,8 @@ public class IndelGenotyperWalker extends ReadWalker { // } } - coverage.shift((int)(position - coverage.getStart() ) ); - normal_coverage.shift((int)(position - normal_coverage.getStart() ) ); + coverage.shift((int)(stop_at - coverage.getStart() ) ); + normal_coverage.shift((int)(stop_at - normal_coverage.getStart() ) ); } @@ -505,7 +515,7 @@ public class IndelGenotyperWalker extends ReadWalker { */ public int lengthOnRef() { if ( type == Type.D ) return bases.length(); - else return -1; + else return 0; } public void increment() { count+=1; }