Giter Club home page Giter Club logo

meringue's Introduction

MERINGUE logo

Build Status codecov.io

MERINGUE characterizes spatial gene expression heterogeneity in spatially resolved single-cell transcriptomics data with non-uniform cellular densities.

The overall approach is detailed in the following publication: Miller, B., Bambah-Mukku, D., Dulac, C., Zhuang, X. and Fan, J. Characterizing spatial gene expression heterogeneity in spatially resolved single-cell transcriptomics data with nonuniform cellular densities. Genome Research. May 2021.

Overview

MERINGUE is a computational framework based on spatial auto-correlation and cross-correlation analysis.

You can use MERINGUE to:

  • Identify genes with spatially heterogeneous expression
  • Group significantly spatially variable genes into primary spatial gene expression patterns
  • Identify pairs of genes with complementary expression patterns in spatially co-localized cell-types that may be indicative of cell-cell communication
  • Integrate density-agnostic spatial distance weighting to perform spatially-informed transcriptional clustering analysis

In a manner that:

  • Accomodates 2D, multi-section, and 3D spatial data
  • Is robut to variations in cellular densities, distortions, or warping common to tissues
  • Is highly scalable to enable analysis of 10,000s of genes and 1,000s of cells within minutes
  • Is applicable to diverse spatial transcriptomics technologies

Installation

To install MERINGUE, we recommend using remotes:

# install.packages("remotes")
require(remotes)
remotes::install_github('JEFworks-Lab/MERINGUE', build_vignettes = TRUE)

Tutorials

  1. mOB Spatial Transcriptomics Analysis

  2. Multi-section 3D Breast Cancer Spatial Transcriptomics Analysis

  3. 3D Drosophila Spatial Transcriptomics Analysis

  4. Understanding MERINGUE's Spatial Cross-Correlation Statistic using Simulations

  5. Spatially-informed transcriptional clustering with MERINGUE

Contributing

We welcome any bug reports, enhancement requests, general questions, and other contributions. To submit a bug report or enhancement request, please use the MERINGUE GitHub issues tracker. For more substantial contributions, please fork this repo, push your changes to your fork, and submit a pull request with a good commit message.

meringue's People

Contributors

bmill3r avatar jefworks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

meringue's Issues

