/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
+ * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
-
// NewickFile.java
// Tree I/O
// http://evolution.genetics.washington.edu/phylip/newick_doc.html
private com.stevesoft.pat.Regex[] NodeSafeName = new com.stevesoft.pat.Regex[]
{ new com.stevesoft.pat.Regex().perlCode("m/[\\[,:'()]/"), // test for
- // requiring
- // quotes
+ // requiring
+ // quotes
new com.stevesoft.pat.Regex().perlCode("s/'/''/"), // escaping quote
- // characters
+ // characters
new com.stevesoft.pat.Regex().perlCode("s/\\/w/_/") // unqoted whitespace
- // transformation
+ // transformation
};
char QuoteChar = '\'';
String commentString2 = null; // comments after simple node props
float DefDistance = (float) 0.001; // @param Default distance for a node -
- // very very small
+ // very very small
int DefBootstrap = -1; // @param Default bootstrap for a node
float distance = DefDistance;
int bootstrap = DefBootstrap;
boolean ascending = false; // flag indicating that we are leaving the
- // current node
+ // current node
com.stevesoft.pat.Regex majorsyms = new com.stevesoft.pat.Regex(
"[(\\['),;]");
if (uqnodename.search(fstring)
&& ((uqnodename.matchedFrom(1) == 0) || (fstring
.charAt(uqnodename.matchedFrom(1) - 1) != ':'))) // JBPNote
- // HACK!
+ // HACK!
{
if (nodename == null)
{
if (c == realroot)
{
RootHasDistance = nodehasdistance; // JBPNote This is really
- // UGLY!!! Ensure root node gets
- // its given distance
+ // UGLY!!! Ensure root node gets
+ // its given distance
}
parseNHXNodeProps(c, commentString2);
commentString2 = null;
nodename = null;
distance = DefDistance;
bootstrap = DefBootstrap;
- commentString2=null;
+ commentString2 = null;
}
if (nextcp == 0)
{
// tree is output
if (commentString != null && commentString.startsWith("&&NHX"))
{
- StringTokenizer st = new StringTokenizer(commentString.substring(5),":");
+ StringTokenizer st = new StringTokenizer(commentString.substring(5),
+ ":");
while (st.hasMoreTokens())
{
String tok = st.nextToken();
- int colpos=tok.indexOf("=");
+ int colpos = tok.indexOf("=");
- if (colpos>-1)
+ if (colpos > -1)
{
String code = tok.substring(0, colpos);
- String value = tok.substring(colpos+1);
- try {
+ String value = tok.substring(colpos + 1);
+ try
+ {
// parse out code/value pairs
if (code.toLowerCase().equals("b"))
{
- int v=-1;
+ int v = -1;
Float iv = new Float(value);
v = iv.intValue(); // jalview only does integer bootstraps
- // currently
+ // currently
c.setBootstrap(v);
HasBootstrap = true;
}
// more codes here.
- }
- catch (Exception e)
+ } catch (Exception e)
{
- System.err.println("Couldn't parse code '"+code+"' = '"+value+"'");
+ System.err.println("Couldn't parse code '" + code + "' = '"
+ + value + "'");
e.printStackTrace(System.err);
}
}
}
}
-
-
+
}
/**