tacco.tools.annotate_SingleR

annotate_SingleR(adata, reference, annotation_key, counts_location=None, conda_env=None, fine_tune=True, aggr_ref=False, genes='de', de_method='classic', working_directory=None, verbose=True)[source]

Annotates an AnnData using reference data by SingleR [Aran19].

This is the direct interface to this annotation method. In practice using the general wrapper annotate() is recommended due to its higher flexibility.

Parameters:
  • adata – An AnnData including expression data in .X.

  • reference – Reference data to get the annotation definition from.

  • annotation_key – The .obs key where the annotation is stored in the reference. If None, it is inferred from reference, if possible.

  • counts_location – A string or tuple specifying where the count matrix is stored, e.g. ‘X’, (‘raw’,’X’), (‘raw’,’obsm’,’my_counts_key’), (‘layer’,’my_counts_key’), … For details see counts().

  • conda_env – The path of a conda environment where SingleR is installed and importable as ‘library(SingleR)’.

  • fine_tune – Forwards the ‘fine.tune’ parameter to SingleR.

  • aggr_ref – Forwards the ‘aggr.ref’ parameter to SingleR.

  • genes – Forwards the ‘genes’ parameter to SingleR.

  • de_method – Forwards the ‘de_method’ parameter to SingleR.

  • working_directory – The directory where to store all the intermediates. If None, a temporary directory is used and cleaned in the end. This option is probably only relevant for debugging.

  • verbose – Whether to print stderr and stdout of the SingleR run.

Returns:

Returns the annotation in a DataFrame.