From 7b5d8d76044d00140a7ff66e987322b0d625d0b9 Mon Sep 17 00:00:00 2001 From: kiran Date: Wed, 24 Jun 2009 15:41:06 +0000 Subject: [PATCH] Changed the intensities array order from cycle,channel to channel,cycle. This, I'm told, is a far more efficient allocation strategy. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1084 348d0f76-0448-11de-a6fe-93d51630548a --- .../secondarybase/BasecallingReadModel.java | 9 ++++++--- .../sting/secondarybase/RawRead.java | 19 +++++++++++++------ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/java/src/org/broadinstitute/sting/secondarybase/BasecallingReadModel.java b/java/src/org/broadinstitute/sting/secondarybase/BasecallingReadModel.java index 66de68317..c27b3c3fb 100644 --- a/java/src/org/broadinstitute/sting/secondarybase/BasecallingReadModel.java +++ b/java/src/org/broadinstitute/sting/secondarybase/BasecallingReadModel.java @@ -98,7 +98,8 @@ public class BasecallingReadModel { double[] fourIntensity = new double[4]; for (int channel = 0; channel < 4; channel++) { - fourIntensity[channel] = (double) ints[cycle][channel]; + //fourIntensity[channel] = (double) ints[cycle][channel]; + fourIntensity[channel] = (double) ints[channel][cycle]; } basemodels[cycle].addMeanPoint(probMatrix, fourIntensity); @@ -135,7 +136,8 @@ public class BasecallingReadModel { double[] fourIntensity = new double[4]; for (int channel = 0; channel < 4; channel++) { - fourIntensity[channel] = (double) ints[cycle][channel]; + //fourIntensity[channel] = (double) ints[cycle][channel]; + fourIntensity[channel] = (double) ints[channel][cycle]; } basemodels[cycle].addCovariancePoint(probMatrix, fourIntensity); @@ -207,7 +209,8 @@ public class BasecallingReadModel { double[] fourIntensity = new double[4]; for (int channel = 0; channel < 4; channel++) { - fourIntensity[channel] = (double) read.getIntensities()[cycle][channel]; + //fourIntensity[channel] = (double) read.getIntensities()[cycle][channel]; + fourIntensity[channel] = (double) read.getIntensities()[channel][cycle]; } fpr.add(cycle, computeProbabilities(cycle, basePrev, qualPrev, fourIntensity)); diff --git a/java/src/org/broadinstitute/sting/secondarybase/RawRead.java b/java/src/org/broadinstitute/sting/secondarybase/RawRead.java index 6cadd7f7d..220299537 100755 --- a/java/src/org/broadinstitute/sting/secondarybase/RawRead.java +++ b/java/src/org/broadinstitute/sting/secondarybase/RawRead.java @@ -58,7 +58,8 @@ public class RawRead implements Comparable { sequence = pastedReadString[1][4].substring(cycleBegin, cycleEnd + 1).getBytes(); quals = new byte[sequence.length]; - intensities = new short[sequence.length][4]; + //intensities = new short[sequence.length][4]; + intensities = new short[4][sequence.length]; for (int cycle = cycleBegin, offset = 0; cycle <= cycleEnd; cycle++, offset++) { byte maxQual = -50; @@ -75,7 +76,8 @@ public class RawRead implements Comparable { double doubleChannelIntensity = Double.valueOf(pastedReadString[0][fullReadIndex]); short shortChannelIntensity = (short) doubleChannelIntensity; - intensities[offset][channel] = shortChannelIntensity; + //intensities[offset][channel] = shortChannelIntensity; + intensities[channel][offset] = shortChannelIntensity; } } } @@ -181,14 +183,14 @@ public class RawRead implements Comparable { /** * Get the raw read intensities. * - * @return the (readLength)x(numChannels) array of raw intensities + * @return the (numChannels)x(readLength) array of raw intensities */ public short[][] getIntensities() { return intensities; } /** * Set the raw intensities. * - * @param intensities the (readLength)x(numChannels) array of raw intensities + * @param intensities the (numChannels)x(readLength) array of raw intensities */ public void setIntensities(short[][] intensities) { this.intensities = intensities; } @@ -239,12 +241,17 @@ public class RawRead implements Comparable { byte[] newSequence = new byte[cycleStop - cycleStart + 1]; byte[] newQuals = new byte[cycleStop - cycleStart + 1]; - short[][] newIntensities = new short[cycleStop - cycleStart + 1][4]; + //short[][] newIntensities = new short[cycleStop - cycleStart + 1][4]; + short[][] newIntensities = new short[4][cycleStop - cycleStart + 1]; for (int cycle = cycleStart, offset = 0; cycle <= cycleStop; cycle++, offset++) { newSequence[offset] = sequence[cycle]; newQuals[offset] = quals[cycle]; - newIntensities[offset] = intensities[cycle]; + //newIntensities[offset] = intensities[cycle]; + + for (int channel = 0; channel < 4; channel++) { + newIntensities[channel][offset] = intensities[channel][cycle]; + } } subRead.setSequence(newSequence);