From: jprocter Date: Fri, 14 Sep 2007 15:25:15 +0000 (+0000) Subject: better reproduction of compact newick files (removal of unecessary spaces) X-Git-Tag: Release_2_4~274 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=9518023410bdd4b7835df7606a30f7a55ad23222;p=jalview.git better reproduction of compact newick files (removal of unecessary spaces) --- diff --git a/src/jalview/io/NewickFile.java b/src/jalview/io/NewickFile.java index 5775072..aa9a129 100755 --- a/src/jalview/io/NewickFile.java +++ b/src/jalview/io/NewickFile.java @@ -45,7 +45,7 @@ public class NewickFile // File IO Flags boolean ReplaceUnderscores = false; - boolean printRootInfo = false; + boolean printRootInfo = true; private com.stevesoft.pat.Regex[] NodeSafeName = new com.stevesoft.pat.Regex[] { new com.stevesoft.pat.Regex().perlCode("m/[\\[,:'()]/"), // test for requiring quotes @@ -211,7 +211,7 @@ public class NewickFile String nodename = null; float DefDistance = (float) 0.001; // @param Default distance for a node - very very small - int DefBootstrap = 0; // @param Default bootstrap for a node + int DefBootstrap = -1; // @param Default bootstrap for a node float distance = DefDistance; int bootstrap = DefBootstrap; @@ -385,7 +385,7 @@ public class NewickFile { if (nbootstrap.stringMatched(1).equals(uqnodename.stringMatched(1))) { - nodename=""; // no nodename here. + nodename=null; // no nodename here. } if (nodename==null || nodename.length()==0 || nbootstrap.matchedFrom(1) > (uqnodename.matchedFrom(1) + uqnodename.stringMatched().length())) @@ -499,14 +499,6 @@ public class NewickFile } } } - else - { - if (nf.charAt(fcp)=='[') { - - } - - // else : We do nothing if ';' is encountered. - } } // Reset new node properties to obvious fakes @@ -695,7 +687,7 @@ public class NewickFile { return ( (c.getName() == null) ? "" : nodeName(c.getName())) + ( (HasBootstrap) - ? ( (c.getBootstrap() > -1) ? (" " + c.getBootstrap()) : "") : "") + + ? ( (c.getBootstrap() > -1) ? ((c.getName()!=null ? " " : "")+ c.getBootstrap()) : "") : "") + ( (HasDistances) ? (":" + c.dist) : ""); } @@ -711,7 +703,8 @@ public class NewickFile return (printRootInfo) ? ( ( (root.getName() == null) ? "" : nodeName(root.getName())) + ( (HasBootstrap) - ? ( (root.getBootstrap() > -1) ? (" " + root.getBootstrap()) : "") : + ? ( (root.getBootstrap() > -1) ? ((root.getName()!=null ? " " : "")+ + + root.getBootstrap()) : "") : "") + ( (RootHasDistance) ? (":" + root.dist) : "")) : ""; }