carmonalab / STACAS

R package for semi-supervised single-cell data integration
GNU General Public License v3.0
75 stars 9 forks source link

R v4.0 / Seurat v3.2.1 #1

Closed jdime closed 4 years ago

jdime commented 4 years ago

Hello,

Thanks for the package. I made a script and it worked out using R v3.6.1, but I needed to upgrade to R v4.0.2, and now using the same script I get an error Error: $ operator not defined for this S4 class. Indeed, I get the same error using the STACAS demo (see below). I tried also in a Linux with R v4.0.0 and got the same error.

Have you made STACAS work in R v4.0.X?

Thanks.

> library(STACAS)
> data(STACAS.sampledata)
> STACAS.anchors <- Run.STACAS(STACAS.sampledata)
Computing 500 integration features
Preparing PCA embeddings for objects...
 1/3 2/3 3/3
Computing within dataset neighborhoods
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=01s  
Finding all pairwise anchors
  |                                                  | 0 % ~calculating  Finding neighborhoods
Finding anchors
    Found 1785 anchors
Error: $ operator not defined for this S4 class

My sessionInfo() is:

[1] "R version 4.0.2 (2020-06-22)"                                                                                           
 [2] "Platform: x86_64-apple-darwin17.0 (64-bit)"                                                                             
 [3] "Running under: macOS High Sierra 10.13.6"                                                                               
 [4] ""                                                                                                                       
 [5] "Matrix products: default"                                                                                               
 [6] "BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib"
 [7] "LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib"                                    
 [8] ""                                                                                                                       
 [9] "locale:"                                                                                                                
[10] "[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8"                                                      
[11] ""                                                                                                                       
[12] "attached base packages:"                                                                                                
[13] "[1] stats     graphics  grDevices utils     datasets  methods   base     "                                              
[14] ""                                                                                                                       
[15] "other attached packages:"                                                                                               
[16] "[1] STACAS_1.0.0"                                                                                                       
mass-a commented 4 years ago

Hi Javier, thanks for the report.

I couldn't reproduce your error, we have tested STACAS on R 4.0.2 and have not seen this error.

Can you check whether your installation of Seurat works? e.g.

library(Seurat)
data(STACAS.sampledata)
Seurat::FindIntegrationAnchors(STACAS.sampledata)
jdime commented 4 years ago

Thanks Massimo.

I ran the commands that you told me and they ran fine. I could obtain anchors using either R v3.6.1 or R v4.0.2.

> Seurat::FindIntegrationAnchors(STACAS.sampledata)
...
    Retained 2148 anchors
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=03m 14s
An AnchorSet object containing 14672 anchors between 3 Seurat objects 
 This can be used as input to IntegrateData or TransferData.

However, I figured that when I upgraded R to v4.0.2, I installed Seurat v3.2.1; whereas with R v3.6.1 I had Seurat v3.1.1.

I installed Seurat v3.2.1 in an R v3.6.1 and I got the same error Error: $ operator not defined for this S4 class. So it's likely an issue related to Seurat v3.2.1 rather than the R version. Did you try Seurat v3.2.1 too?

jdime commented 4 years ago

Add to my previous post, using R v4.0.2 with Seurat v3.1.1, also worked out.

But downgrading Seurat from v3.2.1 to v3.1.1 was a little tricky. I had to install:

BiocManager::install("multtest") ## needed by Seurat v3.1.1, also installed "multcomp" remotes::install_version("adehabitat") ## Needed by SDMTools remotes::install_version("SDMTools", "1.1-221") ## Note SDMTools is deprecated, but needed by Seurat v3.1.1 devtools::install_github(repo = "satijalab/seurat", ref = "fc4a4f5") # Seurat v3.1.1

mass-a commented 4 years ago

Thanks for isolating the problem!

Indeed, the newer version of Seurat changed the format of some data structures which were incompatible with STACAS.

I have now pushed an updated version which should solve the compatibility issue with Seurat 3.2.1 and R v4.

Let us know if you encounter more issues with the package, cheers!

jdime commented 4 years ago

Thanks. The fix worked out in my system.