private void toPhyloXMLNoPhyloXmlSource( final Writer writer, final Phylogeny tree, final int phyloxml_level ) throws IOException { setPhyloXmlLevel( phyloxml_level ); setOutputFormt( FORMAT.PHYLO_XML ); writeOutput( writer, tree ); }
public StringBuffer toNewHampshire( final Phylogeny tree, final boolean nh_write_distance_to_parent, final NH_CONVERSION_SUPPORT_VALUE_STYLE svs ) throws IOException { setOutputFormt( FORMAT.NH ); setNhConversionSupportStyle( svs ); setWriteDistanceToParentInNH( nh_write_distance_to_parent ); return getOutput( tree ); }
public StringBuffer toNewHampshire( final Phylogeny tree, final boolean nh_write_distance_to_parent ) throws IOException { setOutputFormt( FORMAT.NH ); setWriteDistanceToParentInNH( nh_write_distance_to_parent ); return getOutput( tree ); }
/** * Convert a Phylogenetic tree to its Newick representation, so that it can * be exported to an external application. * * @param phylo * Phylogeny phylogenetic tree * @param writeDistances * write the branch lengths if true * @return * @throws IOException */ public static String getNewickString(Phylogeny phylo, boolean writeDistances) throws IOException { PhylogenyWriter w = new PhylogenyWriter(); StringBuffer newickString = w.toNewHampshire(phylo, writeDistances); return newickString.toString(); }
public void toPhyloXML( final Writer writer, final Phylogeny tree, final int phyloxml_level ) throws IOException { setPhyloXmlLevel( phyloxml_level ); setOutputFormt( FORMAT.PHYLO_XML ); writePhyloXmlStart( writer ); writeOutput( writer, tree ); writePhyloXmlEnd( writer ); }
private static void writeTree( final Phylogeny p, final File f, final String comment ) throws IOException { final PhylogenyWriter writer = new PhylogenyWriter(); writer.toPhyloXML( f, p, 0 ); System.out.println( comment + " \"" + f + "\"" ); } }
public void toNewHampshire( final Phylogeny tree, final boolean write_distance_to_parent, final NH_CONVERSION_SUPPORT_VALUE_STYLE svs, final File out_file ) throws IOException { writeToFile( toNewHampshire( tree, write_distance_to_parent, svs ), out_file ); }
public static PhylogenyWriter createPhylogenyWriter() { return new PhylogenyWriter(); }
private void writeCladeSeparator() { setSawComma( true ); if ( ( getOutputFormt() == FORMAT.NHX ) || ( getOutputFormt() == FORMAT.NH ) ) { getBuffer().append( "," ); } }
public void toPhyloXML( final Writer writer, final Phylogeny[] trees, final int phyloxml_level, final String separator ) throws IOException { writePhyloXmlStart( writer ); for( final Phylogeny phylogeny : trees ) { toPhyloXMLNoPhyloXmlSource( writer, phylogeny, phyloxml_level ); writer.write( separator ); } writePhyloXmlEnd( writer ); }
public void toNewHampshireX( final Phylogeny tree, final File out_file ) throws IOException { writeToFile( toNewHampshireX( tree ), out_file ); }
public PhylogenyWriter() { setIndentPhyloxml( INDENT_PHYLOXML_DEAFULT ); setNhConversionSupportStyle( NH_CONVERSION_SUPPORT_VALUE_STYLE.NONE ); }
public StringBuffer toNewHampshireX( final Phylogeny tree ) throws IOException { setOutputFormt( FORMAT.NHX ); return getOutput( tree ); }
private StringBuffer createIndentation() { if ( !isIndentPhyloxml() ) { return null; } final StringBuffer sb = new StringBuffer( getNodeLevel() * 2 ); for( int i = 0; i < getNodeLevel(); ++i ) { sb.append( PhylogenyWriter.PHYLO_XML_INTENDATION_BASE ); } return sb; }
private void writeToFasta( final Writer w ) throws IOException { SequenceWriter.writeSeqs( asSequenceList(), w, SEQ_FORMAT.FASTA, 100 ); }
public static StringBuilder toFasta( final MolecularSequence seq, final int width ) { return toFasta( seq.getIdentifier(), seq.getMolecularSequenceAsString(), width ); }
public static void writePhylogenyToFile( final Phylogeny phylogeny, final String filename ) { final PhylogenyWriter writer = new PhylogenyWriter(); try { writer.toPhyloXML( new File( filename ), phylogeny, 1 ); } catch ( final IOException e ) { ForesterUtil.printWarningMessage( surfacing.PRG_NAME, "failed to write phylogeny to \"" + filename + "\": " + e ); } ForesterUtil.programMessage( surfacing.PRG_NAME, "Wrote phylogeny to \"" + filename + "\"" ); }
public void toNewHampshire( final Phylogeny[] trees, final boolean write_distance_to_parent, final File out_file, final String separator ) throws IOException { final StringBuffer sb = new StringBuffer(); for( final Phylogeny element : trees ) { sb.append( toNewHampshire( element, write_distance_to_parent ) ); sb.append( separator ); } writeToFile( sb, out_file ); }
public void toNewHampshireX( final Phylogeny[] trees, final File out_file, final String separator ) throws IOException { final StringBuffer sb = new StringBuffer(); for( final Phylogeny element : trees ) { sb.append( toNewHampshireX( element ) ); sb.append( separator ); } writeToFile( sb, out_file ); }
static boolean writeAsPhyloXml( final TreePanel tp, final Options op, boolean exception, final File file ) { try { final PhylogenyWriter writer = new PhylogenyWriter(); writer.toPhyloXML( file, tp.getPhylogeny(), 0 ); } catch ( final Exception e ) { exception = true; exceptionOccuredDuringSaveAs( e, tp, tp ); } return exception; }