From: Mateusz Warowny Date: Thu, 7 Oct 2021 10:34:13 +0000 (+0200) Subject: JAL-3899 Replace prints with logger messages. X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Falpha%2FJAL-3899_deuniquify_refactor;p=jalview.git JAL-3899 Replace prints with logger messages. --- 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; }