gctree.isotyping
A module for incorporating isotype information in gctree inference.
Functions
Uses provided mapping of original sequence IDs to observed isotypes to 'explode' the provided mapping of unique sequence IDs to original sequence IDs. |
|
Returns the weight of the transition from isotype |
|
Computes the sum of |
|
Method adds isotypes to |
Classes
An isotype, and associated information about class switching order and transition weights. |
|
A template constructor class for |
- class gctree.isotyping.IsotypeTemplate(isotype_order, weight_matrix=None)[source]
A template constructor class for
Isotype()
- Parameters:
- class gctree.isotyping.Isotype(order, weight_matrix, isotype_name)[source]
An isotype, and associated information about class switching order and transition weights.
- order
A list or other sequence of isotype names, in their allowed class switching order
- weight_matrix
Transition weights between isotypes, with first index the original isotype index, and second index the new isotype index.
- isotype
Index of isotype name in
self.order
Objects of this class shall be instantiated using
IsotypeTemplate.new()
.
- 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.
- gctree.isotyping.isotype_distance(t1, t2)[source]
Returns the weight of the transition from isotype
t1
to isotypet2
.This function is not symmetric on its arguments, so isn’t a true distance.
- Return type:
- gctree.isotyping.isotype_parsimony(tree)[source]
Computes the sum of
isotype_distance()
along each edge in an isotyped tree.If no weight matrix was provided during isotyping of the tree, then the return value of this function is the number of isotype transitions along edges in the tree.
- Return type:
- gctree.isotyping.explode_idmap(idmap, isotype_map)[source]
Uses provided mapping of original sequence IDs to observed isotypes to ‘explode’ the provided mapping of unique sequence IDs to original sequence IDs.
- Parameters:
- Return type:
- Returns:
A dictionary mapping unique sequence IDs to dictionaries, mapping isotype names to sets of original sequence IDs.