undefined reference to `dgemm_', `dgemv_', `dgemv_' and `dsyrk_'

Installation failed using
remotes::install_github('JEFworks-Lab/MERINGUE', build_vignettes = TRUE)

Error: Failed to install 'MERINGUE' from GitHub:
System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr (last 10 lines):
E> C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: functions.o:functions.cpp:(.text$ZN4arma10glue_times5applyIdLb0ELb1ELb0ENS_3ColIdEES3_EEvRNS_3MatIT_EERKT3_RKT4_S5[ZN4arma10glue_times5applyIdLb0ELb1ELb0ENS_3ColIdEES3_EEvRNS_3MatIT_EERKT3_RKT4_S5]+0x293): undefined reference to dgemm_' E> C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: functions.o:functions.cpp:(.text$_ZN4arma10glue_times5applyIdLb0ELb1ELb0ENS_3ColIdEES3_EEvRNS_3MatIT_EERKT3_RKT4_S5_[_ZN4arma10glue_times5applyIdLb0ELb1ELb0ENS_3ColIdEES3_EEvRNS_3MatIT_EERKT3_RKT4_S5_]+0x627): undefined reference to dgemv_'
E> C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: functions.o:functions.cpp:(.text$_ZN4arma10glue_times5applyIdLb0


sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 LC_NUMERIC=C LC_TIME=English_United States.1252

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

loaded via a namespace (and not attached):
[1] processx_3.5.2 compiler_4.1.0 R6_2.5.0 rprojroot_2.0.2 cli_2.5.0 prettyunits_1.1.1 tools_4.1.0 withr_2.4.2 rstudioapi_0.13 curl_4.3.1 crayon_1.4.1
[12] remotes_2.4.0 callr_3.7.0 ps_1.6.0 pkgbuild_1.2.0

Spatially-informed transcriptional clustering with MERINGUE tutorial

Hi Jean and team,

Thanks for making this cool work available! I am working through your spatially-informed clustering tutorial, and I am not getting the expected results when I run the clustering, but everything before this step matches your tutorial outputs.

W <- getSpatialNeighbors(pos, filterDist = 2)
plotNetwork(pos, W)
com2 <- getSpatiallyInformedClusters(pcs, W=W, k=50)
table(com2)
plotEmbedding(pos, groups=com2, main='Spatially Aware Transcriptional Clusters', xlab='Spatial X', ylab='Spatial Y')

I am just copying and pasting code exactly from your tutorial.
k50

If I reduce the k from 50 to 14, I can get 3 clusters but they are not spatially distinct
k14

Below is my session info. Thanks for any help!! Best- Orr

> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] uwot_0.1.10  Matrix_1.3-4 MERINGUE_1.0

loaded via a namespace (and not attached):
 [1] mclust_5.4.7          ggrepel_0.9.1         Rcpp_1.0.7            riverplot_0.10       
 [5] lattice_0.20-45       ica_1.0-2             tidyr_1.1.4           FNN_1.1.3            
 [9] assertthat_0.2.1      digest_0.6.28         foreach_1.5.1         utf8_1.2.2           
[13] R6_2.5.1              plyr_1.8.6            magic_1.5-9           dynamicTreeCut_1.63-1
[17] evaluate_0.14         httr_1.4.2            ggplot2_3.3.5         pillar_1.6.3         
[21] rlang_0.4.12          irlba_2.3.3           hdf5r_1.3.4           rmarkdown_2.11       
[25] splines_4.0.3         Rtsne_0.15            rliger_1.0.0          igraph_1.2.7         
[29] bit_4.0.4             munsell_0.5.0         tinytex_0.34          compiler_4.0.3       
[33] xfun_0.26             pkgconfig_2.0.3       mgcv_1.8-37           htmltools_0.5.2      
[37] tidyselect_1.1.1      tibble_3.1.5          RANN_2.6.1            codetools_0.2-18     
[41] fansi_0.5.0           crayon_1.4.1          dplyr_1.0.7           grid_4.0.3           
[45] nlme_3.1-153          gtable_0.3.0          lifecycle_1.0.1       DBI_1.1.1            
[49] magrittr_2.0.1        scales_1.1.1          remotes_2.4.1         sp_1.4-5             
[53] doParallel_1.0.16     akima_0.6-2.2         geometry_0.4.5        ellipsis_0.3.2       
[57] generics_0.1.0        vctrs_0.3.8           cowplot_1.1.1         RColorBrewer_1.1-2   
[61] iterators_1.0.13      tools_4.0.3           bit64_4.0.5           glue_1.4.2           
[65] purrr_0.3.4           abind_1.4-5           parallel_4.0.3        fastmap_1.1.0        
[69] yaml_2.2.1            colorspace_2.0-2      knitr_1.36            patchwork_1.1.1      

Using Seurat objects

Hello Jean & team,

I have 10x Visium Spatially resolved RNA seq dataset analyzed with Seurat and would like to try Meringue to compute spatial correlation test across spatial spots with cell type names present in metadata slots.
Is there any good or easy way to convert this object to Meringue compatible format?
Thanks in advance!

Parallel computation

Hi Jean and team,

Thanks for your work! I'm wondering if I can use MERINGUE with multicore properly. I'd like to compare the computational effeiciency of MERINGUE with other approaches.

Thanks in advance!

Unable to rotate pictures for my spatial transcriptomics data

Hello,

I am using human lymph node data from 10x visium spatial transcriptomics data set. Also, I am little new to coding. I was trying to understand the package STdeconvolve using your youtube tutorial. However, my picture of the dataset generated using MERINGUE looked flipped and rotated and some areas seemed to get cut off. I am attaching both images below for your reference.
I tried changing parameters of parmfrow and using the following code however I was not succesful. Could you help me with understanding how to rotate and get the full image.
pdf("output_plot.pdf", width = 8, height = 10)
par(mfrow = c(1, 1), mar = c(2, 2, 2, 2))
Thank you so much for your help! Kindly let me know if you need more information.

Image of HE section
HE image of human lymph node

Rstudio plot
Rstudio_tissue_plot

memory issue when running vizgen data

Hi MERINGUE team,
I encountered the following issue when running a demo Vizgen data. Can you help? Thanks.

Fan

suppressMessages(library(MERINGUE))

data_path<-"/home/fgao/Data_vizgen/"
mtx_BC<-read.csv(paste(data_path, "datasets_mouse_brain_map_BrainReceptorShowcase_Slice1_Replicate1_cell_by_gene_S1R1.csv", sep=""), header=T, row.names=1)
rownames(mtx_BC)<-as.factor(rownames(mtx_BC))
mtx_BC[is.na(mtx_BC)] <- 0

meta_BC<-read.csv(paste(data_path, "datasets_mouse_brain_map_BrainReceptorShowcase_Slice1_Replicate1_cell_metadata_S1R1.csv", sep=""), header=T, row.names=1)
rownames(meta_BC)<-rownames(mtx_BC)

counts_BC<-t(mtx_BC[, 1:483])
#filter out genes with less than 1000 counts across all cells and cells with less than 100 total counts
cc <- cleanCounts(counts_BC, min.reads = 1000, min.lib.size = 100, plot=TRUE)

#CPM normalization
mat <- normalizeCounts(cc, log=FALSE, verbose=TRUE)
#Normalized matrix has 67576 cells and 382 genes.

pos_BC<-meta_BC[,c("center_x", "center_y")]
colnames(pos_BC)<-c("x", "y")
pos_BC$slice<-1
  
pos_mat_BC <- pos_BC[intersect(rownames(pos_BC), colnames(mat)),]

#Get neighbor-relationship

w <- getSpatialNeighbors(pos_mat_BC, filterDist = 2.5)

Got the following error message when running getSpatialNeighbors

Error: cons memory exhausted (limit reached?)
Error during wrapup: cons memory exhausted (limit reached?)
Error: no more error handlers available (recursive errors?); invoking 'abort' restart

correlation between genes

Dear author,
Thank you for providing these fantastic tools.

I am currently seeking assistance with utilizing the tool to calculate the correlation between genes using my VIsium data. It appears that the 'spatialCrossCorMatrix' function is capable of returning correlation coefficients. However, I am unsure about how to obtain p-values for the test at this particular stage.

Your guidance on this matter would be greatly appreciated.

Thank you,
Jihyun.

Identifying filterDist value

Hello Jean and team,

Thank you for all your previous help. I'm writing to ask if there's a good way to identify a filterDist value within getSpatialNeighbors. Are there specific characteristics to look in the plots generated by getSpatialNeighbors?

Thank you in advance!

Create a Shiny package for handling spatial transcriptomics data

Hi,
Wonderful job!

I have searched through many articles and am looking for a Shiny app that can handle spatial transcriptomics data in a similar manner to how Shinycell handles single-cell transcriptomics data.

However, currently, there is no R package available that fulfills this requirement.

However, I noticed that there is a function called makeApp in your R package that seems to be able to achieve this functionality.
Since I am only familiar with using the Seurat package for spatial transcriptomics data analysis, would you be able to create an interface for the Seurat package so that Seurat objects can be used with makeApp to create Shiny apps? With the increasing depth of research in spatial transcriptomics, I believe this feature would greatly advance the field. Looking forward to your response.
Best,
Young

Parralel Computing #2

Dear JEFworks team,

Thank you very much for the great package.

As described in #15 , the first part of the pipeline to detect spatial patterns can be parallelized. Since the downstream steps such as filterSpatialPatterns and spatialCrossCorMatrix do not work genewise, I expect the mentioned block-wise processing of gene groups cannot be applied here.
Could you think of another way to parallelize these downstream steps?
I am currently working on a dataset with ~25.000 spots and 7.000 genes.

Thank you in advance,
Best,

Christoph

Windows install compilation failed : Missing dependencies?

Hi,

I can't install on windows, I get the following error during compilation:

* installing *source* package 'MERINGUE' ...
** using staged installation
** libs
"C:/rtools40/mingw64/bin/"g++ -std=gnu++11  -I"C:/Users/RICARD~1.GUE/DOCUME~1/R/R-41~1.1/include" -DNDEBUG  -I'C:/Users/ricardo.guerreiro/Documents/R/R-4.1.1/library/Rcpp/include' -I'C:/Users/ricardo.guerreiro/Documents/R/R-4.1.1/library/RcppArmadillo/include' -I'C:/Users/ricardo.guerreiro/Documents/R/R-4.1.1/library/RcppProgress/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c RcppExports.cpp -o RcppExports.o
"C:/rtools40/mingw64/bin/"g++ -std=gnu++11  -I"C:/Users/RICARD~1.GUE/DOCUME~1/R/R-41~1.1/include" -DNDEBUG  -I'C:/Users/ricardo.guerreiro/Documents/R/R-4.1.1/library/Rcpp/include' -I'C:/Users/ricardo.guerreiro/Documents/R/R-4.1.1/library/RcppArmadillo/include' -I'C:/Users/ricardo.guerreiro/Documents/R/R-4.1.1/library/RcppProgress/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c functions.cpp -o functions.o
C:/rtools40/mingw64/bin/g++ -std=gnu++11 -shared -s -static-libgcc -o MERINGUE.dll tmp.def RcppExports.o functions.o -LC:/Users/RICARD~1.GUE/DOCUME~1/R/R-41~1.1/bin/x64 -lR
C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: functions.o:functions.cpp:(.text$_ZN4arma10glue_times5applyIdLb0ELb1ELb0ENS_3ColIdEES3_EEvRNS_3MatIT_EERKT3_RKT4_S5_[_ZN4arma10glue_times5applyIdLb0ELb1ELb0ENS_3ColIdEES3_EEvRNS_3MatIT_EERKT3_RKT4_S5_]+0x293): undefined reference to `dgemm_'
C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: functions.o:functions.cpp:(.text$_ZN4arma10glue_times5applyIdLb0ELb1ELb0ENS_3ColIdEES3_EEvRNS_3MatIT_EERKT3_RKT4_S5_[_ZN4arma10glue_times5applyIdLb0ELb1ELb0ENS_3ColIdEES3_EEvRNS_3MatIT_EERKT3_RKT4_S5_]+0x627): undefined reference to `dgemv_'
C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: functions.o:functions.cpp:(.text$_ZN4arma10glue_times5applyIdLb0ELb1ELb0ENS_3ColIdEES3_EEvRNS_3MatIT_EERKT3_RKT4_S5_[_ZN4arma10glue_times5applyIdLb0ELb1ELb0ENS_3ColIdEES3_EEvRNS_3MatIT_EERKT3_RKT4_S5_]+0x6f2): undefined reference to `dgemv_'
C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: functions.o:functions.cpp:(.text$_ZN4arma10glue_times5applyIdLb0ELb1ELb0ENS_3ColIdEES3_EEvRNS_3MatIT_EERKT3_RKT4_S5_[_ZN4arma10glue_times5applyIdLb0ELb1ELb0ENS_3ColIdEES3_EEvRNS_3MatIT_EERKT3_RKT4_S5_]+0x91a): undefined reference to `dsyrk_'
collect2.exe: error: ld returned 1 exit status
no DLL was created
ERROR: compilation failed for package 'MERINGUE'

Running this as you suggest:

install.packages("remotes")
require(remotes)
remotes::install_github('JEFworks-Lab/MERINGUE', build_vignettes = TRUE)

Do I have missing dependencies? I don't see a list of requirements

Cheers,

Can't install MERINGUE in WSL2

dear @JEFworks and @bmill3r :
I tried to install MERINGUE, though I installed lapack.so and blas.so, I still failed to install MERINGUE. So now I don't know what to do, begging for your generous help, plz.
`> install.packages("~/MERINGUE-master", repos = NULL, type = "source")
Installing package into ‘/home/hxh/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)

  • installing source package ‘MERINGUE’ ...
    ** using staged installation
    ** libs
    g++ -std=gnu++14 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -o MERINGUE.so RcppExports.o functions.o -L/usr/lib/R/lib -lR
    RcppExports.o: file not recognized: file format not recognized
    collect2: error: ld returned 1 exit status
    make: *** [/usr/share/R/share/make/shlib.mk:10: MERINGUE.so] Error 1
    ERROR: compilation failed for package ‘MERINGUE’
  • removing ‘/home/hxh/R/x86_64-pc-linux-gnu-library/4.1/MERINGUE’
    Warning in install.packages :
    installation of package ‘/home/hxh/MERINGUE-master’ had non-zero exit status`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.