From cc8d8eaedbaba69e6d271e1dc9409f62ca30138c Mon Sep 17 00:00:00 2001 From: asivache Date: Mon, 28 Jun 2010 16:40:16 +0000 Subject: [PATCH] Now that we always reserve space for two read ends when collecting stats stratified by libraries, we need to check that the second end was indeed present; otherwise the pointer is null and this was causing an exception git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3656 348d0f76-0448-11de-a6fe-93d51630548a --- .../sting/gatk/walkers/qc/CycleQualityWalker.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/qc/CycleQualityWalker.java b/java/src/org/broadinstitute/sting/gatk/walkers/qc/CycleQualityWalker.java index 66f56282e..46b7dd770 100644 --- a/java/src/org/broadinstitute/sting/gatk/walkers/qc/CycleQualityWalker.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/qc/CycleQualityWalker.java @@ -98,7 +98,7 @@ public class CycleQualityWalker extends ReadWalker { // if end == 0 (single end lane), we allocate array of length 1, otherwise we need two // elements in the array in order to be able to collect statistics for each end in the pair independently if ( byLane == null ) laneMap.put(lane,byLane = new CycleStats[(end==0?1:2)]); - if ( byLib == null ) libMap.put(library, byLib =new CycleStats[(end==0?1:2)]); + if ( byLib == null ) libMap.put(library, byLib =new CycleStats[2]); if ( end != 0 ) end--; // we will now use 'end' as index into the array of stats @@ -195,7 +195,7 @@ public class CycleQualityWalker extends ReadWalker { for( Map.Entry e : m.entrySet() ) { if ( e.getValue()[0].getMaxReadLength() > maxLength ) maxLength = e.getValue()[0].getMaxReadLength(); - if ( e.getValue().length == 1 ) { + if ( e.getValue().length == 1 || e.getValue().length == 2 && e.getValue()[1] == null ) { totalReads_unpaired += e.getValue()[0].getReadCount(); // single end lane } else { totalReads_1 += e.getValue()[0].getReadCount(); @@ -233,7 +233,7 @@ public class CycleQualityWalker extends ReadWalker { int minL = ( end1 == null ? 0 : end1.getMinReadLength() ); int maxL = ( end1 == null ? 0 : end1.getMaxReadLength() ); - if ( data.length == 2 ) { + if ( data.length == 2 && data[1] != null ) { out.println(": paired"); if ( HTML ) out.println("
"); out.println(" Reads analyzed:"); @@ -292,7 +292,7 @@ public class CycleQualityWalker extends ReadWalker { w.write(String.format("%.4f",aq)); recordProblem(aq,cycle, problems,col+".End1"); } - if ( data.length > 1 ) { + if ( data.length > 1 && data[1] != null ) { w.write('\t'); CycleStats end2 = data[1]; if ( end2 == null || cycle >= end2.getMaxReadLength() ) w.write('.');