Main function
The main idea of IRIS-FGM consists of two major strategies:
- biclustering
- quick mode (cluster)
IRIS-FGM integrates in-house and state-of-the-art computational tools and provides two analysis strategies, including bicluster-based co-expression gene analysis (Xie, et al., 2020) and LTMG (left-truncated mixture Gaussian model)-embedded scRNA-Seq analysis (Wan, et al., 2019).
The main idea of IRIS-FGM consists of two major strategies:
The computational frame is constructed under the S4 data structure in R. The structure of BRIC object
is:
We recommend user to install IRIS-FGM on large memory (32GB) based linux operation system if user aims at analyzing bicluster-based co-expression analysis; if user aims at analyzing data by quick mode, we recommend to install IRIS-FGM on small memeory (8GB) based Windows or linux operation system; IRIS-FGM does not support MAC. We will assum you have the following installed:
Pre-install packge
if(!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
# install from bioconductor
BiocManager::install(c('org.Mm.eg.db','multtest', 'org.Hs.eg.db','clusterProfiler','DEsingle', 'DrImpute', 'scater', 'scran'))
# install from cran
chooseCRANmirror()
BiocManager::install(c('devtools', 'AdaptGauss', "pheatmap", 'mixtools','MCL', 'anocva', "Polychrome", 'qgraph','Rtools','ggpubr',"ggraph", "Seurat"))
When you perform co-expression analysis, it will output several intermediate files, thus please make sure that you have write permission to the folder where IRIS-FGM is located.
For installation, simply type the following command in your R console, please select option 3 when R asks user to update packages:
This tutorial run on a real dataset to illustrate the results obtained at each step.
As example, we will use Yan’s data, a dataset containing 90 cells and 20,214 genes from human embryo, to conduct cell type prediction.
Yan, L. et al. Single-cell RNA-Seq profiling of human preimplantation embryos and embryonic stem cells. Nat. Struct. Mol. Biol. 20, 1131-1139 (2013)
The original expression matrix was downloaded from https://s3.amazonaws.com/scrnaseq-public-datasets/manual-data/yan/nsmb.2660-S2.csv. The expression is provided as RPKM value. For convenience, we removed the space in the column names and deleted the second column(Transcript_ID). The processed data is available at https://bmbl.bmi.osumc.edu/downloadFiles/Yan_expression.txt.
IRIS-FGM can accepted 10X chromium input files, including a folder (contain gene name, cell name, and sparse matrix) and .h5 file.
# dir.create("your working directory",recursive = TRUE)
# setwd("your working directory")
library(IRISFGM)
##
##
## Registered S3 method overwritten by 'gamlss':
## method from
## print.ri bit
## Registered S3 method overwritten by 'spatstat.core':
## method from
## formula.glmmPQL MASS
##
# if you will use the ".h5" as input file, please uncomment the following command.
# input_matrix <- ReadFrom10X_h5("dir_to_your_hdf5_file")
# if you will use the 10x folder as input file, please uncomment the following command.
# input_matrix <- ReadFrom10X_folder("dir_to_10x_folder")
First, we should download data from the link, then we will use this data set as example to run the pipeline.
set.seed(123)
seed_idx <- sample(1:nrow(InputMatrix),3000)
InputMatrix_sub <- InputMatrix[seed_idx,]
object <- CreateIRISFGMObject(InputMatrix_sub)
## Creating IRISCEM object.
## The original input file contains 90 cells and 3000 genes
## Removed 97 genes that total expression value is equal or less than 0
## Removed 0 cells that number of expressed gene is equal or less than 0
meta.info
is data frame of which row name should be cell ID, and column name should be cell type.my_meta <- read.table(url("https://raw.githubusercontent.com/BMEngineeR/IRISFGM-data/main/Data/Yan_cell_label.txt"),header = TRUE,row.names = 1)
object <- AddMeta(object, meta.info = my_meta)
User can choose perform normalization or imputation based on their need. The normalization method has two options, one is the simplist CPM normalization (default normalization = 'cpm'
). The other is from package scran and can be opened by using parameter normalization = 'scran'
, . The imputation method is from package DrImpute and can be opened by using parameter IsImputation = TRUE
(default as closed).
The argument Gene_use = 500
is top 500 highlt variant genes which are selected to run LTMG. For quick mode, we recommend to use top 2000 gene (here we use top 500 gene for saving time). On the contrary, for co-expression gene analysis, we recommend to use all gene by changing Gene_use = "all"
.
# do not show progress bar
quiet <- function(x) {
sink(tempfile())
on.exit(sink())
invisible(force(x))
}
# demo only run top 500 gene for saving time.
object <- quiet(RunLTMG(object, Gene_use = "500"))
# you can get LTMG signal matrix
LTMG_Matrix <- GetLTMGmatrix(object)
LTMG_Matrix[1:5,1:5]
## OoCyte_1 OoCyte_2 OoCyte_3 Zygote_2 2_Cell_embryo_1_Cell_1
## MTRNR2L2 1 2 2 2 2
## TPT1 2 2 2 2 3
## UBB 2 2 2 2 2
## FABP5 2 2 2 2 2
## PTTG1 3 3 3 3 3
IRIS-FGM can provide biclustering function, which is based on our in-house novel algorithm, QUBIC2 (https://github.com/maqin2001/qubic2). Here we will show the basic biclustering usage of IRIS-FGM using a \(500\times 87\) expression matrix generated from previous top 500 variant genes. However, we recommend user should use “Gene_use = all”" to generate LTMG matrix.
User can type the following command to run discretization (LTMG) + biclustering directly:
##
|
| | 0%
|
| | 1%
|
|= | 1%
|
|= | 2%
|
|== | 2%
|
|== | 3%
|
|=== | 4%
|
|=== | 5%
|
|==== | 5%
|
|==== | 6%
|
|===== | 7%
|
|===== | 8%
|
|====== | 8%
|
|====== | 9%
|
|======= | 9%
|
|======= | 10%
|
|======= | 11%
|
|======== | 11%
|
|======== | 12%
|
|========= | 12%
|
|========= | 13%
|
|========== | 14%
|
|========== | 15%
|
|=========== | 15%
|
|=========== | 16%
|
|============ | 17%
|
|============ | 18%
|
|============= | 18%
|
|============= | 19%
|
|============== | 19%
|
|============== | 20%
|
|============== | 21%
|
|=============== | 21%
|
|=============== | 22%
|
|================ | 22%
|
|================ | 23%
|
|================= | 24%
|
|================= | 25%
|
|================== | 25%
|
|================== | 26%
|
|=================== | 27%
|
|=================== | 28%
|
|==================== | 28%
|
|==================== | 29%
|
|===================== | 29%
|
|===================== | 30%
|
|===================== | 31%
|
|====================== | 31%
|
|====================== | 32%
|
|======================= | 32%
|
|======================= | 33%
|
|======================== | 34%
|
|======================== | 35%
|
|========================= | 35%
|
|========================= | 36%
|
|========================== | 37%
|
|========================== | 38%
|
|=========================== | 38%
|
|=========================== | 39%
|
|============================ | 39%
|
|============================ | 40%
|
|============================ | 41%
|
|============================= | 41%
|
|============================= | 42%
|
|============================== | 42%
|
|============================== | 43%
|
|=============================== | 44%
|
|=============================== | 45%
|
|================================ | 45%
|
|================================ | 46%
|
|================================= | 47%
|
|================================= | 48%
|
|================================== | 48%
|
|================================== | 49%
|
|=================================== | 49%
|
|=================================== | 50%
|
|=================================== | 51%
|
|==================================== | 51%
|
|==================================== | 52%
|
|===================================== | 52%
|
|===================================== | 53%
|
|====================================== | 54%
|
|====================================== | 55%
|
|======================================= | 55%
|
|======================================= | 56%
|
|======================================== | 57%
|
|======================================== | 58%
|
|========================================= | 58%
|
|========================================= | 59%
|
|========================================== | 59%
|
|========================================== | 60%
|
|========================================== | 61%
|
|=========================================== | 61%
|
|=========================================== | 62%
|
|============================================ | 62%
|
|============================================ | 63%
|
|============================================= | 64%
|
|============================================= | 65%
|
|============================================== | 65%
|
|============================================== | 66%
|
|=============================================== | 67%
|
|=============================================== | 68%
|
|================================================ | 68%
|
|================================================ | 69%
|
|================================================= | 69%
|
|================================================= | 70%
|
|================================================= | 71%
|
|================================================== | 71%
|
|================================================== | 72%
|
|=================================================== | 72%
|
|=================================================== | 73%
|
|==================================================== | 74%
|
|==================================================== | 75%
|
|===================================================== | 75%
|
|===================================================== | 76%
|
|====================================================== | 77%
|
|====================================================== | 78%
|
|======================================================= | 78%
|
|======================================================= | 79%
|
|======================================================== | 79%
|
|======================================================== | 80%
|
|======================================================== | 81%
|
|========================================================= | 81%
|
|========================================================= | 82%
|
|========================================================== | 82%
|
|========================================================== | 83%
|
|=========================================================== | 84%
|
|=========================================================== | 85%
|
|============================================================ | 85%
|
|============================================================ | 86%
|
|============================================================= | 87%
|
|============================================================= | 88%
|
|============================================================== | 88%
|
|============================================================== | 89%
|
|=============================================================== | 89%
|
|=============================================================== | 90%
|
|=============================================================== | 91%
|
|================================================================ | 91%
|
|================================================================ | 92%
|
|================================================================= | 92%
|
|================================================================= | 93%
|
|================================================================== | 94%
|
|================================================================== | 95%
|
|=================================================================== | 95%
|
|=================================================================== | 96%
|
|==================================================================== | 97%
|
|==================================================================== | 98%
|
|===================================================================== | 98%
|
|===================================================================== | 99%
|
|======================================================================| 99%
|
|======================================================================| 100%
# Please uncomment the following command and make sure to set a correct working directory so that the following command will generate intermeidate files.
# object <- RunBicluster(object, DiscretizationModel = "LTMG",OpenDual = FALSE,
# NumBlockOutput = 100, BlockOverlap = 0.5, BlockCellMin = 25)
(The default parameters in IRIS-FGM are BlockCellMin=15, BlockOverlap=0.7, Extension=0.90, NumBlockOutput=100 you may use other parameters as you like, just specify them in the argument)
User can use reduction = "umap"
or reductopm = "tsne"
to perform dimension reduction.
# demo only run top 500 gene for saving time.
object <- RunDimensionReduction(object, mat.source = "UMImatrix",reduction = "umap")
## Centering and scaling data matrix
## Warning in irlba(A = t(x = object), nv = npcs, ...): You're computing too large
## a percentage of total singular values, use a standard svd instead.
## Computing nearest neighbor graph
## Computing SNN
## Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
##
## Number of nodes: 87
## Number of edges: 1450
##
## Running Louvain algorithm...
## Maximum modularity in 10 random starts: 0.6856
## Number of communities: 3
## Elapsed time: 0 seconds
The cell cluster prediction of IRIS-FGM is based on the biclustering results. In short, it will construct a weighted graph based on the biclusters and then do clustering on the weighted graph. To facilitate the process, we will use the pre-generated object to perform cell clustering result based on biclustering results.
# Please uncomment the following command and make sure your working directory is the same as the directory containing intermediate output files.
# object <- FindClassBasedOnMC(object)
## ncount_RNA nFeature Cluster Seurat_r_0.8_k_20 MC_Label
## OoCyte_1 28202.91 657 1 2 1
## OoCyte_2 27029.84 660 1 2 1
## OoCyte_3 26520.14 672 1 2 1
## Zygote_1 24796.04 681 2 2 1
## Zygote_2 23575.54 679 2 2 1
## Calculating cluster 0
## Calculating cluster 1
## Calculating cluster 2
## R version 4.2.0 RC (2022-04-19 r82224)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04.4 LTS
##
## Matrix products: default
## BLAS: /home/biocbuild/bbs-3.15-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.15-bioc/R/lib/libRlapack.so
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_GB LC_COLLATE=C
## [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] IRISFGM_1.4.0 BiocStyle_2.24.0
##
## loaded via a namespace (and not attached):
## [1] scattermore_0.8 maxLik_1.5-2
## [3] SeuratObject_4.0.4 tidyr_1.2.0
## [5] ggplot2_3.3.5 bit64_4.0.5
## [7] knitr_1.38 irlba_2.3.5
## [9] DelayedArray_0.22.0 data.table_1.14.2
## [11] rpart_4.1.16 KEGGREST_1.36.0
## [13] RCurl_1.98-1.6 generics_0.1.2
## [15] ScaledMatrix_1.4.0 BiocGenerics_0.42.0
## [17] org.Mm.eg.db_3.15.0 Polychrome_1.4.0
## [19] cowplot_1.1.1 RSQLite_2.2.12
## [21] shadowtext_0.1.2 RANN_2.6.1
## [23] VGAM_1.1-6 future_1.25.0
## [25] bit_4.0.4 enrichplot_1.16.0
## [27] spatstat.data_2.2-0 httpuv_1.6.5
## [29] SummarizedExperiment_1.26.0 DrImpute_1.0
## [31] assertthat_0.2.1 viridis_0.6.2
## [33] xfun_0.30 jquerylib_0.1.4
## [35] evaluate_0.15 promises_1.2.0.1
## [37] fansi_1.0.3 igraph_1.3.1
## [39] DBI_1.1.2 htmlwidgets_1.5.4
## [41] spatstat.geom_2.4-0 stats4_4.2.0
## [43] purrr_0.3.4 ellipsis_0.3.2
## [45] RSpectra_0.16-1 dplyr_1.0.8
## [47] ggpubr_0.4.0 backports_1.4.1
## [49] bookdown_0.26 sparseMatrixStats_1.8.0
## [51] deldir_1.0-6 MatrixGenerics_1.8.0
## [53] vctrs_0.4.1 SingleCellExperiment_1.18.0
## [55] Biobase_2.56.0 ROCR_1.0-11
## [57] abind_1.4-5 withr_2.5.0
## [59] cachem_1.0.6 ggforce_0.3.3
## [61] bdsmatrix_1.3-4 sctransform_0.3.3
## [63] gamlss_5.4-3 treeio_1.20.0
## [65] scran_1.24.0 goftest_1.2-3
## [67] cluster_2.1.3 DOSE_3.22.0
## [69] ape_5.6-2 segmented_1.5-0
## [71] lazyeval_0.2.2 crayon_1.5.1
## [73] labeling_0.4.2 edgeR_3.38.0
## [75] pkgconfig_2.0.3 tweenr_1.0.2
## [77] GenomeInfoDb_1.32.0 vipor_0.4.5
## [79] nlme_3.1-157 rlang_1.0.2
## [81] globals_0.14.0 lifecycle_1.0.1
## [83] miniUI_0.1.1.1 sandwich_3.0-1
## [85] downloader_0.4 gamlss.data_6.0-2
## [87] rsvd_1.0.5 polyclip_1.10-0
## [89] matrixStats_0.62.0 lmtest_0.9-40
## [91] Matrix_1.4-1 aplot_0.1.3
## [93] carData_3.0-5 zoo_1.8-10
## [95] beeswarm_0.4.0 ggridges_0.5.3
## [97] pheatmap_1.0.12 png_0.1-7
## [99] viridisLite_0.4.0 bitops_1.0-7
## [101] KernSmooth_2.23-20 Biostrings_2.64.0
## [103] DelayedMatrixStats_1.18.0 blob_1.2.3
## [105] stringr_1.4.0 qvalue_2.28.0
## [107] parallelly_1.31.1 spatstat.random_2.2-0
## [109] rstatix_0.7.0 gridGraphics_0.5-1
## [111] S4Vectors_0.34.0 ggsignif_0.6.3
## [113] beachmat_2.12.0 scales_1.2.0
## [115] memoise_2.0.1 magrittr_2.0.3
## [117] plyr_1.8.7 ica_1.0-2
## [119] zlibbioc_1.42.0 compiler_4.2.0
## [121] scatterpie_0.1.7 miscTools_0.6-26
## [123] dqrng_0.3.0 bbmle_1.0.24
## [125] RColorBrewer_1.1-3 fitdistrplus_1.1-8
## [127] cli_3.3.0 XVector_0.36.0
## [129] listenv_0.8.0 patchwork_1.1.1
## [131] pbapply_1.5-0 MASS_7.3-57
## [133] mgcv_1.8-40 tidyselect_1.1.2
## [135] stringi_1.7.6 highr_0.9
## [137] yaml_2.3.5 GOSemSim_2.22.0
## [139] locfit_1.5-9.5 BiocSingular_1.12.0
## [141] ggrepel_0.9.1 grid_4.2.0
## [143] sass_0.4.1 fastmatch_1.1-3
## [145] tools_4.2.0 future.apply_1.9.0
## [147] parallel_4.2.0 gamlss.dist_6.0-3
## [149] bluster_1.6.0 metapod_1.4.0
## [151] gridExtra_2.3 scatterplot3d_0.3-41
## [153] farver_2.1.0 Rtsne_0.16
## [155] ggraph_2.0.5 DEsingle_1.16.0
## [157] digest_0.6.29 BiocManager_1.30.17
## [159] shiny_1.7.1 pracma_2.3.8
## [161] AdaptGauss_1.5.6 Rcpp_1.0.8.3
## [163] GenomicRanges_1.48.0 car_3.0-12
## [165] broom_0.8.0 pscl_1.5.5
## [167] scuttle_1.6.0 later_1.3.0
## [169] RcppAnnoy_0.0.19 org.Hs.eg.db_3.15.0
## [171] httr_1.4.2 AnnotationDbi_1.58.0
## [173] kernlab_0.9-30 colorspace_2.0-3
## [175] tensor_1.5 reticulate_1.24
## [177] IRanges_2.30.0 splines_4.2.0
## [179] statmod_1.4.36 uwot_0.1.11
## [181] yulab.utils_0.0.4 tidytree_0.3.9
## [183] expm_0.999-6 spatstat.utils_2.3-0
## [185] scater_1.24.0 graphlayouts_0.8.0
## [187] ggplotify_0.1.0 plotly_4.10.0
## [189] MCL_1.0 xtable_1.8-4
## [191] jsonlite_1.8.0 ggtree_3.4.0
## [193] tidygraph_1.2.1 ggfun_0.0.6
## [195] R6_2.5.1 pillar_1.7.0
## [197] htmltools_0.5.2 mime_0.12
## [199] glue_1.6.2 fastmap_1.1.0
## [201] clusterProfiler_4.4.0 BiocParallel_1.30.0
## [203] BiocNeighbors_1.14.0 anocva_0.1.1
## [205] codetools_0.2-18 fgsea_1.22.0
## [207] mvtnorm_1.1-3 utf8_1.2.2
## [209] lattice_0.20-45 bslib_0.3.1
## [211] spatstat.sparse_2.1-1 tibble_3.1.6
## [213] mixtools_1.2.0 numDeriv_2016.8-1.1
## [215] ggbeeswarm_0.6.0 leiden_0.3.9
## [217] magick_2.7.3 GO.db_3.15.0
## [219] limma_3.52.0 survival_3.3-1
## [221] rmarkdown_2.14 munsell_0.5.0
## [223] DO.db_2.9 GenomeInfoDbData_1.2.8
## [225] reshape2_1.4.4 gtable_0.3.0
## [227] spatstat.core_2.4-2 Seurat_4.1.0