yycunc / iSMNN

iSMNN: Batch Effect Correction for Single-cell RNA-seq data via Iterative Supervised Mutual Nearest Neighbor Refinement
2 stars 2 forks source link

iSMNN vignette not working #1

Open AlbertNitu opened 3 years ago

AlbertNitu commented 3 years ago

Hi, iSMNN is a wonderful tool - thank you for making it. I've been facing some trouble with the vignette, however. Whenever the vignette code is run (please see this colab file for code), the following error is returned:

Finding neighborhoods for endothelial cells ...
Error in nn2(data = numeric(0), query = numeric(0), k = 31, eps = 0) : 
  Cannot find more nearest neighbours than there are points
Calls: <Anonymous> ... FindAnchors -> FindNN -> NNHelper -> do.call -> nn2

I'm assuming this is because the number of endothelial cells is too small in both batch1 and batch2. I've played with the k.filter parameter to try to fix this, but to no success.

So instead, I exclude endothelial cells from both the clusters.info and matched.clusters vectors, and remove the endothelial cell marker Pecam1 from the markers vector . However, when I do this (code here), I get the following error after iSMNN finds and filters the anchors for fibroblast and macrophage cells:

Error in new(Class = "AnchorSet", object.list = object.list, reference.objects = reference %||%  : 
  trying to generate an object from a virtual class ("AnchorSet")
Calls: <Anonymous> ... <Anonymous> -> withVisible -> iSMNN -> iSMNN_FindSMNNs -> new

Is there a solution to either of these issues? Thanks!

yycunc commented 3 years ago

Hi,

Thanks for interested in our methods, and sorry for the inconvenience. I have fixed the small errors in the codes, updated it on Github, and tested it on my side. Now everything looks correct. According to the number of endothelial cells, it seems k.filter = 30 works well. You can re-install the package and try again following the README instruction.

Please feel free to let me know if there is still any problem. I am happy to work on it with you together.

Thanks!

AlbertNitu commented 3 years ago

Thanks for the quick response! I managed to get iSMNN to calculate anchors for endothelial cells by setting min.perc = 0.2. Strangely, even after reinstalling iSMNN, I'm still getting the same error after the cell type anchors are calculated and filtered:

Error in new(Class = "AnchorSet", object.list = object.list, reference.objects = reference %||%  : 
  trying to generate an object from a virtual class ("AnchorSet")
Calls: <Anonymous> ... <Anonymous> -> withVisible -> iSMNN -> iSMNN_FindSMNNs -> new

The error seems to be coming from the iSMNN_utility.R file, which has the iSMNN_FindSMNNs function. The code used can bere found here.

Dulab2020 commented 3 years ago

I have got the same error as the comment by AlbertNitu. It seems that iSMNN is not compatible with Seurat(version >= 4.0). The "AnchorSet" class is virtual in Seurat >= 4.0.

HelloWorldLTY commented 2 years ago

Hi, I wonder if you downgrade your seurat version under 4.0, will it work? Thanks a lot.

sjcarmona commented 1 year ago

Hello, it seems that iSMNN's vignette is still not working. Are you planning to update the package to make it work with Seurat >= 4.0 ? Thanks!