Skip to content

Commit

Permalink
Add multiline method for warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
seppinho committed Jul 17, 2024
1 parent 010b116 commit 79457fa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ private boolean analyzeFiles() {
report.add(" - " + pop.getId());
}
}
output.error(report.toString());
output.error(report);
return false;
}

Expand Down Expand Up @@ -313,20 +313,20 @@ private boolean analyzeFiles() {
text.add("Allele mismatch: " + formatter.format(task.getAlleleMismatch()));
text.add("SNPs call rate < 90%: " + formatter.format(task.getLowCallRate()));

output.message(text.toString());
output.message(text);

text = new Vector<String>();

text.add("Excluded sites in total: " + formatter.format(task.getFiltered()));
text.add("Remaining sites in total: " + formatter.format(task.getOverallSnps()));

if (task.getFiltered() > 0) {
text.add("See snps-excluded.txt for details" + "\n");
text.add("See snps-excluded.txt for details");
}

if (task.getNotFoundInLegend() > 0) {
text.add("Typed only sites: " + formatter.format(task.getNotFoundInLegend()));
text.add("See typed-only.txt for details" + "\n");
text.add("See typed-only.txt for details");
}

if (task.getRemovedChunksSnps() > 0) {
Expand Down Expand Up @@ -365,7 +365,7 @@ private boolean analyzeFiles() {
if (excludedChunks == overallChunks) {

text.add("\n<b>Error:</b> No chunks passed the QC step. Imputation cannot be started!");
output.error(text.toString());
output.error(text);

return false;

Expand All @@ -374,15 +374,15 @@ private boolean analyzeFiles() {
else if (task.getStrandFlipSimple() + task.getStrandFlipAndAlleleSwitch() > strandFlips) {
text.add("\n<b>Error:</b> More than " + strandFlips
+ " obvious strand flips have been detected. Please check strand. Imputation cannot be started!");
output.error(text.toString());
output.error(text);

return false;
}

else if (task.isChrXMissingRate()) {
text.add(
"\n<b>Error:</b> Chromosome X nonPAR region includes > 10 % mixed genotypes. Imputation cannot be started!");
output.error(text.toString());
output.error(text);

return false;
}
Expand All @@ -391,15 +391,15 @@ else if (task.isChrXPloidyError()) {
text.add(
"\n<b>Error:</b> ChrX nonPAR region includes ambiguous samples (haploid and diploid positions). Imputation cannot be started! See "
+ "chrX-info.txt");
output.error(text.toString());
output.error(text);

return false;
}

else {

text.add(results.getMessage());
output.warning(text.toString());

output.warning(text);
return true;

}
Expand All @@ -418,6 +418,7 @@ protected TaskResults runTask(final OutputWriter output, ITask task) {
}
return results;
} catch (Exception e) {
System.out.println("dfdfd " +e.getMessage());
e.printStackTrace();
TaskResults result = new TaskResults();
result.setSuccess(false);
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/genepi/imputationserver/util/OutputWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ public void warning(String message) {
public void warning(Exception e) {
warning(StringEscapeUtils.escapeHtml(e.getMessage()));
}

public void warning(List<String> messages) {
printMultilineCommand("warning", messages);
}

public void error(String message) {
printCommand("::error::", message);
Expand Down

0 comments on commit 79457fa

Please sign in to comment.