X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fproject%2FJalview2XML.java;h=bc2046e8835684a2663d68492df0bfd75091ea0b;hb=c24ec44edbedba55005373c43bf712c047b56faa;hp=a2ded9f9cd2713c390ec59074a679b60384c985d;hpb=cc3341f9d1465b0226d184be4216d022a62e5cee;p=jalview.git diff --git a/src/jalview/project/Jalview2XML.java b/src/jalview/project/Jalview2XML.java index a2ded9f..bc2046e 100644 --- a/src/jalview/project/Jalview2XML.java +++ b/src/jalview/project/Jalview2XML.java @@ -520,7 +520,7 @@ public class Jalview2XML } } catch (Exception x) { - System.err.println( + jalview.bin.Console.errPrintln( "IMPLEMENTATION ERROR: Failed to resolve forward reference for sequence " + ref.getSref()); x.printStackTrace(); @@ -534,29 +534,29 @@ public class Jalview2XML } if (unresolved > 0) { - System.err.println("Jalview Project Import: There were " + unresolved + jalview.bin.Console.errPrintln("Jalview Project Import: There were " + unresolved + " forward references left unresolved on the stack."); } if (failedtoresolve > 0) { - System.err.println("SERIOUS! " + failedtoresolve + jalview.bin.Console.errPrintln("SERIOUS! " + failedtoresolve + " resolvable forward references failed to resolve."); } if (incompleteSeqs != null && incompleteSeqs.size() > 0) { - System.err.println( + jalview.bin.Console.errPrintln( "Jalview Project Import: There are " + incompleteSeqs.size() + " sequences which may have incomplete metadata."); if (incompleteSeqs.size() < 10) { for (SequenceI s : incompleteSeqs.values()) { - System.err.println(s.toString()); + jalview.bin.Console.errPrintln(s.toString()); } } else { - System.err.println( + jalview.bin.Console.errPrintln( "Too many to report. Skipping output of incomplete sequences."); } } @@ -936,7 +936,7 @@ public class Jalview2XML object.setCreationDate(now); } catch (DatatypeConfigurationException e) { - System.err.println("error writing date: " + e.toString()); + jalview.bin.Console.errPrintln("error writing date: " + e.toString()); } object.setVersion(Cache.getDefault("VERSION", "Development Build")); @@ -1003,14 +1003,14 @@ public class Jalview2XML // HAPPEN! (PF00072.15.stk does this) // JBPNote: Uncomment to debug writing out of files that do not read // back in due to ArrayOutOfBoundExceptions. - // System.err.println("vamsasSeq backref: "+id+""); - // System.err.println(jds.getName()+" + // jalview.bin.Console.errPrintln("vamsasSeq backref: "+id+""); + // jalview.bin.Console.errPrintln(jds.getName()+" // "+jds.getStart()+"-"+jds.getEnd()+" "+jds.getSequenceAsString()); - // System.err.println("Hashcode: "+seqHash(jds)); + // jalview.bin.Console.errPrintln("Hashcode: "+seqHash(jds)); // SequenceI rsq = (SequenceI) seqRefIds.get(id + ""); - // System.err.println(rsq.getName()+" + // jalview.bin.Console.errPrintln(rsq.getName()+" // "+rsq.getStart()+"-"+rsq.getEnd()+" "+rsq.getSequenceAsString()); - // System.err.println("Hashcode: "+seqHash(rsq)); + // jalview.bin.Console.errPrintln("Hashcode: "+seqHash(rsq)); } else { @@ -1526,7 +1526,7 @@ public class Jalview2XML ov.getCanvas().getResidueColour().getRGB()); overview.setHiddenColour(ov.getCanvas().getHiddenColour().getRGB()); view.setOverview(overview); - } + } if (av.getGlobalColourScheme() instanceof jalview.schemes.UserColourScheme) { view.setBgColour(setUserColourScheme(av.getGlobalColourScheme(), @@ -1763,7 +1763,7 @@ public class Jalview2XML try { fileName = fileName.replace('\\', '/'); - System.out.println("Writing jar entry " + fileName); + jalview.bin.Console.outPrintln("Writing jar entry " + fileName); JarEntry entry = new JarEntry(fileName); jout.putNextEntry(entry); PrintWriter pout = new PrintWriter( @@ -1784,7 +1784,7 @@ public class Jalview2XML } catch (Exception ex) { // TODO: raise error in GUI if marshalling failed. - System.err.println("Error writing Jalview project"); + jalview.bin.Console.errPrintln("Error writing Jalview project"); ex.printStackTrace(); } } @@ -2098,7 +2098,7 @@ public class Jalview2XML File file = new File(infilePath); if (file.exists() && jout != null) { - System.out.println( + jalview.bin.Console.outPrintln( "Writing jar entry " + jarEntryName + " (" + msg + ")"); jout.putNextEntry(new JarEntry(jarEntryName)); copyAll(is, jout); @@ -2307,22 +2307,24 @@ public class Jalview2XML line.setColour(annotation.getThreshold().colour.getRGB()); an.setThresholdLine(line); } - if (annotation.graph==AlignmentAnnotation.CONTACT_MAP) + if (annotation.graph == AlignmentAnnotation.CONTACT_MAP) { - if (annotation.sequenceRef.getContactMaps()!=null) + if (annotation.sequenceRef.getContactMaps() != null) { - ContactMatrixI cm = annotation.sequenceRef.getContactMatrixFor(annotation); - if (cm!=null) + ContactMatrixI cm = annotation.sequenceRef + .getContactMatrixFor(annotation); + if (cm != null) { MatrixType xmlmat = new MatrixType(); xmlmat.setType(cm.getType()); xmlmat.setRows(BigInteger.valueOf(cm.getWidth())); xmlmat.setCols(BigInteger.valueOf(cm.getHeight())); - // consider using an opaque to/from -> allow instance to control its representation ? + // consider using an opaque to/from -> allow instance to control + // its representation ? xmlmat.setElements(ContactMatrix.contactToFloatString(cm)); if (cm.hasGroups()) { - for (BitSet gp: cm.getGroups()) + for (BitSet gp : cm.getGroups()) { xmlmat.getGroups().add(stringifyBitset(gp)); } @@ -2337,7 +2339,6 @@ public class Jalview2XML { xmlmat.setCutHeight(cm.getCutHeight()); } - // set/get properties if (cm instanceof MappableContactMatrixI) { @@ -2478,37 +2479,42 @@ public class Jalview2XML } - private String stringifyBitset(BitSet gp) { + private String stringifyBitset(BitSet gp) + { StringBuilder sb = new StringBuilder(); - for (long val:gp.toLongArray()) + for (long val : gp.toLongArray()) { - if (sb.length()>0) { + if (sb.length() > 0) + { sb.append(","); } sb.append(val); } return sb.toString(); } - private BitSet deStringifyBitset(String stringified) { - if ("".equals(stringified) || stringified==null) + + private BitSet deStringifyBitset(String stringified) + { + if ("".equals(stringified) || stringified == null) { return new BitSet(); } String[] longvals = stringified.split(","); long[] newlongvals = new long[longvals.length]; - for (int lv=0;lv 0) { - for (jalview.xml.binding.jalview.Property prop : annotation.getProperty()) + for (jalview.xml.binding.jalview.Property prop : annotation + .getProperty()) { jaa.setProperty(prop.getName(), prop.getValue()); } @@ -4039,12 +4046,13 @@ public class Jalview2XML xmlmat.getCols().intValue(), xmlmat.getRows().intValue()); jalview.util.MapList mapping = null; - if (xmlmat.getMapping()!=null) + if (xmlmat.getMapping() != null) { MapListType m = xmlmat.getMapping(); // Mapping m = dr.getMapping(); int fr[] = new int[m.getMapListFrom().size() * 2]; - Iterator from = m.getMapListFrom().iterator();// enumerateMapListFrom(); + Iterator from = m.getMapListFrom() + .iterator();// enumerateMapListFrom(); for (int _i = 0; from.hasNext(); _i += 2) { MapListFrom mf = from.next(); @@ -4060,29 +4068,34 @@ public class Jalview2XML fto[_i + 1] = mf.getEnd(); } - mapping = new jalview.util.MapList(fr, fto, m.getMapFromUnit().intValue(),m.getMapToUnit().intValue()); + mapping = new jalview.util.MapList(fr, fto, + m.getMapFromUnit().intValue(), + m.getMapToUnit().intValue()); } - List newgroups=new ArrayList(); - if (xmlmat.getGroups().size()>0) + List newgroups = new ArrayList(); + if (xmlmat.getGroups().size() > 0) { - for (String sgroup:xmlmat.getGroups()) + for (String sgroup : xmlmat.getGroups()) { newgroups.add(deStringifyBitset(sgroup)); } } - String nwk=xmlmat.getNewick().size()>0 ? xmlmat.getNewick().get(0):null; - if (xmlmat.getNewick().size()>1) + String nwk = xmlmat.getNewick().size() > 0 + ? xmlmat.getNewick().get(0) + : null; + if (xmlmat.getNewick().size() > 1) { Console.log.info( "Ignoring additional clusterings for contact matrix"); } - String treeMethod = xmlmat.getTreeMethod(); - double thresh = xmlmat.getCutHeight()!=null ? xmlmat.getCutHeight() : 0; + double thresh = xmlmat.getCutHeight() != null + ? xmlmat.getCutHeight() + : 0; GroupSet grpset = new GroupSet(); grpset.restoreGroups(newgroups, treeMethod, nwk, thresh); PAEContactMatrix newpae = new PAEContactMatrix( - jaa.sequenceRef, mapping, elements,grpset); + jaa.sequenceRef, mapping, elements, grpset); jaa.sequenceRef.addContactListFor(jaa, newpae); } } @@ -4243,7 +4256,7 @@ public class Jalview2XML // XML. // and then recover its containing af to allow the settings to be applied. // TODO: fix for vamsas demo - System.err.println( + jalview.bin.Console.errPrintln( "About to recover a viewport for existing alignment: Sequence set ID is " + uniqueSeqSetId); Object seqsetobj = retrieveExistingObj(uniqueSeqSetId); @@ -4252,13 +4265,13 @@ public class Jalview2XML if (seqsetobj instanceof String) { uniqueSeqSetId = (String) seqsetobj; - System.err.println( + jalview.bin.Console.errPrintln( "Recovered extant sequence set ID mapping for ID : New Sequence set ID is " + uniqueSeqSetId); } else { - System.err.println( + jalview.bin.Console.errPrintln( "Warning : Collision between sequence set ID string and existing jalview object mapping."); } @@ -4330,8 +4343,8 @@ public class Jalview2XML */ protected void loadOverview(Viewport view, String version, AlignFrame af) { - if (!isVersionStringLaterThan("2.11.3", - version) && view.getOverview()==null) + if (!isVersionStringLaterThan("2.11.3", version) + && view.getOverview() == null) { return; } @@ -4478,8 +4491,8 @@ public class Jalview2XML { if (tree.isColumnWise()) { - AlignmentAnnotation aa = (AlignmentAnnotation) annotationIds.get(tree - .getColumnReference()); + AlignmentAnnotation aa = (AlignmentAnnotation) annotationIds + .get(tree.getColumnReference()); if (aa == null) { Console.warn( @@ -4698,7 +4711,7 @@ public class Jalview2XML createOrLinkStructureViewer(entry, af, ap, jprovider); } catch (Exception e) { - System.err.println( + jalview.bin.Console.errPrintln( "Error loading structure viewer: " + e.getMessage()); // failed - try the next one } @@ -4902,7 +4915,7 @@ public class Jalview2XML || version.equalsIgnoreCase("Test") || version.equalsIgnoreCase("AUTOMATED BUILD")) { - System.err.println("Assuming project file with " + jalview.bin.Console.errPrintln("Assuming project file with " + (version == null ? "null" : version) + " is compatible with Jalview version " + supported); return true; @@ -4949,7 +4962,7 @@ public class Jalview2XML // // @Override // protected void processKeyEvent(java.awt.event.KeyEvent e) { - // System.out.println("Jalview2XML AF " + e); + // jalview.bin.Console.outPrintln("Jalview2XML AF " + e); // super.processKeyEvent(e); // // } @@ -5037,10 +5050,11 @@ public class Jalview2XML viewport.setIncrement(safeInt(view.getConsThreshold())); viewport.setShowJVSuffix(safeBoolean(view.isShowFullId())); viewport.setRightAlignIds(safeBoolean(view.isRightAlignIds())); - viewport.setFont(new Font(view.getFontName(), - safeInt(view.getFontStyle()), safeInt(view.getFontSize())), - (view.getCharWidth()!=null) ? false : true); - if (view.getCharWidth()!=null) + viewport.setFont( + new Font(view.getFontName(), safeInt(view.getFontStyle()), + safeInt(view.getFontSize())), + (view.getCharWidth() != null) ? false : true); + if (view.getCharWidth() != null) { viewport.setCharWidth(view.getCharWidth()); viewport.setCharHeight(view.getCharHeight()); @@ -5363,11 +5377,11 @@ public class Jalview2XML } if (matchedAnnotation == null) { - System.err.println("Failed to match annotation colour scheme for " + jalview.bin.Console.errPrintln("Failed to match annotation colour scheme for " + annotationId); return null; } - // belt-and-braces create a threshold line if the + // belt-and-braces create a threshold line if the // colourscheme needs one but the matchedAnnotation doesn't have one if (safeInt(viewAnnColour.getAboveThreshold()) != 0 && matchedAnnotation.getThreshold() == null) @@ -5822,7 +5836,7 @@ public class Jalview2XML } // TODO: merges will never happen if we 'know' we have the real dataset // sequence - this should be detected when id==dssid - System.err.println( + jalview.bin.Console.errPrintln( "DEBUG Notice: Merged dataset sequence (if you see this often, post at http://issues.jalview.org/browse/JAL-1474)"); // (" // + (pre ? "prepended" : "") + " " // + (post ? "appended" : "")); @@ -6015,7 +6029,7 @@ public class Jalview2XML } else { - System.err.println( + jalview.bin.Console.errPrintln( "Warning - making up dataset sequence id for DbRef sequence map reference"); sqid = ((Object) ms).toString(); // make up a new hascode for // undefined dataset sequence hash @@ -6696,7 +6710,7 @@ public class Jalview2XML } catch (IllegalStateException e) { // mixing AND and OR conditions perhaps - System.err.println( + jalview.bin.Console.errPrintln( String.format("Error reading filter conditions for '%s': %s", featureType, e.getMessage())); // return as much as was parsed up to the error @@ -6777,7 +6791,7 @@ public class Jalview2XML } else { - System.err.println("Malformed compound filter condition"); + jalview.bin.Console.errPrintln("Malformed compound filter condition"); } } }