CCInx takes cell type transcriptomes (generally from clustered scRNAseq data) and predicts cell-cell interaction networks. It generates both node and edgelists appropriate for importing into graph visualization software such as Cytoscape, and figures showing bipartite graphs for predicted interactions between pairs of cell types.
Here we’ll demonstrate the standard use case using data from a recent study of aging mouse brain, where differential expression testing was performed between young and aging neuronal cell types. The input data is a list of data frames, where each named list entry represents a cell type, and its data frame contains the differential expression statistics for genes in that cell type.
library(CCInx)
#> Loading required package: shiny
load(system.file("DemoData/DemoDE.RData",package="CCInx"))
lapply(deL,head)
#> $DOPA
#> pval padj logFC DetectPctYoung DetectPctOld
#> mt-Nd4 0.000007580 0.03565106 -0.3873342 1.00000000 0.9948718
#> mt-Cytb 0.000012300 0.03565106 -0.3685228 1.00000000 1.0000000
#> Fam3c 0.000013900 0.03565106 0.3439192 0.03731343 0.2307692
#> mt-Co3 0.000069600 0.12934011 -0.3110772 1.00000000 1.0000000
#> Sepw1 0.000098700 0.15294014 -0.6145720 0.56716418 0.5487179
#> mt-Nd1 0.000151239 0.18006463 -0.3097862 1.00000000 1.0000000
#>
#> $GABA
#> pval padj logFC DetectPctYoung DetectPctOld
#> Malat1 1.11e-59 1.43e-55 0.3297557 0.9965659 0.9982379
#> mt-Nd1 1.36e-46 8.72e-43 -0.2975538 1.0000000 0.9995595
#> mt-Nd4 5.53e-46 2.37e-42 -0.3230167 0.9986264 0.9969163
#> mt-Atp6 2.23e-45 7.16e-42 -0.2668197 1.0000000 1.0000000
#> mt-Cytb 4.04e-45 1.04e-41 -0.2907866 1.0000000 0.9995595
#> mt-Co2 1.12e-33 2.39e-30 -0.2465769 1.0000000 0.9986784
#>
#> $GLUT
#> pval padj logFC DetectPctYoung DetectPctOld
#> PISD 4.67e-30 5.77000e-26 0.5634818 0.7088036 0.8787879
#> Malat1 1.01e-19 6.21000e-16 0.3880324 1.0000000 0.9983165
#> Gm26917 7.02e-14 2.89000e-10 0.3507149 0.2911964 0.5101010
#> Nap1l5 1.38e-08 4.27000e-05 0.3612765 0.5959368 0.7424242
#> mt-Nd4 4.05e-08 1.00002e-04 -0.2316669 0.9977427 0.9983165
#> mt-Nd1 5.30e-08 1.09025e-04 -0.2269154 1.0000000 0.9983165
The CCInx network is built using the list of gene expression data frames. The output of BuildCCInx
is a list of cell type pairs, with each entry storing both the edge list and node metadata. These can be exported as .csv files for use in Cytoscape.
inx <- BuildCCInx(GeneStatList=deL,
GeneMagnitude="logFC",
GeneStatistic="padj",
Species="mmusculus")
#> Scaling node weights per cell type...
#> Building node metadata...
#> Building edge list...
head(inx$edges)
#> nodeA nodeB edgeWeight
#> Acvr1_DOPA~Acvr1b_DOPA Acvr1_DOPA Acvr1b_DOPA 0.2790543
#> Acvr1_DOPA~Bmpr1a_DOPA Acvr1_DOPA Bmpr1a_DOPA 0.1935704
#> Acvr1b_DOPA~Acvr1c_DOPA Acvr1b_DOPA Acvr1c_DOPA 0.4319298
#> Acvr1b_DOPA~Bmpr1a_DOPA Acvr1b_DOPA Bmpr1a_DOPA 0.2919875
#> Acvr1b_DOPA~Hsp90aa1_DOPA Acvr1b_DOPA Hsp90aa1_DOPA 0.4434583
#> Acvr1b_DOPA~Snx2_DOPA Acvr1b_DOPA Snx2_DOPA 0.2785116
head(inx$nodes)
#> node gene cellType proteinType nodeWeight pval
#> Fam3c_DOPA Fam3c_DOPA Fam3c DOPA Ligand 0.6700919 0.000013900
#> Cst3_DOPA Cst3_DOPA Cst3 DOPA ECM/Ligand -0.7916701 0.000389130
#> Cntn5_DOPA Cntn5_DOPA Cntn5 DOPA Receptor 0.6451822 0.001858835
#> Acvr1b_DOPA Acvr1b_DOPA Acvr1b DOPA Receptor 0.3774713 0.006177912
#> Gabra1_DOPA Gabra1_DOPA Gabra1 DOPA Receptor 0.4729222 0.010928797
#> Gabrd_DOPA Gabrd_DOPA Gabrd DOPA Receptor 0.5560968 0.011594485
#> padj logFC DetectPctYoung DetectPctOld
#> Fam3c_DOPA 0.03565106 0.3439192 0.03731343 0.2307692
#> Cst3_DOPA 0.32885040 -0.4877179 0.83582090 0.8000000
#> Cntn5_DOPA 0.67958515 0.3311345 0.08955224 0.3025641
#> Acvr1b_DOPA 0.76506521 0.1937341 0.05223881 0.1487179
#> Gabra1_DOPA 0.99181188 0.2427234 0.11940299 0.2871795
#> Gabrd_DOPA 1.00000000 0.2854121 0.28358209 0.4769231
If no comparisons have been made experimentally, CCInx can use gene expression magnitude to rank nodes in its predicted interactions. Here we use a subset of data from the developing murine cerebral cortex to demonstrate.
load(system.file("DemoData/DemoExpr.RData",package="CCInx"))
show(e13cortex)
#> Loading required package: SingleCellExperiment
#> Loading required package: SummarizedExperiment
#> Loading required package: GenomicRanges
#> Loading required package: stats4
#> Loading required package: BiocGenerics
#> Loading required package: parallel
#>
#> Attaching package: 'BiocGenerics'
#> The following objects are masked from 'package:parallel':
#>
#> clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
#> clusterExport, clusterMap, parApply, parCapply, parLapply,
#> parLapplyLB, parRapply, parSapply, parSapplyLB
#> The following objects are masked from 'package:stats':
#>
#> IQR, mad, sd, var, xtabs
#> The following objects are masked from 'package:base':
#>
#> anyDuplicated, append, as.data.frame, basename, cbind,
#> colnames, dirname, do.call, duplicated, eval, evalq, Filter,
#> Find, get, grep, grepl, intersect, is.unsorted, lapply, Map,
#> mapply, match, mget, order, paste, pmax, pmax.int, pmin,
#> pmin.int, Position, rank, rbind, Reduce, rownames, sapply,
#> setdiff, sort, table, tapply, union, unique, unsplit, which,
#> which.max, which.min
#> Loading required package: S4Vectors
#>
#> Attaching package: 'S4Vectors'
#> The following object is masked from 'package:base':
#>
#> expand.grid
#> Loading required package: IRanges
#>
#> Attaching package: 'IRanges'
#> The following object is masked from 'package:grDevices':
#>
#> windows
#> Loading required package: GenomeInfoDb
#> Loading required package: Biobase
#> Welcome to Bioconductor
#>
#> Vignettes contain introductory material; view with
#> 'browseVignettes()'. To cite Bioconductor, see
#> 'citation("Biobase")', and for packages 'citation("pkgname")'.
#> Loading required package: DelayedArray
#> Loading required package: matrixStats
#>
#> Attaching package: 'matrixStats'
#> The following objects are masked from 'package:Biobase':
#>
#> anyMissing, rowMedians
#> Loading required package: BiocParallel
#>
#> Attaching package: 'DelayedArray'
#> The following objects are masked from 'package:matrixStats':
#>
#> colMaxs, colMins, colRanges, rowMaxs, rowMins, rowRanges
#> The following objects are masked from 'package:base':
#>
#> aperm, apply, rowsum
#> class: SingleCellExperiment
#> dim: 843 323
#> metadata(0):
#> assays(1): logcounts
#> rownames(843): 1600012H06Rik 1700066M21Rik ... Zfyve27 Znrf3
#> rowData names(0):
#> colnames(323): TACTAGATGCTA AAATTCGTCGGT ... GCAAAATTTCAC
#> TAAAACCTAATT
#> colData names(1): cellTypes
We can automatically generate the GeneStatList
input for BuildCCInx
from a Seurat
or SingleCellExperiment
object by using one of the functions from scClustViz, repurposed here in the following function:
gsl <- BuildGeneStatList(inD=e13cortex,
cl=colData(e13cortex)$cellTypes,
assayType="logcounts")
#> Loading required package: scClustViz
#> Registered S3 methods overwritten by 'ggplot2':
#> method from
#> [.quosures rlang
#> c.quosures rlang
#> print.quosures rlang
#> -- Calculating gene detection rate per cluster --
#> -- Calculating mean detected gene expression per cluster --
#> -- Calculating mean gene expression per cluster --
lapply(gsl[1:3],head)
#> $ProjectionNeurons
#> DetectRate MeanDetectGeneExpr MeanNormGeneExpr
#> 1600012H06Rik 0.034188034 0.96027540 -3.846653
#> 1700066M21Rik 0.042735043 0.60205847 -3.881925
#> 4931414P19Rik 0.034188034 -0.08063235 -4.823379
#> Abca1 0.017094017 1.26484824 -4.502413
#> Abhd15 0.008547009 -0.67777189 -6.893249
#> Acvr1 0.008547009 0.87558854 -5.736874
#>
#> $CorticalPrecursors
#> DetectRate MeanDetectGeneExpr MeanNormGeneExpr
#> 1600012H06Rik 0.01904762 -0.11515394 -5.599577
#> 1700066M21Rik 0.03809524 -0.11207464 -4.709306
#> 4931414P19Rik 0.02857143 0.05859855 -4.931774
#> Abca7 0.04761905 -0.43947291 -4.715466
#> Abcc8 0.13333333 -0.04928220 -2.926440
#> Ackr3 0.04761905 0.05591052 -4.252934
#>
#> $IntermediateProgenitors
#> DetectRate MeanDetectGeneExpr MeanNormGeneExpr
#> 1600012H06Rik 0.06930693 0.3824473 -3.423116
#> 1700066M21Rik 0.08910891 0.1107141 -3.335895
#> 4931414P19Rik 0.03960396 -0.6783537 -5.172877
#> Abca1 0.00990099 -2.0267104 -7.507622
#> Abca7 0.00990099 -1.6165331 -7.311758
#> Abcc8 0.07920792 0.2986867 -3.317917
inx <- BuildCCInx(GeneStatList=gsl,
Species="mmusculus")
#> Scaling node weights per cell type...
#> Building node metadata...
#> Building edge list...
head(inx$edges)
#> nodeA
#> Abca1_ProjectionNeurons~Pltp_ProjectionNeurons Abca1_ProjectionNeurons
#> Abca1_ProjectionNeurons~Slc1a5_ProjectionNeurons Abca1_ProjectionNeurons
#> Abca1_ProjectionNeurons~Slc7a1_ProjectionNeurons Abca1_ProjectionNeurons
#> Acvr1_ProjectionNeurons~Acvr1b_ProjectionNeurons Acvr1_ProjectionNeurons
#> Acvr1_ProjectionNeurons~Acvr2a_ProjectionNeurons Acvr1_ProjectionNeurons
#> Acvr1_ProjectionNeurons~Acvr2b_ProjectionNeurons Acvr1_ProjectionNeurons
#> nodeB
#> Abca1_ProjectionNeurons~Pltp_ProjectionNeurons Pltp_ProjectionNeurons
#> Abca1_ProjectionNeurons~Slc1a5_ProjectionNeurons Slc1a5_ProjectionNeurons
#> Abca1_ProjectionNeurons~Slc7a1_ProjectionNeurons Slc7a1_ProjectionNeurons
#> Acvr1_ProjectionNeurons~Acvr1b_ProjectionNeurons Acvr1b_ProjectionNeurons
#> Acvr1_ProjectionNeurons~Acvr2a_ProjectionNeurons Acvr2a_ProjectionNeurons
#> Acvr1_ProjectionNeurons~Acvr2b_ProjectionNeurons Acvr2b_ProjectionNeurons
#> edgeWeight
#> Abca1_ProjectionNeurons~Pltp_ProjectionNeurons 0.1713428
#> Abca1_ProjectionNeurons~Slc1a5_ProjectionNeurons 0.2671990
#> Abca1_ProjectionNeurons~Slc7a1_ProjectionNeurons 0.1981018
#> Acvr1_ProjectionNeurons~Acvr1b_ProjectionNeurons 0.3138731
#> Acvr1_ProjectionNeurons~Acvr2a_ProjectionNeurons 0.2667038
#> Acvr1_ProjectionNeurons~Acvr2b_ProjectionNeurons 0.3765668
head(inx$nodes)
#> node
#> 1600012H06Rik_ProjectionNeurons 1600012H06Rik_ProjectionNeurons
#> 1700066M21Rik_ProjectionNeurons 1700066M21Rik_ProjectionNeurons
#> 4931414P19Rik_ProjectionNeurons 4931414P19Rik_ProjectionNeurons
#> Abca1_ProjectionNeurons Abca1_ProjectionNeurons
#> Abhd15_ProjectionNeurons Abhd15_ProjectionNeurons
#> Acvr1_ProjectionNeurons Acvr1_ProjectionNeurons
#> gene cellType
#> 1600012H06Rik_ProjectionNeurons 1600012H06Rik ProjectionNeurons
#> 1700066M21Rik_ProjectionNeurons 1700066M21Rik ProjectionNeurons
#> 4931414P19Rik_ProjectionNeurons 4931414P19Rik ProjectionNeurons
#> Abca1_ProjectionNeurons Abca1 ProjectionNeurons
#> Abhd15_ProjectionNeurons Abhd15 ProjectionNeurons
#> Acvr1_ProjectionNeurons Acvr1 ProjectionNeurons
#> proteinType nodeWeight DetectRate
#> 1600012H06Rik_ProjectionNeurons Ligand 0.38054423 0.034188034
#> 1700066M21Rik_ProjectionNeurons Ligand 0.37689638 0.042735043
#> 4931414P19Rik_ProjectionNeurons Ligand 0.27952939 0.034188034
#> Abca1_ProjectionNeurons Receptor 0.31272425 0.017094017
#> Abhd15_ProjectionNeurons Ligand 0.06545941 0.008547009
#> Acvr1_ProjectionNeurons Receptor 0.18505395 0.008547009
#> MeanDetectGeneExpr MeanNormGeneExpr
#> 1600012H06Rik_ProjectionNeurons 0.96027540 -3.846653
#> 1700066M21Rik_ProjectionNeurons 0.60205847 -3.881925
#> 4931414P19Rik_ProjectionNeurons -0.08063235 -4.823379
#> Abca1_ProjectionNeurons 1.26484824 -4.502413
#> Abhd15_ProjectionNeurons -0.67777189 -6.893249
#> Acvr1_ProjectionNeurons 0.87558854 -5.736874