From d0ce56e0183d347a8a6d9f28b649f15b83fb396f Mon Sep 17 00:00:00 2001 From: kiran Date: Thu, 9 Apr 2009 20:48:45 +0000 Subject: [PATCH] Remember to take the strand flag into account when calculating error rate per cycle as a surrogate for instrument performance. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@347 348d0f76-0448-11de-a6fe-93d51630548a --- .../gatk/walkers/ReadErrorRateWalker.java | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/ReadErrorRateWalker.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/ReadErrorRateWalker.java index f854714a6..a3f8857e0 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/ReadErrorRateWalker.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/ReadErrorRateWalker.java @@ -80,24 +80,22 @@ public class ReadErrorRateWalker extends ReadWalker { } if (nextBestBase != '.') { - errorsPerCycle[cycle] = !(bases[cycle] == compBase || nextBestBase == compBase); - totalMismatches = (!(bases[cycle] == compBase || nextBestBase == compBase)) ? 1 : 0; + if (read.getReadNegativeStrandFlag()) { + errorsPerCycle[bases.length - cycle - 1] = !(bases[cycle] == compBase || nextBestBase == compBase); + } else { + errorsPerCycle[cycle] = !(bases[cycle] == compBase || nextBestBase == compBase); + } } } else { - errorsPerCycle[cycle] = !(bases[cycle] == compBase); - totalMismatches += (!(bases[cycle] == compBase)) ? 1 : 0; + if (read.getReadNegativeStrandFlag()) { + errorsPerCycle[bases.length - cycle - 1] = !(bases[cycle] == compBase); + } else { + errorsPerCycle[cycle] = !(bases[cycle] == compBase); + } } } } - /* - if (totalMismatches > 4) { - for (int cycle = 0; cycle < bases.length; cycle++) { System.out.print((char) bases[cycle]); } System.out.print("\n"); - for (int cycle = 0, offset = (int) context.getPosition(); cycle < bases.length; cycle++, offset++) { System.out.print((char) contig[offset]); } System.out.print("\n"); - System.out.println(totalMismatches + "\n"); - } - */ - // We encode that we saw a read in the last position of the array. // That way we know what to normalize by, and we get thread safety! errorsPerCycle[errorsPerCycle.length - 1] = true;