/** * Returns the coverage distribution of a list of reads within the desired region. * * See getCoverageDistributionOfRead for information on how the coverage is calculated. * * @param list the list of reads covering the region * @param startLocation the first reference coordinate of the region (inclusive) * @param stopLocation the last reference coordinate of the region (inclusive) * @return an array with the coverage of each position from startLocation to stopLocation */ public static int [] getCoverageDistributionOfReads(List<GATKSAMRecord> list, int startLocation, int stopLocation) { int [] totalCoverage = new int[stopLocation - startLocation + 1]; for (GATKSAMRecord read : list) { int [] readCoverage = getCoverageDistributionOfRead(read, startLocation, stopLocation); totalCoverage = MathUtils.addArrays(totalCoverage, readCoverage); } return totalCoverage; }
readToLocusMap.put(read, new Boolean[arraySize]); // Initialize the readToLocus map with empty arrays int [] readCoverage = getCoverageDistributionOfRead(read, startLocation, stopLocation);