lineage

class abutils.core.lineage.Lineage(pairs: Iterable[Pair], name: str | None = None)

Methods for manipulating an antibody lineage.

INPUTS

pairs: a list of one or more vaxtools.utils.pair.Pair objects

PROPERTIES

name: the Clonify ID of the lineage (if Clonify was used to assign lineages).

if [‘clonify’][‘id’] does not exist in any of the heavy chains, name will be None.

just_pairs: a list containing all lineage Pair objects that have both heavy

and light chains.

verified_pairs: a list containing all lineage Pair objects that contain a

verified heavy/light pair.

heavies: a list of all lineage Pair objects with a heavy chain (whether or not

they also have a light chain)

lights: a list of all lineage Pair objects with a light chain (whether or not

they also have a heavy chain)

uca: returns a Pair objecct of the unmutated common ancestor for the lineage.

The uca is computed by taking the germline V(D)J regions, plus the N-addition region(s) from the least mutated heavy or light chain. If the lineage contains both heavy and light chains, the returned Pair will have ucas for both chains.

subject: if any of the Pair objects contains a ‘subject’ property, this will be returned.

If all ‘subject’ properties are the same, the return value will be a string. If there are multiple different ‘subject’ properties, the return value will be a list. If no Pairs have a ‘subject’ property, None will be returned.

experiment: if any of the Pair objects contains a ‘experiment’ property, this will be returned.

If all ‘experiment’ properties are the same, the return value will be a string. If there are multiple different ‘experiment’ properties, the return value will be a list. If no Pairs have a ‘experiment’ property, None will be returned.

group: if any of the Pair objects contains a ‘group’ property, this will be returned.

If all ‘group’ properties are the same, the return value will be a string. If there are multiple different ‘group’ properties, the return value will be a list. If no Pairs have a ‘group’ property, None will be returned.

timepoint: if any of the Pair objects contains a ‘timepoint’ property, this will be returned.

If all ‘timepoint’ properties are the same, the return value will be a string. If there are multiple different ‘timepoint’ properties, the return value will be a list. If no Pairs have a ‘timepoint’ property, None will be returned.

phylogeny()

Inputs

project_dir: directory for alignment, tree and figure files (required)

aln_file: if an alignment file has already been computed, passing the file path

will force phylogeny() to use this alignment instead of computing a new one.

tree_file: if a tree file has already been computed, passing the file path

will force phylogeny() to use this tree instead of computing a new one.

aa: if True, build an alignment based on amino acid sequences. Default is False.

root: provide a sequence (string) to root the tree. Default is to use the UCA.

colors: a dict that maps sequences to colors (as hex values). If used without

orders or order_function, keys should be Pair names and values should be hex strings for all Pairs to be colored. Any Pair not present in the dict will be colored black. If used with orders or order_function, the keys should be orders and the values should be hex strings. As before, any order values not present in the dict will be colored black.

Initialize a Lineage object.

param pairs:

An iterable of Pair objects

type pairs:

Iterable[Pair]

param name:

The name of the lineage (optional)

type name:

Optional[str]

abutils.core.lineage.group_lineages(pairs, just_pairs=False)
abutils.core.lineage.donut(lineages, figfile=None, figsize=(6, 6), pairs_only=False, monochrome_color=None, singleton_color='lightgrey', shuffle_colors=False, seed=1234, text_kws={}, pie_kws={}, fontsize=28, linewidth=2)