The main data manager, consisting of a lists of taxa, trees, and character phylogenetic data objects, as well as methods to create, populate, access, and delete them.
__init__ takes a new DataSet object from another DataSet object or by parsing an input stream.
Can be invoked with:
- a single unnamed argument that is an instance of a DataSet (which will result in a deep copy of all taxa, trees and characters),
- 1 or more unnamed TaxonSet, TreeList or CharacterMatrix (which is like calling DataSet.add with each argument)
- keyword arguments that supply a file-like object (stream) to be parsed and a string (schema) specifying the schema of the data in the file-like object.
Generic add for TaxonSet, TreeList or CharacterMatrix objects.
Accession of existing CharacterMatrix into chars of self.
Adds an existing TaxonSet object to this DataSet.
Accession of existing TreeList object into tree_lists of self.
Forces all read() calls on this DataSet to use the same TaxonSet. If taxon_set If taxon_set is None, then a new TaxonSet will be created, added to self.taxa, and that is the TaxonSet that will be attached.
Returns description of object, up to level depth.
Returns an existing TaxonSet object in this DataSet, selected by keywords oid or label.
Returns a TreeList object specified by one (and exactly one) of the following keyword arguments:
- label
- oid
Raises KeyError if no matching TreeList is found, unless ignore_error is set to True.
Creation and accession of new CharacterMatrix (of class char_matrix_type) into chars of self.”
Creates a new TaxonSet object, according to the arguments given (passed to TaxonSet()), and adds it to this DataSet.
Creation and accession of new TreeList into trees of self.
Populates this DataSet object from a file-like object data source stream, formatted in schema. schema must be a recognized and supported phylogenetic data file schema. If reading is not implemented for the schema specified, then a UnsupportedSchemaError is raised.
The following optional keyword arguments are also recognized:
exclude_trees if True skips over tree data
exclude_chars if True skips over character data
- encode_splits specifies whether or not split bitmasks will be
calculated and attached to the edges.
- finish_node_func is a function that will be applied to each node
after it has been constructed.
The following keyword arguments are recognized when parsing NEXUS or NEWICK sources:
taxon_set TaxonSet object to use when reading data
as_rooted=True (or as_unrooted=False) interprets trees as rooted
as_unrooted=True (or as_rooted=False) interprets trees as rooted
- default_as_rooted (or default_as_unrooted=False) interprets
all trees as rooted if rooting not given by [&R] or [&U] comments
- default_as_unrooted (or default_as_rooted=False) interprets
all trees as rooted if rooting not given by [&R] or [&U] comments
edge_len_type specifies the type of the edge lengths (int or float)
Additional keyword arguments may be handled by various readers specialized to handle specific data formats.
Reindices taxa across all subcomponents, mapping to single taxon set.
Writes this DataSet object to the file-like object stream in schema. schema must be a recognized and supported phylogenetic data file schema. If writing is not implemented for the schema specified, then a UnsupportedSchemaError is raised.
The following optional keyword arguments are also recognized:
- exclude_trees if True skips over tree data
- exclude_chars if True skips over character data
Additional keyword arguments may be handled by various writers specialized to handle specific data formats.