, *, sequence='nt', metric='identity', min_cells=1, min_nodes=1, layout='components', size_aware=True, base_size=None, size_power=1, layout_kwargs=None, clonotype_key=None, key_added='clonotype_network', inplace=True, random_state=42)

Computes the layout of the clonotype network.

Requires running or first.

The clonotype network usually consists of many disconnected components, each of them representing a clonotype. Each node represents cells with an identical receptor configuration (i.e. identical CDR3 sequences, and identical v genes if same_v_gene was specified during clonotype definition). The size of each dot refers to the number of cells with the same receptor configurations.

For more details on the clonotype definition, see and the respective section in the tutorial.

Singleton clonotypes can be filtered out with the min_cells and min_nodes parameters.

The components layout algorithm takes node sizes into account, avoiding overlapping nodes. Therefore, we recommend specifying base_size and size_power already here instead of providing them to

Stores coordinates of the clonotype network in adata.obsm.

adata : AnnData

annotated data matrix

sequence : {‘aa’, ‘nt’}Literal[‘aa’, ‘nt’] (default: 'nt')

The sequence parameter was ran with.

metric : {‘identity’, ‘alignment’, ‘levenshtein’, ‘hamming’, ‘custom’}Literal[‘identity’, ‘alignment’, ‘levenshtein’, ‘hamming’, ‘custom’] (default: 'identity')

The metric parameter was ran with.

min_cells : int (default: 1)

Only show clonotypes consisting of at least min_cells cells

min_nodes : int (default: 1)

Only show clonotypes consisting of at least min_nodes nodes (i.e. non-identical receptor configurations)

layout : str (default: 'components')

The layout algorithm to use. Can be anything supported by igraph.Graph.layout, or “components” to layout all connected components individually. scirpy.util.graph.layout_components() for more details.

size_aware : bool (default: True)

If True, use a node-size aware layouting algorithm. This option is only compatible with layout = 'components'.

base_size : float | NoneOptional[float] (default: None)

Size of a point respresenting 1 cell. Per default, this value is a automatically determined based on the number of nodes in the plot.

size_power : float (default: 1)

Sizes are raised to the power of this value. Set this to, e.g. 0.5 to dampen point size.

layout_kwargs : dict | NoneOptional[dict] (default: None)

Will be passed to the layout function

clonotype_key : str | NoneOptional[str] (default: None)

Key under which the result of or is stored in adata.uns. Defaults to clone_id if sequence == 'nt' and distance == 'identity' or cc_{sequence}_{metric} otherwise.

key_added : str (default: 'clonotype_network')

Key under which the layout coordinates will be stored in adata.obsm and parameters will be stored in adata.uns.

inplace : bool (default: True)

If True, store the coordinates in adata.obsm, otherwise return them.


Random seed set before computing the layout.

Return type

None | DataFrameOptional[DataFrame]


Depending on the value of inplace returns either nothing or the computed coordinates.