mmc.get_data()

mmochi.utils.get_data(adata, parameter, preferred_data_key=None, return_source=False, force_preferred=False)

Searches an AnnData object along its .var, .obs, .layers, and .obsm[preferred_data_key] for a specified parameter.

Parameters:
  • adata (AnnData) – Object to search through
  • parameter (str) –

    string to search the AnnData object for. Append: “_gex” to limit checking to the .var, “_obs” to limit checking to the .obs, “_mod_” followed by an obsm key/layer name to force checking there.

    Note, these symbols overwrite preferred data key, and it is assumed that these symbols are not used elsewhere for variable names

  • preferred_data_key (Optional[str] (default: None)) – Used to point to a key in .layers or in .obsm to check in
  • return_source (bool (default: False)) – Whether to return where the parameter was found in addition to the list of matches
  • force_preferred (bool (default: False)) – Whether to raise an error if the parameter is not found in the preferred_data_key
Returns:

Array of data in the AnnData object whose label matches parameter

Return type:

data