moscot.utils.tagged_array.TaggedArray.from_adata¶
- classmethod TaggedArray.from_adata(adata, dist_key, attr, tag=Tag.POINT_CLOUD, key=None, cost='sq_euclidean', backend='ott', **kwargs)[source]¶
Create tagged array from
AnnData.Warning
Sparse arrays will be densified except when
tag = 'graph'.- Parameters:
adata (
AnnData) – Annotated data object.dist_key (
Union[Any,Tuple[Any,Any]]) – Key which determines into which source/target subsetadatabelongs.attr (
Literal['X','obsp','obsm','layers','uns']) – Attribute ofAnnDataused when extracting/computing the cost.tag (
Tag) – Tag used to interpret the extracted data.key (
Optional[str]) – Key in theattrofAnnDataused when extracting/computing the cost.cost (
Union[str,Literal['barcode_distance','leaf_distance','custom'],Literal['euclidean','sq_euclidean','cosine','pnorm_p','sq_pnorm','geodesic']]) –Cost function to apply to the extracted array, depending on
tag:if
tag = 'point_cloud', it is extracted from thebackend.if
tag = 'graph'thecosthas to be'geodesic'.if
tag = 'cost'ortag = 'kernel', andcost = 'custom', the extracted array is already assumed to be a cost/kernel matrix. Otherwise,BaseCostis used to compute the cost matrix.
backend (
Literal['ott']) – Which backend to use, seeget_available_backends().kwargs (
Any) – Keyword arguments for theBaseCostor any backend-specific cost.
- Return type:
- Returns:
: The tagged array.