tacco.tools.annotate_svm

annotate_svm(adata, reference, annotation_key=None, counts_location=None, mode='classification', trafo=None, seed=42, **kwargs)[source]

Annotates an AnnData using reference data by an SVM [Abdelaal19].

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().

  • mode – Selects what svm should be used. Possible values are “classification” to use LinearSVC and “regression” to use LinearSVR.

  • trafo

    Selects a transformation for the data before putting it into the SVM. Available are:

    • ’sqrt’: Use the squareroot of .X; equivalent to using probability amplitudes, i.e. Bhattacharyya projections

    • ’log1p’: Use log1p-transformed data

    • None: Dont transform the data

  • seed – Random seed

  • **kwargs – Additional keyword arguments are forwarded to the LinearSVC or LinearSVR constructor depending on the value of mode.

Returns:

Returns the annotation in a DataFrame.