skbio.tree.TreeNode.write

TreeNode.write(fp, format='newick', **kwargs)[source]

Write an instance of TreeNode to a file.

This is a convenience method for skbio.io.write. For more information about the I/O system in scikit-bio, please see skbio.io.

Supported file formats include:

Parameters:

fp : filepath or filehandle

The location to write the given format into. Filepaths are automatically closed when written; filehandles are the responsibility of the caller.

format : str

The format must be a registered format name with a writer for TreeNode. Default is ‘newick’.

kwargs : dict, optional

Keyword arguments passed to skbio.io.write and the file format writer.