Open kma2112 opened 3 years ago
Same issue here, with the files from tutorial (adLung_TabSen_100920.h5ad,...) adVal = pySCN.scn_classify(expVal, cgenesA, xpairs, tspRF, nrand = 0) (...)ValueError: Data matrix has wrong shape (), need to be (500, 16543).
(fedora 33/x86_64)
Edit:
solved by adding
if isinstance(aDat.X,np.ndarray):
in scn_train.py, line 98
final code should be
def scn_predict(cgenes, xpairs, rf_tsp, aDat, nrand = 2):
# in the case of aDat.X is a numpy array
if isinstance(aDat.X,np.ndarray):
aDat.X = ad._core.views.ArrayView(aDat.X)
### expDat= pd.DataFrame(data=aDat.X, index= aDat.obs.index.values, columns= aDat.var.index.values)
expDat= pd.DataFrame(data=aDat.X.toarray(), index= aDat.obs.index.values, columns= aDat.var.index.values)
expValTrans=query_transform(expDat.reindex(labels=cgenes, axis='columns', fill_value=0), xpairs)
classRes_val=rf_classPredict(rf_tsp, expValTrans, numRand=nrand)
return classRes_val
I've been using the same code that worked for me previously, but just started getting an error at the pySCN.scn_classify step and was wondering what I might be doing wrong or if there is an incompatibility with one of the package versions I am using. It throws an error when ad._core.views.ArrayView is called.
My code is below, as well as a screenshot of my error report and session info. Files are too large to be uploaded here but are in my Dropbox under Cahan lab: Kathleen.Noller/forgithub/ (https://www.dropbox.com/s/k5hrbbflh32w56x/forgithub.zip?dl=0)
Thank you for your help!