pegasus.predict_scarches_scanvi(data, dir_path, label, predictions='predictions', matkey='raw.X', n_jobs=- 1, random_state=0, max_epochs=None, batch=None, categorical_covariate_keys=None, continuous_covariate_keys=None, use_gpu=None)[source]

Run scArches training.

This is a wrapper of scvitools package.

  • data (MultimodalData.) – Annotated data matrix with rows for cells and columns for genes.

  • dir_path (str.) – Save the model to this directory.

  • label (str.) – The obs key representing labels.

  • predictions (str, , optional, default: "predictions") – The obs key to store predicted labels.

  • matkey (str, optional, default: "raw.X") – Matrix key for the raw count

  • n_jobs (int, optional, default: -1.) – Number of threads to use. -1 refers to using all physical CPU cores.

  • random_state (int, optional, default: 0.) – Seed for random number generator

  • max_epochs (int | None, optional, default: None.) – Maximum number of training epochs. Defaults to np.min([round((20000 / n_cells) * 100), 100])

  • batch (str, optional, default: None.) – If only one categorical covariate, the obs key representing batches that should be corrected for, default is None.

  • categorical_covariate_keys (List[str]) – If multiple categorical covariates, a list of obs keys listing categorical covariates that should be corrected for, default is None.

  • continuous_covariate_keys (List[str]) – A list of obs keys listing continuous covariates that should be corrected for, default is None.

  • use_gpu (str | int | bool | None) – Use default GPU if available (if None or True), or index of GPU to use (if int), or name of GPU (if str, e.g., ‘cuda:0’), or use CPU (if False).


  • data.obsm['X_scanVI']: The embedding calculated by scanVI.

  • data.obsm[predictions]: The predicted labels by scanVI.

Return type

Update data.obsm


>>> pg.predict_scarches_scanvi(data, dir_path="scanvi_model/", label="celltype", matkey="counts", batch="tech")