cpa.ComPertAPI#
- class cpa.ComPertAPI(adata, model, de_genes_uns_key='rank_genes_groups_cov', pert_category_key='cov_drug_dose_name', control_group='ctrl', experiment='drug')[source]#
API for CPA model to make it compatible with scanpy.
Methods
compute_comb_emb([thrh])Generates an AnnData object containing all the latent vectors of the cov+dose*pert combinations seen during training.
compute_uncertainty(covs, pert, dose[, thrh])Compute uncertainties for the queried covariate+perturbation combination.
evaluate_r2([perturbations, control_adata_key])Measures different quality metrics about an ComPert autoencoder, when tasked to translate some genes_control into each of the drug/cell_type combinations described in dataset.
get_covars_embeddings(covariate)- type covariate:
get_cycle_uncertainty(genes_from, df_from, df_to)Uncertainty for a single condition.
get_drug_encoding_(drugs[, doses])- type drugs:
get_pert_embeddings([dose])- type dose:
default:
1.0
get_response([doses, contvar_min, ...])Decoded dose response data frame.
get_response2D(perturbations, covar[, ...])Decoded dose response data frame.
get_response_reference([perturbations])Computes reference values of the response.
latent_dose_response([perturbations, dose, ...])- type perturbations:
default:
None
latent_dose_response2D(perturbations[, ...])- type perturbations:
mix_drugs(drugs_list[, doses_list])Gets a list of drugs combinations to mix, e.g. ['A+B', 'B+C'] and corresponding doses.
predict(genes, df[, uncertainty, sample, ...])Predict values of control 'genes' conditions specified in df.
print_complete_cycle_uncertainty(datasets, ...)