liuhong-jia / scAnno

23 stars 4 forks source link

The scAnno function indicate “No module named sklearn.linear_model”. #1

Open Pancreaticpathway opened 1 year ago

estellad commented 1 year ago

Similar issue appeared when running scAnno(): [INFO] Checking the legality of parameters [INFO] 30 cell types in reference, 35 clusters in query objects [INFO] Deconvolution by using RLM method [INFO] Logistic regression for cell-type predictions, waiting... Error: ModuleNotFoundError: No module named 'sklearn'

CVendrell11 commented 1 year ago

Hi estellad,

I had the same problem and it was solved by doing the following:

Open a command prompt or terminal. Execute the following command: pip install scikit-learn or if you have both Python 2 and Python 3 installed, use: pip3 install scikit-learn Wait for the installation process to complete. It will download and install the scikit-learn module and its dependencies. After the installation is finished, restart R and you will be able to use sklearn in your Python scripts or within the R code that relies on it.

estellad commented 1 year ago

Thank you! @CVendrell11 This could be specified in this repo's installation instruction, as an enhancement ;)

Yijia-Jiang commented 1 year ago

@CVendrell11 Thank you for the tool. I have already installed scikit-learn in my laptop and failed to replicate the code. The error message shows below:

Error: ImportError: No module named sklearn.linear_model

And the code I used is:

data(hcl.sc)

Import protein coding gene(19814 genes) to filter reference expression profile.

data(gene.anno)

Import TCGA bulk data in pan-cancer.

data(tcga.data.u)

A liver tissue data set to be annotated.

data(GSE136103)

Seurat object, which need to be annotated.

obj.seu <- GSE136103

Seurat object of reference gene expression profile.

ref.obj <- hcl.sc

Reference gene expression profile.

ref.expr <- GetAssayData(ref.obj, slot = 'data') %>% as.data.frame

Cell type information of reference profile, corresponding to the above ref.expr.

ref.anno <- Idents(ref.obj) %>% as.character

results = scAnno(query = obj.seu, ref.expr = ref.expr, ref.anno = ref.anno, save.markers = "markers", cluster.col = "seurat_clusters", factor.size = 0.1, pvalue.cut = 0.01, seed.num = 10, redo.markers = FALSE, gene.anno = gene.anno, permut.num = 100, permut.p = 0.01, show.plot = TRUE, verbose = TRUE, tcga.data.u = tcga.data.u )

Can you help?

Best, Yijia