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
##
# 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://bmbl.bmi.osumc.edu/downloadFiles/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.1.1 (2021-08-10)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04.3 LTS
##
## Matrix products: default
## BLAS: /home/biocbuild/bbs-3.14-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.14-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.2.0 BiocStyle_2.22.0
##
## loaded via a namespace (and not attached):
## [1] scattermore_0.7 maxLik_1.5-2
## [3] SeuratObject_4.0.2 tidyr_1.1.4
## [5] ggplot2_3.3.5 bit64_4.0.5
## [7] knitr_1.36 irlba_2.3.3
## [9] DelayedArray_0.20.0 data.table_1.14.2
## [11] rpart_4.1-15 KEGGREST_1.34.0
## [13] RCurl_1.98-1.5 generics_0.1.1
## [15] ScaledMatrix_1.2.0 BiocGenerics_0.40.0
## [17] org.Mm.eg.db_3.14.0 Polychrome_1.3.1
## [19] cowplot_1.1.1 RSQLite_2.2.8
## [21] shadowtext_0.0.9 RANN_2.6.1
## [23] VGAM_1.1-5 future_1.22.1
## [25] bit_4.0.4 enrichplot_1.14.0
## [27] spatstat.data_2.1-0 httpuv_1.6.3
## [29] SummarizedExperiment_1.24.0 DrImpute_1.0
## [31] assertthat_0.2.1 viridis_0.6.2
## [33] xfun_0.27 hms_1.1.1
## [35] jquerylib_0.1.4 evaluate_0.14
## [37] promises_1.2.0.1 fansi_0.5.0
## [39] readxl_1.3.1 igraph_1.2.7
## [41] DBI_1.1.1 htmlwidgets_1.5.4
## [43] spatstat.geom_2.3-0 stats4_4.1.1
## [45] purrr_0.3.4 ellipsis_0.3.2
## [47] RSpectra_0.16-0 dplyr_1.0.7
## [49] ggpubr_0.4.0 backports_1.2.1
## [51] bookdown_0.24 sparseMatrixStats_1.6.0
## [53] deldir_1.0-6 MatrixGenerics_1.6.0
## [55] vctrs_0.3.8 SingleCellExperiment_1.16.0
## [57] Biobase_2.54.0 ROCR_1.0-11
## [59] abind_1.4-5 withr_2.4.2
## [61] cachem_1.0.6 ggforce_0.3.3
## [63] bdsmatrix_1.3-4 sctransform_0.3.2
## [65] gamlss_5.3-4 treeio_1.18.0
## [67] scran_1.22.0 goftest_1.2-3
## [69] cluster_2.1.2 DOSE_3.20.0
## [71] segmented_1.3-4 ape_5.5
## [73] lazyeval_0.2.2 crayon_1.4.1
## [75] labeling_0.4.2 edgeR_3.36.0
## [77] pkgconfig_2.0.3 tweenr_1.0.2
## [79] GenomeInfoDb_1.30.0 vipor_0.4.5
## [81] nlme_3.1-153 rlang_0.4.12
## [83] globals_0.14.0 lifecycle_1.0.1
## [85] miniUI_0.1.1.1 sandwich_3.0-1
## [87] downloader_0.4 gamlss.data_6.0-1
## [89] rsvd_1.0.5 cellranger_1.1.0
## [91] polyclip_1.10-0 matrixStats_0.61.0
## [93] lmtest_0.9-38 Matrix_1.3-4
## [95] aplot_0.1.1 carData_3.0-4
## [97] zoo_1.8-9 beeswarm_0.4.0
## [99] ggridges_0.5.3 pheatmap_1.0.12
## [101] png_0.1-7 viridisLite_0.4.0
## [103] bitops_1.0-7 KernSmooth_2.23-20
## [105] Biostrings_2.62.0 DelayedMatrixStats_1.16.0
## [107] blob_1.2.2 stringr_1.4.0
## [109] qvalue_2.26.0 parallelly_1.28.1
## [111] rstatix_0.7.0 gridGraphics_0.5-1
## [113] S4Vectors_0.32.0 ggsignif_0.6.3
## [115] beachmat_2.10.0 scales_1.1.1
## [117] memoise_2.0.0 magrittr_2.0.1
## [119] plyr_1.8.6 ica_1.0-2
## [121] zlibbioc_1.40.0 compiler_4.1.1
## [123] scatterpie_0.1.7 miscTools_0.6-26
## [125] dqrng_0.3.0 bbmle_1.0.24
## [127] RColorBrewer_1.1-2 fitdistrplus_1.1-6
## [129] XVector_0.34.0 listenv_0.8.0
## [131] patchwork_1.1.1 pbapply_1.5-0
## [133] MASS_7.3-54 mgcv_1.8-38
## [135] tidyselect_1.1.1 stringi_1.7.5
## [137] forcats_0.5.1 highr_0.9
## [139] yaml_2.2.1 GOSemSim_2.20.0
## [141] locfit_1.5-9.4 BiocSingular_1.10.0
## [143] ggrepel_0.9.1 grid_4.1.1
## [145] sass_0.4.0 fastmatch_1.1-3
## [147] tools_4.1.1 future.apply_1.8.1
## [149] parallel_4.1.1 rio_0.5.27
## [151] gamlss.dist_5.3-2 bluster_1.4.0
## [153] foreign_0.8-81 metapod_1.2.0
## [155] gridExtra_2.3 scatterplot3d_0.3-41
## [157] farver_2.1.0 Rtsne_0.15
## [159] ggraph_2.0.5 DEsingle_1.14.0
## [161] digest_0.6.28 BiocManager_1.30.16
## [163] shiny_1.7.1 pracma_2.3.3
## [165] AdaptGauss_1.5.6 Rcpp_1.0.7
## [167] GenomicRanges_1.46.0 car_3.0-11
## [169] broom_0.7.9 pscl_1.5.5
## [171] scuttle_1.4.0 later_1.3.0
## [173] RcppAnnoy_0.0.19 org.Hs.eg.db_3.14.0
## [175] httr_1.4.2 AnnotationDbi_1.56.0
## [177] kernlab_0.9-29 colorspace_2.0-2
## [179] tensor_1.5 reticulate_1.22
## [181] IRanges_2.28.0 splines_4.1.1
## [183] statmod_1.4.36 uwot_0.1.10
## [185] yulab.utils_0.0.4 tidytree_0.3.5
## [187] expm_0.999-6 spatstat.utils_2.2-0
## [189] scater_1.22.0 graphlayouts_0.7.1
## [191] ggplotify_0.1.0 plotly_4.10.0
## [193] MCL_1.0 xtable_1.8-4
## [195] jsonlite_1.7.2 ggtree_3.2.0
## [197] tidygraph_1.2.0 ggfun_0.0.4
## [199] R6_2.5.1 pillar_1.6.4
## [201] htmltools_0.5.2 mime_0.12
## [203] glue_1.4.2 fastmap_1.1.0
## [205] clusterProfiler_4.2.0 BiocParallel_1.28.0
## [207] BiocNeighbors_1.12.0 anocva_0.1.1
## [209] codetools_0.2-18 fgsea_1.20.0
## [211] mvtnorm_1.1-3 utf8_1.2.2
## [213] lattice_0.20-45 bslib_0.3.1
## [215] spatstat.sparse_2.0-0 tibble_3.1.5
## [217] mixtools_1.2.0 numDeriv_2016.8-1.1
## [219] ggbeeswarm_0.6.0 curl_4.3.2
## [221] leiden_0.3.9 magick_2.7.3
## [223] zip_2.2.0 openxlsx_4.2.4
## [225] GO.db_3.14.0 limma_3.50.0
## [227] survival_3.2-13 rmarkdown_2.11
## [229] munsell_0.5.0 DO.db_2.9
## [231] GenomeInfoDbData_1.2.7 haven_2.4.3
## [233] reshape2_1.4.4 gtable_0.3.0
## [235] spatstat.core_2.3-0 Seurat_4.0.5