tacco.get.counts

counts(adata, counts_location=None, annotation=False, copy=False)

Get an AnnData with bare counts in .X from an AnnData where the counts are buried somewhere else.

Parameters:
  • adata – A AnnData.

  • counts_location

    The “path” in adata where the counts are stored as a string (e.g. “X”) or as a list-like of strings, e.g. (“raw”,”obsm”,”counts”). Possible parts of paths are:

    • ”X”

    • ”layer”

    • ”obsm”

    • ”varm”

    • ”uns”

    • ”raw”

    If None, looks in adata.uns[‘counts_location’] for the path and if unsuccessful uses “X”.

  • annotation

    What if any annotation should be included in the returned AnnData. Possible are:

    • False: dont take any annotation

    • True: take all .obs, .var, .uns, and those .obsm and .varm annotations, which are a DataFrame.

    • string or list-like of strings: take all .obs, .var, .obsm, .varm, and .uns annotations with these names.

  • copy – Whether to return a copy of the original adata, even if the counts are already in .X.

Returns:

An AnnData with counts in .X.