Skip to content

Commit 2389de3

Browse files
committed
updated new method names as per PR comments
1 parent 1557460 commit 2389de3

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

qprofiler/src/org/qcmg/qprofiler/bam/BamSummaryReport.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -576,16 +576,16 @@ private void parseTAGs(final SAMRecord record, final MAPQMatrix matrix, final by
576576
}
577577
}
578578

579-
parseStringAttribute(record.getAttribute("RG"), tagRGLineLengths);
579+
aggregateStringAttribute(record.getAttribute("RG"), tagRGLineLengths);
580580
if (!torrentBam) {
581-
parseIntegerAttribute(record.getAttribute("ZM"), tagZMLineLengths, includeMatrices, matrix, MatrixType.ZM);
582-
parseIntegerAttribute(record.getAttribute("ZF"), tagZFLineLengths, false, null, null);
583-
parseStringAttribute(record.getAttribute("ZP"), tagZPLineLengths);
584-
}
585-
parseIntegerAttribute(record.getAttribute("CM"), tagCMLineLengths, includeMatrices, matrix, MatrixType.CM);
586-
parseIntegerAttribute(record.getAttribute("SM"), tagSMLineLengths, includeMatrices, matrix, MatrixType.SM);
587-
parseIntegerAttribute(record.getAttribute("IH"), tagIHLineLengths, false, null, null);
588-
parseIntegerAttribute(record.getAttribute("NH"), tagNHLineLengths, includeMatrices, matrix, MatrixType.NH);
581+
aggregateIntegerAttribute(record.getAttribute("ZM"), tagZMLineLengths, includeMatrices, matrix, MatrixType.ZM);
582+
aggregateIntegerAttribute(record.getAttribute("ZF"), tagZFLineLengths, false, null, null);
583+
aggregateStringAttribute(record.getAttribute("ZP"), tagZPLineLengths);
584+
}
585+
aggregateIntegerAttribute(record.getAttribute("CM"), tagCMLineLengths, includeMatrices, matrix, MatrixType.CM);
586+
aggregateIntegerAttribute(record.getAttribute("SM"), tagSMLineLengths, includeMatrices, matrix, MatrixType.SM);
587+
aggregateIntegerAttribute(record.getAttribute("IH"), tagIHLineLengths, false, null, null);
588+
aggregateIntegerAttribute(record.getAttribute("NH"), tagNHLineLengths, includeMatrices, matrix, MatrixType.NH);
589589
//MD
590590
if (!includeMDTag) {
591591
value = (String) record.getAttribute(SAMTag.MD);
@@ -626,8 +626,8 @@ private void parseTAGs(final SAMRecord record, final MAPQMatrix matrix, final by
626626
}
627627
}
628628

629-
public static void parseIntegerAttribute(Object attribute,
630-
final QCMGAtomicLongArray array, boolean includeMatrices, final MAPQMatrix matrix, MatrixType matrixType) {
629+
public static void aggregateIntegerAttribute(Object attribute,
630+
final QCMGAtomicLongArray array, boolean includeMatrices, final MAPQMatrix matrix, MatrixType matrixType) {
631631
if (attribute instanceof Integer) {
632632
if (null != array) {
633633
array.increment((Integer) attribute);
@@ -638,7 +638,7 @@ public static void parseIntegerAttribute(Object attribute,
638638
}
639639
}
640640

641-
public static void parseStringAttribute(Object attribute, final ConcurrentMap<String, AtomicLong> map) {
641+
public static void aggregateStringAttribute(Object attribute, final ConcurrentMap<String, AtomicLong> map) {
642642
if (attribute instanceof String && null != map) {
643643
SummaryByCycleUtils.incrementCount(map, (String) attribute);
644644
}

qprofiler/test/org/qcmg/qprofiler/bam/BamSummaryReportTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,15 @@ public void testGenerateMAPQSubMaps() throws Exception {
192192
public void parseIntegerAttribute() {
193193
QCMGAtomicLongArray array = new QCMGAtomicLongArray(100);
194194
MAPQMatrix matrix = new MAPQMatrix();
195-
BamSummaryReport.parseIntegerAttribute(null, array, true, matrix, MAPQMatrix.MatrixType.ZM);
195+
BamSummaryReport.aggregateIntegerAttribute(null, array, true, matrix, MAPQMatrix.MatrixType.ZM);
196196
assertTrue(array.isEmpty());
197197
assertEquals(0, matrix.getMatrixByType(MAPQMatrix.MatrixType.ZM).size());
198-
BamSummaryReport.parseIntegerAttribute("hello", array, true, matrix, MAPQMatrix.MatrixType.ZM);
198+
BamSummaryReport.aggregateIntegerAttribute("hello", array, true, matrix, MAPQMatrix.MatrixType.ZM);
199199
assertTrue(array.isEmpty());
200200
assertEquals(0, matrix.getMatrixByType(MAPQMatrix.MatrixType.ZM).size());
201-
BamSummaryReport.parseIntegerAttribute(1, array, true, matrix, MAPQMatrix.MatrixType.ZM);
201+
BamSummaryReport.aggregateIntegerAttribute(1, array, true, matrix, MAPQMatrix.MatrixType.ZM);
202202
assertEquals(1, array.get(1));
203-
BamSummaryReport.parseIntegerAttribute(10, array, true, matrix, MAPQMatrix.MatrixType.ZM);
203+
BamSummaryReport.aggregateIntegerAttribute(10, array, true, matrix, MAPQMatrix.MatrixType.ZM);
204204
assertEquals(1, array.get(1));
205205
assertEquals(1, array.get(10));
206206
assertEquals(2, matrix.getMatrixByType(MAPQMatrix.MatrixType.ZM).size());
@@ -212,24 +212,24 @@ public void parseStringAttributeTest() {
212212
ConcurrentMap<String, AtomicLong> map = new ConcurrentHashMap<>();
213213

214214
// Scenario 1: null attribute, null map
215-
BamSummaryReport.parseStringAttribute(null, null);
215+
BamSummaryReport.aggregateStringAttribute(null, null);
216216
assertTrue(map.isEmpty());
217217
// Scenario 2: null attribute, null map
218-
BamSummaryReport.parseStringAttribute(null, map);
218+
BamSummaryReport.aggregateStringAttribute(null, map);
219219
assertTrue(map.isEmpty());
220220

221221
// Scenario 3: Non-String attribute
222-
BamSummaryReport.parseStringAttribute(123, map);
222+
BamSummaryReport.aggregateStringAttribute(123, map);
223223
// Since the input parameter was not a string, no modification should have been made to the map
224224
assertEquals(map.size(), 0);
225225

226226
// Scenario 4: String attribute, null map
227-
BamSummaryReport.parseStringAttribute("testAttribute", null);
227+
BamSummaryReport.aggregateStringAttribute("testAttribute", null);
228228
// Now, the map should contain an entry with key 'testAttribute' with a count of 1
229229
assertEquals(map.size(), 0);
230230

231231
// Scenario 5: String attribute, null map
232-
BamSummaryReport.parseStringAttribute("testAttribute", map);
232+
BamSummaryReport.aggregateStringAttribute("testAttribute", map);
233233
assertEquals(map.size(), 1);
234234
}
235235

0 commit comments

Comments
 (0)