DanHanh / scLinear

Creative Commons Attribution 4.0 International
16 stars 1 forks source link

Failure to set up environment variable correctly #1

Open fisherj-2212 opened 6 months ago

fisherj-2212 commented 6 months ago

I am experiencing an issue trying to run the example code for predicting ADT. It looks like the contents of the zzz.R file might not be executing correctly?

reticulate::use_miniconda(condaenv = "r-reticulate")
library(scLinear)
library(Seurat)

pipe <- create_adt_predictor()
Error in prediction$ADTPredictor(do_log1p = do_log1p) : 
  attempt to apply non-function
rajuvee commented 5 months ago

Same exact issue! Any updates on solutions - I was very excited to use this package?

fisherj-2212 commented 5 months ago

I am working towards an approach by just running the python code directly instead of messing around with reticulate etc. The ADT prediction function can be imported directly from prediciton.py and then used. I still need to look at it more deeply though and check this works. My current setup looks like this.

import pandas as pd
import numpy as np
import os
import scanpy as sc
import numpy as np
import scipy.sparse as sp
import anndata as ad
from evaluate import evaluate
from prediction import ADTPredictor

<code to load in and format my data> 

pipe = ADTPredictor(do_log1p=False,use_vanilla_nn=False)
pipe.fit(gex_train=adata_rna_train.X.toarray(), adt_train=adata_prot_train.X.toarray(), gex_test=adata_rna_test.X.toarray(), gex_names=adata_rna_train.var_names.to_numpy(), adt_names=adata_prot_train.var_names.to_numpy())
adt_pred, adt_names = pipe.predict(adata_rna_test.X.toarray())
DanHanh commented 5 months ago

Thank you for reporting the Issue. Unfortunately I was quite busy the past few weeks and did not have time to solve the Issue. As it looks right now the problems happens if the python dependencies fail to install correctly. This leads to a failed import of the prediction class. I will try to upload a solution to the problem in the next few days. Thank you for your patience.

DanHanh commented 5 months ago

I uploaded a updated version of the installation guide. For now I removed the automated installation of the python dependencies. The reason for this is, that I could not find a reliable way to force reticulate to use the correct python environment during installation. I will try to fix the problem in the future, but for now manual installation of the python dependencies seems to be the best solution. Let me know if this solves the issue.

rajuvee commented 4 months ago

This solved the issue for me