// Copyright (C) 2008-2009 Christian M. Zmasek
// Copyright (C) 2008-2009 Burnham Institute for Medical Research
// All rights reserved
-//
+//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
-//
+//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
private Stack<PostOrderStackObject> _stack;
private boolean _simple_nh;
private boolean _nh_write_distance_to_parent;
+ private boolean _write_conf_values_in_branckets_in_nh;
private boolean _indent_phyloxml;
private int _node_level;
private int _phyloxml_level;
public PhylogenyWriter() {
setIndentPhyloxml( INDENT_PHYLOXML_DEAFULT );
+ setWriteConfidenceValuesInBracketsInNH( false );
}
private void appendPhylogenyLevelPhyloXml( final Writer writer, final Phylogeny tree ) throws IOException {
public StringBuffer toNewHampshire( final Phylogeny tree,
final boolean simple_nh,
+ final boolean nh_write_distance_to_parent,
+ final boolean write_conf_values_in_branckets_in_nh ) throws IOException {
+ setOutputFormt( FORMAT.NH );
+ setWriteConfidenceValuesInBracketsInNH( write_conf_values_in_branckets_in_nh );
+ setSimpleNH( simple_nh );
+ setWriteDistanceToParentInNH( nh_write_distance_to_parent );
+ return getOutput( tree );
+ }
+
+ public StringBuffer toNewHampshire( final Phylogeny tree,
+ final boolean simple_nh,
final boolean nh_write_distance_to_parent ) throws IOException {
setOutputFormt( FORMAT.NH );
setSimpleNH( simple_nh );
writeToFile( toNewHampshire( tree, simple_nh, write_distance_to_parent ), out_file );
}
+ public void toNewHampshire( final Phylogeny tree,
+ final boolean simple_nh,
+ final boolean write_distance_to_parent,
+ final boolean use_brackets_for_confidence,
+ final File out_file ) throws IOException {
+ writeToFile( toNewHampshire( tree, simple_nh, write_distance_to_parent, use_brackets_for_confidence ), out_file );
+ }
+
public void toNewHampshire( final Phylogeny[] trees,
final boolean simple_nh,
final boolean write_distance_to_parent,
getBuffer().append( node.toNewHampshireX() );
}
else if ( getOutputFormt() == FORMAT.NH ) {
- getBuffer().append( node.toNewHampshire( isSimpleNH(), isWriteDistanceToParentInNH() ) );
+ getBuffer().append( node.toNewHampshire( isSimpleNH(),
+ isWriteDistanceToParentInNH(),
+ isWriteConfidenceValuesInBracketsInNH() ) );
}
}
+ private boolean isWriteConfidenceValuesInBracketsInNH() {
+ return _write_conf_values_in_branckets_in_nh;
+ }
+
+ private void setWriteConfidenceValuesInBracketsInNH( final boolean write_conf_values_in_branckets_in_nh ) {
+ _write_conf_values_in_branckets_in_nh = write_conf_values_in_branckets_in_nh;
+ }
+
private void writeOpenClade( final PhylogenyNode node ) throws IOException {
if ( !isSawComma() ) {
if ( !node.isRoot() && node.isFirstChildNode() ) {