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)
## Warning: replacing previous import 'utils::findMatches' by
## 'S4Vectors::findMatches' when loading 'AnnotationDbi'
##
##
## 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://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
## R version 4.3.0 RC (2023-04-13 r84269)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 22.04.2 LTS
##
## Matrix products: default
## BLAS: /home/biocbuild/bbs-3.17-bioc/R/lib/libRblas.so
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
##
## 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
##
## time zone: America/New_York
## tzcode source: system (glibc)
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] IRISFGM_1.8.0 BiocStyle_2.28.0
##
## loaded via a namespace (and not attached):
## [1] segmented_1.6-4 matrixStats_0.63.0
## [3] spatstat.sparse_3.0-1 bitops_1.0-7
## [5] enrichplot_1.20.0 HDO.db_0.99.1
## [7] httr_1.4.5 RColorBrewer_1.1-3
## [9] numDeriv_2016.8-1.1 backports_1.4.1
## [11] tools_4.3.0 sctransform_0.3.5
## [13] utf8_1.2.3 R6_2.5.1
## [15] anocva_0.1.1 lazyeval_0.2.2
## [17] uwot_0.1.14 withr_2.5.0
## [19] sp_1.6-0 gridExtra_2.3
## [21] progressr_0.13.0 cli_3.6.1
## [23] Biobase_2.60.0 spatstat.explore_3.1-0
## [25] scatterpie_0.1.9 sandwich_3.0-2
## [27] labeling_0.4.2 sass_0.4.5
## [29] Seurat_4.3.0 mvtnorm_1.1-3
## [31] spatstat.data_3.0-1 gamlss_5.4-12
## [33] ggridges_0.5.4 pbapply_1.7-0
## [35] yulab.utils_0.0.6 gson_0.1.0
## [37] DOSE_3.26.0 scater_1.28.0
## [39] pscl_1.5.5 DrImpute_1.0
## [41] parallelly_1.35.0 limma_3.56.0
## [43] bbmle_1.0.25 VGAM_1.1-8
## [45] RSQLite_2.3.1 generics_0.1.3
## [47] gridGraphics_0.5-1 gamlss.data_6.0-2
## [49] ica_1.0-3 spatstat.random_3.1-4
## [51] car_3.1-2 dplyr_1.1.2
## [53] GO.db_3.17.0 Matrix_1.5-4
## [55] ggbeeswarm_0.7.1 fansi_1.0.4
## [57] S4Vectors_0.38.0 abind_1.4-5
## [59] lifecycle_1.0.3 edgeR_3.42.0
## [61] scatterplot3d_0.3-43 yaml_2.3.7
## [63] carData_3.0-5 SummarizedExperiment_1.30.0
## [65] qvalue_2.32.0 Rtsne_0.16
## [67] grid_4.3.0 blob_1.2.4
## [69] dqrng_0.3.0 promises_1.2.0.1
## [71] crayon_1.5.2 bdsmatrix_1.3-6
## [73] miniUI_0.1.1.1 lattice_0.21-8
## [75] beachmat_2.16.0 cowplot_1.1.1
## [77] KEGGREST_1.40.0 magick_2.7.4
## [79] metapod_1.8.0 pillar_1.9.0
## [81] knitr_1.42 fgsea_1.26.0
## [83] GenomicRanges_1.52.0 future.apply_1.10.0
## [85] codetools_0.2-19 fastmatch_1.1-3
## [87] leiden_0.4.3 glue_1.6.2
## [89] downloader_0.4 ggfun_0.0.9
## [91] data.table_1.14.8 vctrs_0.6.2
## [93] png_0.1-8 treeio_1.24.0
## [95] org.Mm.eg.db_3.17.0 gtable_0.3.3
## [97] kernlab_0.9-32 cachem_1.0.7
## [99] xfun_0.39 mime_0.12
## [101] tidygraph_1.2.3 pracma_2.4.2
## [103] survival_3.5-5 SingleCellExperiment_1.22.0
## [105] pheatmap_1.0.12 maxLik_1.5-2
## [107] statmod_1.5.0 bluster_1.10.0
## [109] ellipsis_0.3.2 fitdistrplus_1.1-11
## [111] ROCR_1.0-11 nlme_3.1-162
## [113] ggtree_3.8.0 bit64_4.0.5
## [115] RcppAnnoy_0.0.20 MCL_1.0
## [117] GenomeInfoDb_1.36.0 bslib_0.4.2
## [119] irlba_2.3.5.1 vipor_0.4.5
## [121] KernSmooth_2.23-20 colorspace_2.1-0
## [123] BiocGenerics_0.46.0 DBI_1.1.3
## [125] tidyselect_1.2.0 bit_4.0.5
## [127] compiler_4.3.0 BiocNeighbors_1.18.0
## [129] expm_0.999-7 DelayedArray_0.26.0
## [131] plotly_4.10.1 shadowtext_0.1.2
## [133] bookdown_0.33 scales_1.2.1
## [135] lmtest_0.9-40 stringr_1.5.0
## [137] digest_0.6.31 goftest_1.2-3
## [139] mixtools_2.0.0 spatstat.utils_3.0-2
## [141] rmarkdown_2.21 XVector_0.40.0
## [143] htmltools_0.5.5 pkgconfig_2.0.3
## [145] sparseMatrixStats_1.12.0 MatrixGenerics_1.12.0
## [147] highr_0.10 fastmap_1.1.1
## [149] rlang_1.1.0 htmlwidgets_1.6.2
## [151] DelayedMatrixStats_1.22.0 shiny_1.7.4
## [153] farver_2.1.1 jquerylib_0.1.4
## [155] zoo_1.8-12 jsonlite_1.8.4
## [157] BiocParallel_1.34.0 GOSemSim_2.26.0
## [159] BiocSingular_1.16.0 RCurl_1.98-1.12
## [161] magrittr_2.0.3 scuttle_1.10.0
## [163] GenomeInfoDbData_1.2.10 ggplotify_0.1.0
## [165] patchwork_1.1.2 DEsingle_1.20.0
## [167] munsell_0.5.0 Rcpp_1.0.10
## [169] ape_5.7-1 viridis_0.6.2
## [171] reticulate_1.28 stringi_1.7.12
## [173] ggraph_2.1.0 zlibbioc_1.46.0
## [175] MASS_7.3-59 plyr_1.8.8
## [177] gamlss.dist_6.0-5 org.Hs.eg.db_3.17.0
## [179] parallel_4.3.0 listenv_0.9.0
## [181] ggrepel_0.9.3 deldir_1.0-6
## [183] Biostrings_2.68.0 graphlayouts_0.8.4
## [185] splines_4.3.0 tensor_1.5
## [187] locfit_1.5-9.7 ggpubr_0.6.0
## [189] igraph_1.4.2 spatstat.geom_3.1-0
## [191] AdaptGauss_1.5.6 ggsignif_0.6.4
## [193] ScaledMatrix_1.8.0 reshape2_1.4.4
## [195] stats4_4.3.0 evaluate_0.20
## [197] SeuratObject_4.1.3 scran_1.28.0
## [199] BiocManager_1.30.20 tweenr_2.0.2
## [201] httpuv_1.6.9 miscTools_0.6-26
## [203] RANN_2.6.1 tidyr_1.3.0
## [205] purrr_1.0.1 polyclip_1.10-4
## [207] future_1.32.0 scattermore_0.8
## [209] ggplot2_3.4.2 ggforce_0.4.1
## [211] rsvd_1.0.5 broom_1.0.4
## [213] xtable_1.8-4 tidytree_0.4.2
## [215] rstatix_0.7.2 later_1.3.0
## [217] viridisLite_0.4.1 Polychrome_1.5.1
## [219] tibble_3.2.1 clusterProfiler_4.8.0
## [221] aplot_0.1.10 beeswarm_0.4.0
## [223] memoise_2.0.1 AnnotationDbi_1.62.0
## [225] IRanges_2.34.0 cluster_2.1.4
## [227] globals_0.16.2