write_phyloxml: Save a phylo tree as phyloXML

Description Usage Arguments Details Value References See Also Examples

View source: R/write.R

Description

Coerce phylogenetic trees to phyloXML documents, objects of class xml_document.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
write_phyloxml(
  tree,
  file = "",
  overwrite = FALSE,
  read_options = list(),
  write_options = list(),
  events = NULL,
  ...
)

## S3 method for class 'phylo'
write_phyloxml(
  tree,
  file = "",
  overwrite = FALSE,
  read_options = list(),
  write_options = list(),
  events = NULL,
  name = "A phylogenetic tree",
  description = "Some description",
  xmlns = "http://www.phyloxml.org",
  digits = 20,
  ...
)

Arguments

tree

A phylogenetic tree.

file

Character scalar. When equal to "", the function only prints the xml document and returns the object invisibly. Otherwise, it will try to write the xml file to the specified path using xml2::write_xml().

overwrite

When FALSE, the function will check first whether file exists, and if so, return with an error.

read_options, write_options

List of arguments passed to xml2::read_xml and xml2::write_xml respectively.

events

A data.frame with events. It must be nrow(events) = Nedge(tree) (see examples).

...

Further arguments to be passed to the method (see details).

name

Character scalar. Name of the tree.

description

Character scalar. Description of the tree.

xmlns

Character scalar. Location of the default namespace (see the XML Namespaces section in w3schools).

digits

Integer scalar. Precision to use when writing numbers.

Details

So far, this function has a method for phylo objects from the ape package. The following elements are supported:

Value

An XML document (see xml2::read_xml)

References

Han M.V. and Zmasek C.M. (2009) "phyloXML: XML for evolutionary biology and comparative genomics" BMC Bioinformatics, 10:356 doi:10.1186/1471-2105-10-356

See Also

validate_phyloxml

Examples

1
2
3
4
5
6
# Random tree from the ape package ------------------------------------------
set.seed(1)
x <- ape::rtree(5)
x

write_phyloxml(x)

USCbiostats/rphyloxml documentation built on Nov. 2, 2020, 11:38 a.m.