RGLab / MAST

Tools and methods for analysis of single cell assay data in R
224 stars 57 forks source link

Error in slot(value, what) : no slot of name "reducedDims" #119

Closed mimi3421 closed 4 years ago

mimi3421 commented 4 years ago

When package SingleCellExperiment is updated to 1.7.1, the following error will raise when FromMatrix is called in MAST 1.11.3 because "reducedDims" is removed in new version of SingleCellExperiment:

"Error in slot(value, what) : no slot of name "reducedDims" for this object of class "SingleCellExperiment"

I find a temporal hack to this problem which is re-defining SingleCellAssay before calling FromMatrix:

Mandatory_Featurevars <- character()
Mandatory_Cellvars <- character()
setClass('SingleCellAssay', contains='SingleCellExperiment',package='MAST',
         slots=list(cmap='character', fmap='character',reducedDims='character'),
         prototype=list(cmap=Mandatory_Cellvars,
                        fmap=Mandatory_Featurevars))
amcdavid commented 4 years ago

This looks like a mismatch of bioconductor versions. What does BiocManager::valid() report?

On Thu, Oct 10, 2019, 1:44 AM mimi3421 notifications@github.com wrote:

When package SingleCellExperiment is updated to 1.7.1, the following error will raise when FromMatrix is called in MAST 1.11.3 because "reducedDims" is removed in new version of SingleCellExperiment:

"Error in slot(value, what) : no slot of name "reducedDims" for this object of class "SingleCellExperiment" is caused by 1.7 version of SingleCellExperiment.

I find a temporal hack to this problem is re-defining SingleCellAssay before calling FromMatrix:

''' Mandatory_Featurevars <- character() Mandatory_Cellvars <- character() setClass('SingleCellAssay', contains='SingleCellExperiment', slots=list(cmap='character', fmap='character',reducedDims='character'), prototype=list(cmap=Mandatory_Cellvars, fmap=Mandatory_Featurevars)) setClass('SingleCellAssay', contains='SingleCellExperiment',package='MAST', slots=list(cmap='character', fmap='character',reducedDims='character'), prototype=list(cmap=Mandatory_Cellvars, fmap=Mandatory_Featurevars)) '''

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/RGLab/MAST/issues/119?email_source=notifications&email_token=AALLAHT5RNUXTEXCBRTS64LQN26KJA5CNFSM4I7ID6T2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HQ2NULA, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALLAHQ3WZM7P5VMXTWLZPDQN26KJANCNFSM4I7ID6TQ .

mimi3421 commented 4 years ago

My bioconductor version is Bioconductor version '3.9'. UPDATE: Add my valid() result:

* sessionInfo()

R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936  LC_CTYPE=Chinese (Simplified)_China.936    LC_MONETARY=Chinese (Simplified)_China.936
[4] LC_NUMERIC=C                               LC_TIME=Chinese (Simplified)_China.936    

attached base packages:
[1] parallel  stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] SingleCellExperiment_1.6.0  SummarizedExperiment_1.14.1 DelayedArray_0.10.0         BiocParallel_1.18.1        
 [5] matrixStats_0.54.0          Biobase_2.44.0              GenomicRanges_1.36.0        GenomeInfoDb_1.20.0        
 [9] IRanges_2.18.1              S4Vectors_0.22.0            BiocGenerics_0.30.0         lattice_0.20-38            

loaded via a namespace (and not attached):
 [1] bitops_1.0-6           grid_3.6.1             zlibbioc_1.30.0        XVector_0.24.0         Matrix_1.2-17         
 [6] tools_3.6.1            RCurl_1.95-4.12        compiler_3.6.1         BiocManager_1.30.4     GenomeInfoDbData_1.2.1

Bioconductor version '3.9'

  * 28 packages out-of-date
  * 0 packages too new

create a valid installation with

  BiocManager::install(c(
    "backports", "BiocManager", "callr", "curl", "data.table", "DelayedMatrixStats", "devtools", "digest", "DT", "edgeR",
    "ellipsis", "GenomicRanges", "htmltools", "htmlwidgets", "httpuv", "IRanges", "lambda.r", "later", "matrixStats", "pkgbuild",
    "pkgconfig", "promises", "RcppAnnoy", "RcppHNSW", "rhdf5", "Rhdf5lib", "S4Vectors", "shiny"
  ), update = TRUE, ask = FALSE)

more details: BiocManager::valid()$too_new, BiocManager::valid()$out_of_date

I also think that the same error has been reproduced by ryandhindsa in https://github.com/RGLab/MAST/issues/115#issuecomment-521709419 .

Everything will be OK if I force my R3.6 to load 1.4.1 version of SingleCellExperiment in the R3.5 library folder. But it will affect other packages that depend on the newer version of SingleCellExperiment or S4Vectors. I think adding a reducedDims='character' to the SingleCellAssay class definition would be a quick fix to this bug.

Thanks for your great job on MAST.

amcdavid commented 4 years ago

You never said what BiocManager::valid() says, but I'm guessing you've got an unholy mixture of versions. Maybe what you did makes the error go away, but no promises it's not introducing other problems that aren't being signalled with an error, since you are mixing SingleCellExperiment from Bioconductor 3.8 and if you installed MAST from github, MAST from the development version of Bioconductor, which will be released in a few weeks as 3.10. I'd bet you $50 if you use BiocManager::install() to install everything and get it so that BiocManager::valid() reports true, the errors will go away.

However, you may be reluctant to do that, because you want to pin the version of packages to keep other analyses reproducible. This does get tricky in R. The best solution I have found is to explicitly manage your package libraries on a per-project basis. Some advice suitable for MacOS can be found here and here. I maintain an .Renviron file in every project directory which points to a specific folder that contains a given version of Bioconductor. Once that version has been superseded, I don't do any upgrading of existing packages in it.

amcdavid commented 4 years ago

Closed in c8999fe

mimi3421 commented 4 years ago

Thanks for your suggestions. I will wait for the stable release in Bioconductor 3.10 and then update all the packages.