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
178 stars 28 forks source link

Generating a Umap with eRegulon AUC does not produce proper clusters #310

Open redvoidling opened 7 months ago

redvoidling commented 7 months ago

Describe the bug Following the "Tutorial: Branched differentiation trajectory" I tried to create an UMAP from the eRegulon AUC but the output is just a mix of all the celltypes. In my understanding this data is a abstraction of the GEX and ACC but on a TF basis. So what could have gone wrong?

Screenshot 2024-02-26 at 18 24 45

bhhlee commented 7 months ago

You might want to see my response on Issue#287 I had the same issue.

In short try:

import pandas as pd
import anndata
import sklearn
auc_key = 'eRegulon_AUC'
signature_keys = ['Gene_based', 'Region_based']
data_mat = pd.concat([scplus_obj.uns[auc_key][x].T for x in signature_keys])
selected_regulons = [x for x in data_mat.index if '+_+' in x]
data_mat = data_mat.loc[selected_regulons]
adata = anndata.AnnData(X=data_mat.T.copy())
adata.obs = pd.concat([adata.obs, scplus_obj.metadata_cell], axis=1)

Hope it helps.

redvoidling commented 6 months ago

Great that helped! Thanks a lot!