cellrefiner.tl.cell_shape_modeling

cellrefiner.tl.cell_shape_modeling(adata, cluster_key, ne=20, rd_ratio=2.5, spatial_key='spatial', pca_key='X_pca', seed=1)[source]

Perform cell shape modeling based on subcellular element method

Parameters:
  • adata (Anndata) – AnnData object

  • cluster_key (str) – Key in adata.obs that contains cell type annotations

  • ne (int, default 20) – number of elements per cells

  • rd_ratio (float, default 2.5) –

    Cell radius-distance ratio

    • rd_ratio>2: cell radius < cell distance/2, tissue with gaps

    • rd_ratio=2: cell radius = cell distance/2, no gaps (confluent tissue)

    • rd_ratio<2: cell radius > cell distance/2, overcrowded

  • spatial_key (str, default 'spatial') – Key in adata.obsm that contains spatial coordinates

  • pca_key (str) –

    Key in adata.obsm that contains PCA embeddings.

    If not in adata.obsm, scanpy.pp.pca(adata) will be computed.

  • seed (int, default 1) – random seed

Return type:

SEM

Returns:

  • SEM – SEM object containing cell shapes and cell-cell contains information

  • Set the field in adata.obsp[‘contacts’] (csr_matrix) for cell-cell contacts

Examples

>>> sem = cr.tl.cell_shape_modeling(adata,cluster_key = 'cell_type')