dandelion.polars.tools.transfer

dandelion.polars.tools.transfer(adata, vdj, main_view='all', gex_key=None, vdj_key=None, clone_key=None, collapse_nodes=False, overwrite=None, obs=True, obsm=True, uns=True, obsp=True)[source]
Return type:

None

Transfer data in Dandelion slots to AnnData, updating .obs, .uns, .obsm, and .obsp. Transfers both graphs:

  • graph[0] -> adata.uns[‘dandelion’][‘X_vdj_all’]

  • graph[1] -> adata.uns[‘dandelion’][‘X_vdj_expanded’]

The main_view flag controls which graph becomes the main adjacency written to adata.obsp[‘connectivities’] / [‘distances’] (but both graphs are stored).

Parameters:
  • adata (AnnData | MuData) – AnnData object or MuData object.

  • vdj (DandelionPolars) – Dandelion object.

  • main_view (Literal[“all”, “expanded”, “full”], optional) – Which graph becomes the main adjacency written to adata.obsp[‘connectivities’] / [‘distances’]. If ‘full’, the full distance matrix from Dandelion is transferred and stored in adata.obsp and no graph is transferred to obsm.

  • gex_key (str | None, optional) – prefix for stashed RNA connectivities and distances.

  • vdj_key (str | None, optional) – prefix for stashed VDJ connectivities and distances.

  • clone_key (str | None, optional) – column name of clone/clonotype ids. Only used for integration with scirpy.

  • collapse_nodes (bool, optional) – Whether or not to transfer a cell x cell or clone x clone connectivity matrix into .uns. Only used for integration with scirpy.

  • overwrite (bool | list[str] | str | None, optional) – Whether or not to overwrite existing anndata columns. Specifying a string indicating column name or list of column names will overwrite that specific column(s).

  • obs (bool, optional) – Whether to transfer .metadata columns to adata.obs. Defaults to True.

  • obsm (bool, optional) – Whether to transfer layout embeddings to adata.obsm. Defaults to True.

  • uns (bool, optional) – Whether to transfer graph and layout data to adata.uns. Defaults to True.

  • obsp (bool, optional) – Whether to transfer distance and connectivity matrices to adata.obsp. Defaults to True.