From e7e676ca075c5b2832be98b4544364e5d6adc4c1 Mon Sep 17 00:00:00 2001 From: Mateusz Warowny Date: Thu, 7 Oct 2021 12:34:13 +0200 Subject: [PATCH] JAL-3899 Replace prints with logger messages. --- src/jalview/analysis/SeqsetUtils.java | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/jalview/analysis/SeqsetUtils.java b/src/jalview/analysis/SeqsetUtils.java index 6683e3b..e2ed9b4 100755 --- a/src/jalview/analysis/SeqsetUtils.java +++ b/src/jalview/analysis/SeqsetUtils.java @@ -20,6 +20,7 @@ */ package jalview.analysis; +import jalview.bin.Cache; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.HiddenMarkovModel; import jalview.datamodel.PDBEntry; @@ -37,6 +38,7 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.Vector; +import static java.lang.String.format; public class SeqsetUtils { @@ -117,9 +119,12 @@ public class SeqsetUtils sq.setDescription(sqinfo.description.get()); if (sqinfo.dataset.isPresent()) { - assert sqinfo.features.isEmpty() : - "Setting dataset sequence for a sequence which has sequence features. " + - "Dataset sequence features will not be visible."; + if (sqinfo.features.isPresent()) + { + Cache.log.warn("Setting dataset sequence for a sequence which has " + + "sequence features. Dataset sequence features will not be visible."); + assert false; + } sq.setDatasetSequence(sqinfo.dataset.get()); } if (sqinfo.hmm.isPresent()) @@ -240,25 +245,27 @@ public class SeqsetUtils { if (!quiet) { - System.err.println("Can't find '" + ((String) key) - + "' in uniquified alignment"); + Cache.log.warn(format("Can't find '%s' in uniquified alignment", + key)); } } } catch (ClassCastException ccastex) { if (!quiet) { - System.err.println("Unexpected object in SeqSet map : "+key.getClass()); + Cache.log.error("Unexpected object in SeqSet map : "+ key.getClass()); } } } if (unmatched.size() > 0 && !quiet) { - System.err.println("Did not find matches for :"); - for (Enumeration i = unmatched.elements(); - i.hasMoreElements();) + StringBuilder sb = new StringBuilder("Did not find match for sequences: "); + Enumeration i = unmatched.elements(); + sb.append(i.nextElement().getName()); + for (; i.hasMoreElements();) { - System.out.println(((SequenceI) i.nextElement()).getName()); + sb.append(", " + i.nextElement().getName()); } + Cache.log.warn(sb.toString()); return false; } -- 1.7.10.2