Reading BEAST2 nexus trees¶
This module reads nexus tree files that are created by BEAST2. The function read_nexus_trees() has options to make it compatible with trees that were generated by the BREATH package and read transmission trees.
- pyccd.read_nexus._breath_label_nodes(tree)[source]¶
Annotating the node names and blockcount values to an ete3.Tree. This only works if the nodes names follow the name convention from above. That is %Node-label/blockcount% which is extracted in replace_match() above.
- Parameters:
tree – Tree that will get blockcount annotations from node names
- pyccd.read_nexus.read_nexus_trees(file: str, breath_trees: bool = True, label_transm_history: bool = True) list[source]¶
Function to read a nexus file that contains transmission trees. This assumes that trees are generated by BREATH BEAST2 package. The necessary information is the blockcount for every node/edge. This function will fully label the transmission history onto the tree.
By setting breath_trees to false the transmission history labeling is also disabled.
- Parameters:
file – Input file
breath_trees – If true, will assume that the trees have the blockcount annotated (default)
label_transm_history – If true, will label transmission ancestry (default)
- Returns:
list of transmission trees