aertslab / scenicplus

SCENIC+ is a python package to build gene regulatory networks (GRNs) using combined or separate single-cell gene expression (scRNA-seq) and single-cell chromatin accessibility (scATAC-seq) data.
Other
186 stars 29 forks source link

TypeError: score_eRegulons() got an unexpected keyword argument 'scplus_obj' #413

Closed LukasOussoren closed 2 months ago

LukasOussoren commented 5 months ago

When running plot_perturbation_effect_in_embedding() according to the tutorial: https://scenicplus.readthedocs.io/en/stable/Perturbation_simulation.html, the function tries to use the score_eRegulons() function on the scenic plus object, which doesn't correspond to the expected input of that function

I was running this code:

import dill scplus_obj = dill.load(open('outs/Old_scplus_obj.pkl', 'rb'))

from scenicplus.dimensionality_reduction import run_eRegulons_pca run_eRegulons_pca( scplus_obj, auc_key = 'eRegulon_AUC', reduction_name = 'eRegulons_PCA_gene_based')

from pycisTopic.diff_features import find_highly_variable_features hvg = find_highly_variable_features(scplus_obj.to_df('EXP')[list(set(scplus_obj.uns['eRegulon_metadata_filtered']['Gene']))].T, n_top_features = 200, plot = False)

color_dict_line = { 'Adipocytes': '#9A031E', 'FAP2': '#C75146', 'FAP1': '#FFA987'}

from scenicplus.simulation import plot_perturbation_effect_inembedding import seaborn as sns = plot_perturbation_effect_in_embedding( scplus_obj = scplus_obj, reduction_name = 'eRegulons_PCA_gene_based', n_cpu = 30, perturbation = {'Cebpd': 0}, #specifies that we want to set the expression of SOX10 to 0 in all cells. variable = 'Annotation', color_dictionary = {'Annotation': color_dict_line}, genes_to_use = hvg, figsize = (10, 10))

and got this error

image

And looking at the definition of the score_eRegulons function below: image

It seems strange the perturbation function does this:

image

Am I missing something? The function just don't seem compatible

SeppeDeWinter commented 5 months ago

Hi @LukasOussoren

Thank you for opening this issue! Yes, I missed this while updating the code, I did not realise this ...

Added to my todo list!

Best,

Seppe

SeppeDeWinter commented 2 months ago

Hi @LukasOussoren

This code has now been updated: https://scenicplus.readthedocs.io/en/latest/Perturbation_simulation.html#Tutorial:-Perturbation-simulation

All the best,

Seppe