I have ran these functions hundreds of times and have never seen this error before. They are related to the Seurat package for Single Cell RNA seq analysis. The errors occurred after i downloaded a different package related to the analysis (Scran). Since then I have removed the package, redownloaded Seurat, redownloaded its dependencies, updated and redownloaded R, and nothing has fixed it. I am 99% sure it isn't the function itself as I am using it in exactly the same fashion i have been. Its possible that i haven't tried every possible package to uninstall and reinstall, but what I'm looking for is how do I actually troubleshoot this. Please help I am lost.
A_Forced_Rice4_fil <- Seurat::CreateSeuratObject(counts = A_Forced_cellranger.data2, project = "Rice_SC_A4", min.cells = 3, min.features = 300)
Error in validObject(.Object) :
invalid class âLogMapâ object: superclass "mMatrix" not defined in the environment of the object's class
For added context, this also happens when I load Seurat now. I have redownloaded SeuratObject 3 times now
library(Seurat)
Loading required package: SeuratObject
Loading required package: sp
Attaching package: âspâ
The following object is masked from âpackage:IRangesâ:
%over%
âSeuratObjectâ was built under R 4.3.0 but the current version is 4.3.1; it is recomended that you
reinstall âSeuratObjectâ as the ABI for R may have changed
âSeuratObjectâ was built with package âMatrixâ 1.6.1.1 but the current version is 1.6.2; it is recomended
that you reinstall âSeuratObjectâ as the ABI for âMatrixâ may have changed
Attaching package: âSeuratObjectâ
The following object is masked from âpackage:SummarizedExperimentâ:
Assays
The following object is masked from âpackage:GenomicRangesâ:
intersect
The following object is masked from âpackage:GenomeInfoDbâ:
intersect
The following object is masked from âpackage:IRangesâ:
intersect
The following object is masked from âpackage:S4Vectorsâ:
intersect
The following object is masked from âpackage:BiocGenericsâ:
intersect
The following object is masked from âpackage:baseâ:
intersect
Attaching package: âSeuratâ
The following object is masked from âpackage:SummarizedExperimentâ:
Assays
ultimately I expect the Seurat maintainers to update SeuratObject to solve that.
One side-note:
One thing that is weird to me, the warning messages mention you are using R4.3.0, but the latest version is 4.3.2. That suggests something is wrong with your redownloads/reinstalls of R. Maybe you correctly reinstalled the latest version of R but RStudio missed it, that has happened to me in the past, you can use this to ensure you are indeed loading R 4.3.2.
So i had tried this and received this error. Sorry i think some of this error message is missing, as I am in the process of redownloading both R and rStudio to see if that solves it. I saw this fix as well and believe it will solve the problem but unfortunately because of this error message I couldn't try it.
devtools::install_version("Matrix",version = "1.6.1.1")
ld: warning: directory not found for option '-L/opt/gfortran/lib/gcc/x86_64-apple-darwin20.0/12.2.0'
ld: warning: directory not found for option '-L/opt/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Matrix.so] Error 1
ERROR: compilation failed for package âMatrixâ
* removing â/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/Matrixâ
here is more context to the error
Warning message:
In i.p(...) :
installation of package â/var/folders/8_/hq65blf10w50978zt96924340000gn/T//RtmpSXkT3t/remotes99f07fc9574f/Matrixâ had non-zero exit status
Right, that's because you need the fortran compiler. The instructions for Mac are here, you need Xcode and the GNU FORTRAN compiler. Feel free to open a new topic to get help from people who know Mac (I don't).
More details: packages are created as a "source" version, then need to be compiled to run (if they contain FORTRAN or C code). When you install the latest version of a package, usually CRAN has a pre-compiled version available. For older version of packages, CRAN might delete the precompiled version and only keep the source version, so you might need to recompile them yourself (depends on the package). The process is automated in devtools::install_version(), but it requires the C and FORTRAN compilers to be installed on the system.
Just to be clear, this is not directly related to the original problem, the Seurat problem will be solved with Matrix 1.6.1.1, but the FORTRAN compiler is necessary to install this older package.
Hi,
Maybe try removing existing 'Matrix' package, with remove.packages('Matrix').
Then install it via this-
remotes::install_version("Matrix", version = "1.6.1.1")
Thank you both for these suggestions, I realized my installation of gcc/gfortran was the issue. I manually re-installed the package through the link that AlexisW provided earlier, and then reinstalled the Matrix package, and now the problem appears to be resolved.