Data Processing

scarches.dataset.label_encoder(adata, encoder, condition_key=None)[source]

Encode labels of Annotated adata matrix. :param adata: Annotated data matrix. :type adata: : ~anndata.AnnData :param encoder: dictionary of encoded labels. :type encoder: Dict :param condition_key: column name of conditions in adata.obs data frame. :type condition_key: String

Returns:

  • labels (~numpy.ndarray) – Array of encoded labels

  • label_encoder (Dict) – dictionary with labels and encoded labels as key, value pairs.

scarches.dataset.remove_sparsity(adata)[source]

If adata.X is a sparse matrix, this will convert it in to normal matrix. :param adata: Annotated data matrix. :type adata: AnnData

Returns:

adata – Annotated dataset.

Return type:

AnnData

scarches.dataset.trVAEDataset[source]

alias of AnnotatedDataset