Base class for all phylogenetic data objects.
x.__delattr__(‘name’) <==> del x.name
default object formatter
x.__getattribute__(‘name’) <==> x.name
x.__hash__() <==> hash(x)
helper for pickle
helper for pickle
x.__repr__() <==> repr(x)
x.__setattr__(‘name’, value) <==> x.name = value
size of object in memory, in bytes
x.__str__() <==> str(x)
Creates and returns a copy of self.
| Parameters: | depth (integer) – The depth of the copy:
|
|---|
Cloning level: 1. Taxon-namespace-scoped copy: All member objects are full independent instances, except for TaxonNamespace and Taxon objects: these are preserved as references.
Mixin class which all classes that need to persist object attributes or other information as metadata should subclass.
Cloning level: 0. :attr:annotation_set of top-level object and member Annotation objects are full, independent instances. All other member objects (include objects referenced by dynamically-bound attribute values of Annotation objects) are references. All member objects are references, except for
x.__delattr__(‘name’) <==> del x.name
default object formatter
x.__getattribute__(‘name’) <==> x.name
x.__hash__() <==> hash(x)
helper for pickle
helper for pickle
x.__repr__() <==> repr(x)
x.__setattr__(‘name’, value) <==> x.name = value
size of object in memory, in bytes
x.__str__() <==> str(x)
Copies annotations from other, which must be of Annotable type.
Copies are deep-copies, in that the Annotation objects added to the annotation_set AnnotationSet collection of self are independent copies of those in the annotate_set collection of other. However, dynamic bound-attribute annotations retain references to the original objects as given in other, which may or may not be desirable. This is handled by updated the objects to which attributes are bound via mappings found in attribute_object_mapper. In dynamic bound-attribute annotations, the _value attribute of the annotations object (Annotation._value) is a tuple consisting of “(obj, attr_name)”, which instructs the Annotation object to return “getattr(obj, attr_name)” (via: “getattr(*self._value)”) when returning the value of the Annotation. “obj” is typically the object to which the AnnotationSet belongs (i.e., self). When a copy of Annotation is created, the object reference given in the first element of the _value tuple of dynamic bound-attribute annotations are unchanged, unless the id of the object reference is fo
| Parameters: |
|
|---|
Note that all references to other in any annotation value (and sub-annotation, and sub-sub-sub-annotation, etc.) will be replaced with references to self. This may not always make sense (i.e., a reference to a particular entity may be absolute regardless of context).
Metadata storage, composition and persistance, with the following attributes:
- name
- value
- datatype_hint
- name_prefix
- namespace
- annotate_as_reference
- is_hidden
- real_value_format_specifier - format specifier for printing or rendering values as string, given in Python’s format specification mini-language. E.g., ‘.8f’, ‘4E’, ‘>04d’.
x.__delattr__(‘name’) <==> del x.name
default object formatter
x.__getattribute__(‘name’) <==> x.name
helper for pickle
helper for pickle
x.__repr__() <==> repr(x)
x.__setattr__(‘name’, value) <==> x.name = value
size of object in memory, in bytes
Essentially a shallow-copy, except that any objects in the _value field with an id found in attribute_object_mapper will be replaced with attribute_object_mapper[id].
Copies annotations from other, which must be of Annotable type.
Copies are deep-copies, in that the Annotation objects added to the annotation_set AnnotationSet collection of self are independent copies of those in the annotate_set collection of other. However, dynamic bound-attribute annotations retain references to the original objects as given in other, which may or may not be desirable. This is handled by updated the objects to which attributes are bound via mappings found in attribute_object_mapper. In dynamic bound-attribute annotations, the _value attribute of the annotations object (Annotation._value) is a tuple consisting of “(obj, attr_name)”, which instructs the Annotation object to return “getattr(obj, attr_name)” (via: “getattr(*self._value)”) when returning the value of the Annotation. “obj” is typically the object to which the AnnotationSet belongs (i.e., self). When a copy of Annotation is created, the object reference given in the first element of the _value tuple of dynamic bound-attribute annotations are unchanged, unless the id of the object reference is fo
| Parameters: |
|
|---|
Note that all references to other in any annotation value (and sub-annotation, and sub-sub-sub-annotation, etc.) will be replaced with references to self. This may not always make sense (i.e., a reference to a particular entity may be absolute regardless of context).
x.__delattr__(‘name’) <==> del x.name
default object formatter
x.__getattribute__(‘name’) <==> x.name
helper for pickle
helper for pickle
x.__setattr__(‘name’, value) <==> x.name = value
size of object in memory, in bytes
Adds a new element, value, to self if value is not already in self.
Add a citation as an annotation.
| Parameters: |
|
|---|---|
| Returns: | annotation (|Annotation|) – The new Annotation created. |
Add an attribute of an object as a dynamic annotation. The value of the annotation will be dynamically bound to the value of the attribute.
| Parameters: |
|
|---|---|
| Returns: | annotation (|Annotation|) – The new Annotation created. |
Add a citation as an annotation.
| Parameters: |
|
|---|---|
| Returns: | annotation (|Annotation|) – The new Annotation created. |
Add an annotation.
| Parameters: |
|
|---|---|
| Returns: | annotation (|Annotation|) – The new Annotation created. |
Deletes value of key from self. No error if no value of key is not in self.
Removes Annotation objects that match based on all criteria specified in keyword arguments.
Remove all annotation objects with name == “color”:
>>> tree.annotations.drop(name="color")
Remove all annotation objects with namespace == “http://packages.python.org/DendroPy/”:
>>> tree.annotations.drop(namespace="http://packages.python.org/DendroPy/")
Remove all annotation objects with namespace == “http://packages.python.org/DendroPy/” and name == “color”:
>>> tree.annotations.drop(namespace="http://packages.python.org/DendroPy/",
name="color")
Remove all annotation objects with name_prefix == “dc”:
>>> tree.annotations.drop(name_prefix="dc")
Remove all annotation objects with prefixed_name == “dc:color”:
>>> tree.annotations.drop(prefixed_name="dc:color")
If no keyword argument filter criteria are given, all annotations are removed:
>>> tree.annotations.drop()
| Returns: | results (|AnnotationSet|) – AnnotationSet containing Annotation objects that were removed. |
|---|
Returns the first Annotation associated with self.target which matches based on all criteria specified in keyword arguments:
>>> note = tree.annotations.find(name="color")
>>> note = tree.annotations.find(name_prefix="dc", name="color")
>>> note = tree.annotations.find(prefixed_name="dc:color")
If no match is found, None is returned.
If no keyword arguments are given, a TypeError is raised.
| Returns: | results (|Annotation| or |None|) – First Annotation object found that matches criteria, or None if no matching annotations found. |
|---|
Returns AnnotationSet of Annotation objects associated with self.target that match based on all criteria specified in keyword arguments:
>>> notes = tree.annotations.findall(name="color")
>>> notes = tree.annotations.findall(namespace="http://packages.python.org/DendroPy/")
>>> notes = tree.annotations.findall(namespace="http://packages.python.org/DendroPy/",
name="color")
>>> notes = tree.annotations.findall(name_prefix="dc")
>>> notes = tree.annotations.findall(prefixed_name="dc:color")
If no matches are found, the return AnnotationSet is empty.
If no keyword arguments are given, all annotations are returned:
>>> notes = tree.annotations.findall()
| Returns: | results (|AnnotationSet| or |None|) – AnnotationSet containing Annotation objects that match criteria, or None if no matching annotations found. |
|---|
Returns the value of the first Annotation associated with self.target which has name in the name field.
If no match is found, then default is returned.
| Parameters: |
|
|---|---|
| Returns: | results (|Annotation| or |None|) – value of first Annotation object found that matches criteria, or None if no matching annotations found. |
Returns index of element with value of value.
Returns iterator over values in self.
Removes and return value in self. By default, removes last value.
Deletes value of key from self. KeyErrorif no value of key is not in self.
Returns the value of the first Annotation associated with self.target which has name in the name field.
If no match is found, then KeyError is raised.
| Parameters: | name (string) – Name of Annotation object whose value is to be returned. |
|---|---|
| Returns: | results (|Annotation| or |None|) – value of first Annotation object found that matches criteria. |
Updates self with values in other for each value in other that is not already in self.
Returns annotation set as a dictionary. The keys and values for the dictionary will be generated based on the following keyword arguments:
| Keyword Arguments: | |
|---|---|
|
|
| Returns: | values (dict) |
Tracks a single BibTeX entry.
Sets up internal dictionary of BibTeX fields, and initializes if argument is given.
Allows bibtex fields (and any additional ones) to be treated like object attributes.
default object formatter
Allows bibtex fields (and any additional ones) to be treated like object attributes.
x.__getattribute__(‘name’) <==> x.name
x.__hash__() <==> hash(x)
helper for pickle
helper for pickle
Allows bibtex fields (and any additional ones) to be treated like object attributes.
size of object in memory, in bytes
Returns list of populated fields in order (does not include bibtype and citekey).