Main Content

getnewickstr (phytree)

Create Newick-formatted character vector


nwk = getnewickstr(Tree)
getnewickstr(..., 'PropertyName', PropertyValue,...)
getnewickstr(..., 'Distances', DistancesValue)
getnewickstr(..., 'BranchNames', BranchNamesValue)


TreePhytree object created with the function phytree.
DistancesValueProperty to control including or excluding distances in the output. Enter either true (include distances) or false (exclude distances). Default is true.
BranchNamesValueProperty to control including or excluding branch names in the output. Enter either true (include branch names) or false (exclude branch names). Default is false.


nwk = getnewickstr(Tree) returns the Newick-formatted character vector of a phylogenetic tree object (Tree).

getnewickstr(..., 'PropertyName', PropertyValue,...) defines optional properties using property name/value pairs.

getnewickstr(..., 'Distances', DistancesValue), when DistancesValue is false, excludes the distances from the output.

getnewickstr(..., 'BranchNames', BranchNamesValue), when BranchNamesValue is true, includes the branch names in the output.


  1. Create some random sequences.

    seqs = int2nt(ceil(rand(10)*4));
  2. Calculate pairwise distances.

    dist = seqpdist(seqs,'alpha','nt');
  3. Construct a phylogenetic tree.

    tree = seqlinkage(dist);  
  4. Get the Newick-formatted character vector.

    nwk  = getnewickstr(tree) 


Information about the Newick tree format.

Introduced before R2006a