gctree.isotyping.isotype_tree
- gctree.isotyping.isotype_tree(tree, newidmap, isotype_names, weight_matrix=None)[source]
Method adds isotypes to
tree
, minimizing isotype switching and obeying switching order.Adds observed isotypes to each observed node in the collapsed trees output by gctree inference. If cells with the same sequence but different isotypes are observed, then collapsed tree nodes must be ‘exploded’ into new nodes with the appropriate isotypes and abundances. Each unique sequence ID generated by gctree is prepended to its observed isotype, and a new isotyped.idmap mapping these new sequence IDs to original sequence IDs is written in the output directory.
Resolves isotypes of unobserved ancestral genotypes in a way that minimizes isotype switching and obeys isotype switching order. If observed isotypes of an observed internal node and its children violate switching order, then the observed internal node is replaced with an unobserved node with the same sequence, and the observed internal node is placed as a child leaf. This procedure always allows switching order conflicts to be resolved, and should usually increase isotype transitions required in the resulting tree.
- Parameters:
- Return type:
TreeNode
- Returns:
A new ete3 Tree whose nodes have isotype annotations in the attribute
isotype
. Node names in this tree also contain isotype names.