Skip to content

Commit 3353fd1

Browse files
Oliver HolmesOliver Holmes
authored andcommitted
refactor(qprofiler qvisualise): adding comments and tweaking logging as per reviewer suggestions
1 parent 8b22945 commit 3353fd1

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

qprofiler/src/org/qcmg/qprofiler/fastq/FastqSummaryReport.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,18 +292,18 @@ void parseFiveElementHeaderWithSpaces(String [] params) {
292292
// split by space
293293
String [] firstElementParams = params[0].split(" ");
294294
if (firstElementParams.length != 2) {
295-
throw new UnsupportedOperationException("Incorrect header format encountered in parseFiveElementHeader. Expected '@ERR091788.3104 HSQ955_155:2:1101:13051:2071/2' but received: " + Arrays.deepToString(params));
295+
throw new IllegalArgumentException("Incorrect header format encountered in parseFiveElementHeaderWithSpaces. Expected a space (e.g. @ERR091788.3104 HSQ955_155) in the first element in the array, but received: " + Arrays.deepToString(params));
296296
}
297297
String [] machineAndReadPosition = firstElementParams[0].split("\\.");
298298
if (machineAndReadPosition.length != 2) {
299-
throw new UnsupportedOperationException("Incorrect header format encountered in parseFiveElementHeader. Expected '@ERR091788.3104 HSQ955_155:2:1101:13051:2071/2' but received: " + Arrays.deepToString(params));
299+
throw new IllegalArgumentException("Incorrect header format encountered in parseFiveElementHeaderWithSpaces. Expected a single dot (e.g. @ERR091788.3104 HSQ955_155) in the first part of the first element in the array, but received: " + Arrays.deepToString(params));
300300
}
301301

302302
updateMap(instruments, machineAndReadPosition[0]);
303303

304304
String [] flowCellAndRunId = firstElementParams[1].split("_");
305305
if (flowCellAndRunId.length != 2) {
306-
throw new UnsupportedOperationException("Incorrect header format encountered in parseFiveElementHeader. Expected '@ERR091788.3104 HSQ955_155:2:1101:13051:2071/2' but received: " + Arrays.deepToString(params));
306+
throw new IllegalArgumentException("Incorrect header format encountered in parseFiveElementHeaderWithSpaces. Expected a single underscore (e.g. @ERR091788.3104 HSQ955_155) in the second part of the first element in the array but received: " + Arrays.deepToString(params));
307307
}
308308

309309
updateMap(flowCellIds, flowCellAndRunId[0]);

qvisualise/src/org/qcmg/qvisualise/QVisualise.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,13 @@ public static void examineFileSizeAndXmx(String inputFile) throws IOException {
4545
logger.info("supplied Xmx memory: " + xmxSize);
4646
double ratio = (double)xmxSize / fileSize;
4747
logger.info("memory / file size ratio: " + ratio);
48+
/*
49+
Warn the user when the xml file size to Xmx setting ratio is below a certain point
50+
(8 in testing performed using java 8 oracle JVM)
51+
as this could result in OOM exceptions
52+
*/
4853
if (ratio < 8) {
49-
logger.warn("There may not be enough memory to load the xml input file. Please consider loading a smaller xml file or increasing the Xmx value.");
54+
logger.warn("There may not be enough memory to load the xml input file. Please consider visualising a smaller xml file or increasing the Xmx value.");
5055
}
5156
}
5257

qvisualise/src/org/qcmg/qvisualise/util/QProfilerCollectionsUtils.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
public class QProfilerCollectionsUtils {
2929

30+
public static final int MAX_TALLY_ITEMS_LENGTH = 100000;
3031
public static QLogger log = QLoggerFactory.getLogger(QProfilerCollectionsUtils.class);
3132

3233
/**
@@ -149,7 +150,7 @@ public static <T> void populateTallyItemMap(Element cycleElement,
149150
if (null != cycleElement) {
150151

151152
final NodeList tallyItemsNL = cycleElement.getElementsByTagName("TallyItem");
152-
if (tallyItemsNL.getLength() < 100000) {
153+
if (tallyItemsNL.getLength() < MAX_TALLY_ITEMS_LENGTH) {
153154
for (int j = 0, size = tallyItemsNL.getLength(); j < size; j++) {
154155
if (tallyItemsNL.item(j) instanceof Element) {
155156
Element tallyItemElement = (Element) tallyItemsNL.item(j);
@@ -166,7 +167,7 @@ public static <T> void populateTallyItemMap(Element cycleElement,
166167
}
167168
}
168169
} else {
169-
log.warn(cycleElement.getTagName() + " has too many elements: " + tallyItemsNL.getLength() + " - will leave out of report");
170+
log.warn(cycleElement.getTagName() + " has too many elements: " + tallyItemsNL.getLength() + " - will leave out of report (maximum number of elements set to: " + MAX_TALLY_ITEMS_LENGTH + ")");
170171

171172
}
172173
}

0 commit comments

Comments
 (0)