From eb200e4cce7fd94adb641e7a13233a59faba3dd8 Mon Sep 17 00:00:00 2001 From: chartl Date: Tue, 18 May 2010 17:13:44 +0000 Subject: [PATCH] Hrumph. Don't just add pointers to the same objects, actually clone the underlying arrays. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3379 348d0f76-0448-11de-a6fe-93d51630548a --- .../coverage/DepthOfCoverageStats.java | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/coverage/DepthOfCoverageStats.java b/java/src/org/broadinstitute/sting/gatk/walkers/coverage/DepthOfCoverageStats.java index 6114a4024..5926baf99 100644 --- a/java/src/org/broadinstitute/sting/gatk/walkers/coverage/DepthOfCoverageStats.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/coverage/DepthOfCoverageStats.java @@ -86,15 +86,25 @@ public class DepthOfCoverageStats { public DepthOfCoverageStats(DepthOfCoverageStats cloneMe) { this.binLeftEndpoints = cloneMe.binLeftEndpoints; - this.granularHistogramBySample = cloneMe.granularHistogramBySample; - this.totalCoverages = cloneMe.totalCoverages; - this.nLoci = cloneMe.nLoci; - this.totalLocusDepth = cloneMe.totalLocusDepth; - this.totalDepthOfCoverage = cloneMe.totalDepthOfCoverage; - this.locusHistogram = cloneMe.locusHistogram; - this.locusCoverageCounts = cloneMe.locusCoverageCounts; - this.tabulateLocusCounts = cloneMe.tabulateLocusCounts; + granularHistogramBySample = new HashMap(); + totalCoverages = new HashMap(); + for ( String s : cloneMe.getAllSamples() ) { + granularHistogramBySample.put(s,new int[cloneMe.getHistograms().get(s).length]); + for ( int i = 0; i < granularHistogramBySample.get(s).length; i++ ) { + granularHistogramBySample.get(s)[i] = cloneMe.getHistograms().get(s)[i]; + } + totalCoverages.put(s,cloneMe.totalCoverages.get(s)); + } + this.includeDeletions = cloneMe.includeDeletions; + if ( cloneMe.tabulateLocusCounts ) { + this.locusCoverageCounts = new int[cloneMe.locusCoverageCounts.length][cloneMe.locusCoverageCounts[0].length]; + } + //this.granularHistogramBySample = cloneMe.granularHistogramBySample; + //this.totalCoverages = cloneMe.totalCoverages; + this.nLoci = cloneMe.nLoci; + this.totalDepthOfCoverage = cloneMe.totalDepthOfCoverage; + this.tabulateLocusCounts = cloneMe.tabulateLocusCounts; } public void addSample(String sample) {