Figure S5 showcases the geomeTriD package, demonstrating
how it presents 3D models along with multiple genomic signals mapped
onto single-cell 3D structures.
library(geomeTriD)
library(geomeTriD.documentation)
library(GenomicRanges)
library(GenomeInfoDb)
library(colorRamps)
library(TxDb.Mmusculus.UCSC.mm10.knownGene)
library(org.Mm.eg.db)
library(geometry)Here we present 3D genome models with integrated genomic signals derived from Tri-omic, also known as ChAIR (capture of chromatin Accessibility, Interaction, and RNA profiles). This method enables simultaneous mapping of chromatin accessibility, chromatin interactions, and gene expression. Paired-end tag (PET) data are used to reconstruct 3D genome structures, while the accompanying RNA-seq and ATAC-seq signals are visualized along these models.
## plot region
range <- GRanges('chrX:1-20000000')
## prepare features
feature.gr <- getFeatureGR(txdb = TxDb.Mmusculus.UCSC.mm10.knownGene,
org = org.Mm.eg.db,
range = range)## 66 genes were dropped because they have exons located on both strands of the
## same reference sequence or on more than one reference sequence, so cannot be
## represented by a single genomic range.
## Use 'single.strand.genes.only=FALSE' to get all the genes in a GRangesList
## object, or use suppressMessages() to suppress this message.
## 'select()' returned 1:1 mapping between keys and columns
## load the 3D structure for PET data
stage <- c('G1', 'S', 'G2M')
extdata <- system.file('extdata', 'ChAIR', package = 'geomeTriD.documentation')
ChAIR_PET_m <- import3dg(file.path(extdata, 'PET', paste0('patski.allele.', stage, '_2_m.pairs.chrX.3dg.gz')))
ChAIR_PET_p <- import3dg(file.path(extdata, 'PET', paste0('patski.allele.', stage, '_2_p.pairs.chrX.3dg.gz')))
## get the chrX coordinates for maternal and paternal
ChAIR_PET_m <- lapply(ChAIR_PET_m, function(.ele) {
seqlevelsStyle(.ele) <- 'UCSC'
.ele$parental <- NULL
subsetByOverlaps(.ele, range)
})
ChAIR_PET_p <- lapply(ChAIR_PET_p, function(.ele) {
seqlevelsStyle(.ele) <- 'UCSC'
.ele$parental <- NULL
subsetByOverlaps(.ele, range)
})
# import the signals for ATAC-seq and RNA-seq for maternal and paternal
M <- lapply(stage, function(cc){ ## maternal
importGenomicSigs(c(ATAC=file.path(extdata, 'ATAC', paste0('patski.allele.', cc, '_2.M.bw')),
RNA=file.path(extdata, 'RNA', paste0('patski.allele.', cc, '_2.M.bw'))),
range = range,
cols = c('darkgreen', 'darkred'),
format = 'BigWig')
})
P <- lapply(stage, function(cc){ ## paternal
importGenomicSigs(c(ATAC=file.path(extdata, 'ATAC', paste0('patski.allele.', cc, '_2.P.bw')),
RNA=file.path(extdata, 'RNA', paste0('patski.allele.', cc, '_2.P.bw'))),
range = range,
cols = c('darkgreen', 'darkred'),
format = 'BigWig')
})
## set backbone color, make it easy to catch the genomic coordinates
resolution <- 3
backbone_colors <- rev(rainbow(n=resolution*length(ChAIR_PET_m[[1]])))
## only label the genes with high expression
labelHighExpGene <- function(sig){
this.feature.gr <- feature.gr
expressed <- sig$RNA$dat[sig$RNA$dat$score>100]
this.feature.gr$label[countOverlaps(feature.gr, expressed)==0] <- NA
## remove the genes with big size
this.feature.gr$label[width(this.feature.gr)>100000] <- NA
## only show the first gene label if multiple high expressed gene
## in the same region
l.rle <- rle(!is.na(this.feature.gr$label))
l.rle$values[l.rle$lengths<=5] <- TRUE ## merge the region with small gap
l.rle <- rle(inverse.rle(l.rle))
l <- cumsum(l.rle$lengths)
this.feature.gr$label[-l[l.rle$values]] <- NA
return(this.feature.gr)
}
## create threeJsGeometry objects for maternal and paternal cells
M_cells <- mapply(ChAIR_PET_m, M, FUN=function(model, sig){
cell <- view3dStructure(model,
feature.gr = labelHighExpGene(sig),
genomicSigs = sig,
signalTransformFun = log1p,
lwd.maxGenomicSigs = 8,
reverseGenomicSigs = FALSE,
renderer = 'none',
resolution = resolution,
col.backbone = rev(rainbow(n=resolution*length(model))),
lwd.backbone = 0.25,
lwd.gene = 1,
region = range,
show_coor = FALSE,
cluster3Dpoints = TRUE)
}, SIMPLIFY = FALSE)
P_cells <- mapply(ChAIR_PET_p, P, FUN=function(model, sig){
cell <- view3dStructure(model,
feature.gr = labelHighExpGene(sig),
genomicSigs = sig,
signalTransformFun = log1p,
lwd.maxGenomicSigs = 8,
reverseGenomicSigs = FALSE,
renderer = 'none',
resolution = resolution,
col.backbone = rev(rainbow(n=resolution*length(model))),
lwd.backbone = 0.25,
lwd.gene = 1,
region = range,
show_coor = FALSE,
cluster3Dpoints = TRUE)
}, SIMPLIFY = FALSE)
## show the maternal and paternal structures side by side
showPairs(M_cells[[1]], P_cells[[1]], title=c('mat G1', 'pat G1')) #G1
## check the size
getV <- function(points){
vol <- convhulln(as.matrix(mcols(points)), options='Fa')$vol
}
sapply(ChAIR_PET_m, getV)## [1] 1.3883935 2.1113253 0.6169364
sapply(ChAIR_PET_p, getV)## [1] 0.7920844 1.2108770 0.3453040
## R Under development (unstable) (2025-10-13 r88918)
## Platform: aarch64-apple-darwin20
## Running under: macOS Sequoia 15.6
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/4.6-arm64/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.6-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.1
##
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## time zone: America/New_York
## tzcode source: internal
##
## attached base packages:
## [1] grid stats4 stats graphics grDevices utils datasets
## [8] methods base
##
## other attached packages:
## [1] GenomeInfoDb_1.45.12
## [2] geometry_0.5.2
## [3] org.Mm.eg.db_3.22.0
## [4] TxDb.Mmusculus.UCSC.mm10.knownGene_3.10.0
## [5] GenomicFeatures_1.61.6
## [6] AnnotationDbi_1.71.2
## [7] Biobase_2.69.1
## [8] colorRamps_2.3.4
## [9] GenomicRanges_1.61.5
## [10] Seqinfo_0.99.2
## [11] IRanges_2.43.5
## [12] S4Vectors_0.47.4
## [13] BiocGenerics_0.55.4
## [14] generics_0.1.4
## [15] geomeTriD.documentation_0.0.6
## [16] geomeTriD_1.3.19
##
## loaded via a namespace (and not attached):
## [1] strawr_0.0.92 RColorBrewer_1.1-3
## [3] rstudioapi_0.17.1 jsonlite_2.0.0
## [5] magrittr_2.0.4 farver_2.1.2
## [7] rmarkdown_2.30 fs_1.6.6
## [9] BiocIO_1.19.0 ragg_1.5.0
## [11] vctrs_0.6.5 memoise_2.0.1
## [13] Rsamtools_2.25.3 RCurl_1.98-1.17
## [15] base64enc_0.1-3 htmltools_0.5.8.1
## [17] S4Arrays_1.9.1 progress_1.2.3
## [19] plotrix_3.8-4 curl_7.0.0
## [21] Rhdf5lib_1.31.1 rhdf5_2.53.6
## [23] SparseArray_1.9.1 Formula_1.2-5
## [25] sass_0.4.10 parallelly_1.45.1
## [27] bslib_0.9.0 htmlwidgets_1.6.4
## [29] desc_1.4.3 Gviz_1.53.1
## [31] httr2_1.2.1 cachem_1.1.0
## [33] GenomicAlignments_1.45.4 igraph_2.2.0
## [35] lifecycle_1.0.4 pkgconfig_2.0.3
## [37] Matrix_1.7-4 R6_2.6.1
## [39] fastmap_1.2.0 magic_1.6-1
## [41] MatrixGenerics_1.21.0 future_1.67.0
## [43] aricode_1.0.3 clue_0.3-66
## [45] digest_0.6.37 colorspace_2.1-2
## [47] textshaping_1.0.4 Hmisc_5.2-4
## [49] RSQLite_2.4.3 filelock_1.0.3
## [51] progressr_0.17.0 httr_1.4.7
## [53] abind_1.4-8 compiler_4.6.0
## [55] bit64_4.6.0-1 backports_1.5.0
## [57] htmlTable_2.4.3 S7_0.2.0
## [59] BiocParallel_1.43.4 DBI_1.2.3
## [61] R.utils_2.13.0 biomaRt_2.65.16
## [63] MASS_7.3-65 rappdirs_0.3.3
## [65] DelayedArray_0.35.3 rjson_0.2.23
## [67] tools_4.6.0 foreign_0.8-90
## [69] future.apply_1.20.0 nnet_7.3-20
## [71] R.oo_1.27.1 glue_1.8.0
## [73] restfulr_0.0.16 dbscan_1.2.3
## [75] InteractionSet_1.37.1 rhdf5filters_1.21.4
## [77] checkmate_2.3.3 cluster_2.1.8.1
## [79] gtable_0.3.6 BSgenome_1.77.2
## [81] trackViewer_1.45.2 R.methodsS3_1.8.2
## [83] ensembldb_2.33.2 data.table_1.17.8
## [85] hms_1.1.4 XVector_0.49.1
## [87] RANN_2.6.2 pillar_1.11.1
## [89] stringr_1.5.2 dplyr_1.1.4
## [91] BiocFileCache_2.99.6 lattice_0.22-7
## [93] deldir_2.0-4 rtracklayer_1.69.1
## [95] bit_4.6.0 biovizBase_1.57.1
## [97] tidyselect_1.2.1 Biostrings_2.77.2
## [99] knitr_1.50 gridExtra_2.3
## [101] ProtGenerics_1.41.0 SummarizedExperiment_1.39.2
## [103] xfun_0.53 matrixStats_1.5.0
## [105] stringi_1.8.7 UCSC.utils_1.5.0
## [107] lazyeval_0.2.2 yaml_2.3.10
## [109] evaluate_1.0.5 codetools_0.2-20
## [111] interp_1.1-6 tibble_3.3.0
## [113] cli_3.6.5 rpart_4.1.24
## [115] systemfonts_1.3.1 jquerylib_0.1.4
## [117] dichromat_2.0-0.1 Rcpp_1.1.0
## [119] globals_0.18.0 grImport_0.9-7
## [121] dbplyr_2.5.1 png_0.1-8
## [123] XML_3.99-0.19 parallel_4.6.0
## [125] pkgdown_2.1.3 rgl_1.3.24
## [127] ggplot2_4.0.0 blob_1.2.4
## [129] prettyunits_1.2.0 jpeg_0.1-11
## [131] latticeExtra_0.6-31 AnnotationFilter_1.33.0
## [133] bitops_1.0-9 txdbmaker_1.5.6
## [135] listenv_0.9.1 VariantAnnotation_1.55.2
## [137] scales_1.4.0 crayon_1.5.3
## [139] rlang_1.1.6 KEGGREST_1.49.2