# Chapter 16 Cell cycle assignment

## 16.1 Motivation

On occasion, it can be desirable to determine cell cycle activity from scRNA-seq data. In and of itself, the distribution of cells across phases of the cell cycle is not usually informative, but we can use this to determine if there are differences in proliferation between subpopulations or across treatment conditions. Many of the key events in the cell cycle (e.g., passage through checkpoints) are post-translational and thus not directly visible in transcriptomic data; nonetheless, there are enough changes in expression that can be exploited to determine cell cycle phase. We demonstrate using the 416B dataset, which is known to contain actively cycling cells after oncogene induction.

#--- setup ---#
library(OSCAUtils)
chapterPreamble(use_cache = TRUE)

library(scRNAseq)
sce.416b <- LunSpikeInData(which="416b")
sce.416b$block <- factor(sce.416b$block)

#--- gene-annotation ---#
library(AnnotationHub)
ens.mm.v97 <- AnnotationHub()[["AH73905"]]
rowData(sce.416b)$ENSEMBL <- rownames(sce.416b) rowData(sce.416b)$SYMBOL <- mapIds(ens.mm.v97, keys=rownames(sce.416b),
keytype="GENEID", column="SYMBOL")
rowData(sce.416b)$SEQNAME <- mapIds(ens.mm.v97, keys=rownames(sce.416b), keytype="GENEID", column="SEQNAME") library(scater) rownames(sce.416b) <- uniquifyFeatureNames(rowData(sce.416b)$ENSEMBL,
rowData(sce.416b)$SYMBOL) #--- quality-control ---# mito <- which(rowData(sce.416b)$SEQNAME=="MT")
stats <- perCellQCMetrics(sce.416b, subsets=list(Mt=mito))
qc <- quickPerCellQC(stats, percent_subsets=c("subsets_Mt_percent",
"altexps_ERCC_percent"), batch=sce.416b$block) sce.416b <- sce.416b[,!qc$discard]

#--- normalization ---#
library(scran)
sce.416b <- computeSumFactors(sce.416b)
sce.416b <- logNormCounts(sce.416b)

#--- variance-modelling ---#
dec.416b <- modelGeneVarWithSpikes(sce.416b, "ERCC", block=sce.416b$block) chosen.hvgs <- getTopHVGs(dec.416b, prop=0.1) #--- batch-correction ---# library(limma) assay(sce.416b, "corrected") <- removeBatchEffect(logcounts(sce.416b), design=model.matrix(~sce.416b$phenotype), batch=sce.416b$block) #--- dimensionality-reduction ---# sce.416b <- runPCA(sce.416b, ncomponents=10, subset_row=chosen.hvgs, exprs_values="corrected", BSPARAM=BiocSingular::ExactParam()) set.seed(1010) sce.416b <- runTSNE(sce.416b, dimred="PCA", perplexity=10) #--- clustering ---# my.dist <- dist(reducedDim(sce.416b, "PCA")) my.tree <- hclust(my.dist, method="ward.D2") library(dynamicTreeCut) my.clusters <- unname(cutreeDynamic(my.tree, distM=as.matrix(my.dist), minClusterSize=10, verbose=0)) sce.416b$cluster <- factor(my.clusters)
sce.416b
## class: SingleCellExperiment
## dim: 46604 185
## assays(3): counts logcounts corrected
## rownames(46604): 4933401J01Rik Gm26206 ... CAAA01147332.1 CBFB-MYH11-mcherry
## rowData names(4): Length ENSEMBL SYMBOL SEQNAME
## colnames(185): SLX-9555.N701_S502.C89V9ANXX.s_1.r_1 SLX-9555.N701_S503.C89V9ANXX.s_1.r_1
##   ... SLX-11312.N712_S507.H5H5YBBXX.s_8.r_1 SLX-11312.N712_S517.H5H5YBBXX.s_8.r_1
## colData names(10): Source Name cell line ... block cluster
## reducedDimNames(2): PCA TSNE
## spikeNames(0):
## altExpNames(2): ERCC SIRV

## 16.2 Using the cyclins

The cyclins control progression through the cell cycle and have well-characterized patterns of expression across cell cycle phases. Cyclin D is expressed throughout but peaks at G1; cyclin E is expressed highest in the G1/S transition; cyclin A is expressed across S and G2; and cyclin B is expressed highest in late G2 and mitosis. Inspection of the relative expression of cyclins across the population can often be sufficient to determine the relative cell cycle activity in each cluster (Figure 16.1). For example, cluster 1 is likely to be in G1 while the other clusters are scattered across the later phases.

cyclin.genes <- grep("^Ccn[abde][0-9]$", rowData(sce.416b)$SYMBOL)
cyclin.genes <- rownames(sce.416b)[cyclin.genes]
cyclin.genes
##  [1] "Ccnb3" "Ccna2" "Ccna1" "Ccne2" "Ccnd2" "Ccne1" "Ccnd1" "Ccnb2" "Ccnb1" "Ccnd3"
library(scater)
plotHeatmap(sce.416b, order_columns_by="cluster",
cluster_rows=FALSE, features=sort(cyclin.genes))

The 416B dataset is somewhat unusual as each cluster maps cleanly onto a distinct phase of the cell cycle. This separation is not typically seen in more heterogeneous datasets where the cell cycle is only a secondary factor of variation. Fortunately, it is not strictly necessary to know the exact phase of each cell or cluster to answer most cycle-related questions. For example, we can use standard DE methods (Chapter 11) to look for upregulation of each cyclin, which would imply that a subpopulation contains more cells in the corresponding cell cycle phase. The same logic applies to comparisons between treatment conditions, as described in Chapter 14.

library(scran)
markers <- findMarkers(sce.416b, subset.row=cyclin.genes,
group=sce.416bcluster, test.type="wilcox", direction="up") # We can infer that cluster 4 has more cells in G2/M than the other clusters, # based on higher expression of the cyclin B's. markers[[4]] ## DataFrame with 10 rows and 6 columns ## Top p.value FDR AUC.1 AUC.2 ## <integer> <numeric> <numeric> <numeric> <numeric> ## Ccna2 1 4.47082375042302e-09 4.47082375042303e-08 0.996336996336996 0.641821946169772 ## Ccnd1 1 0.000227713359883692 0.000569283399709229 0.368131868131868 0.822981366459627 ## Ccnb1 1 1.1902731719087e-07 5.9513658595435e-07 0.9496336996337 0.519668737060041 ## Ccnb2 2 3.87799221174218e-07 1.29266407058073e-06 0.934065934065934 0.781573498964803 ## Ccna1 4 0.0296992388707593 0.0593984777415187 0.535714285714286 0.495341614906832 ## Ccne2 5 0.0656982677997446 0.109497112999574 0.641941391941392 0.447204968944099 ## Ccne1 6 0.585978982128404 0.837112831612005 0.564102564102564 0.366459627329193 ## Ccnd3 7 0.994578048157763 1 0.402930402930403 0.283643892339545 ## Ccnd2 8 0.999992961215686 1 0.134615384615385 0.32712215320911 ## Ccnb3 10 1 1 0.5 0.5 ## AUC.3 ## <numeric> ## Ccna2 0.925595238095238 ## Ccnd1 0.776785714285714 ## Ccnb1 0.93452380952381 ## Ccnb2 0.898809523809524 ## Ccna1 0.535714285714286 ## Ccne2 0.455357142857143 ## Ccne1 0.473214285714286 ## Ccnd3 0.273809523809524 ## Ccnd2 0.306547619047619 ## Ccnb3 0.5 Direct examination of cyclin expression is easily to understand, interprete and experimentally validate. However, it is best suited for statements about relative cell cycle activity; for example, we would find it difficult to assign cell cycle phase in Figure 16.1 without the presence of clusters spanning all phases to provide benchmarks for “high” and “low” expression of each cyclin. We also assume that cyclin expression is not affected by biological processes other than the cell cycle, which may be a strong assumption in some cases, e.g., malignant cells. This strategy is strongly dependent on having good sequencing coverage of the cyclins, which is less of an issue for the whole-of-transcriptome methods described below that use information from more genes. ## 16.3 Using reference profiles Cell cycle assignment can be considered a specialized case of cell annotation, which suggests that the strategies described in Chapter 12 can be applied here. For example, given a reference dataset containing mouse ESCs with known cell cycle phases (Buettner et al. 2015), we could use SingleR to determine the phase of each cell in a test dataset. library(scRNAseq) sce.ref <- BuettnerESCData() sce.ref ## class: SingleCellExperiment ## dim: 38293 288 ## metadata(0): ## assays(1): counts ## rownames(38293): ENSMUSG00000000001 ENSMUSG00000000003 ... ENSMUSG00000097934 ## ENSMUSG00000097935 ## rowData names(3): EnsemblTranscriptID AssociatedGeneName GeneLength ## colnames(288): G1_cell1_count G1_cell2_count ... G2M_cell95_count G2M_cell96_count ## colData names(1): phase ## reducedDimNames(0): ## spikeNames(0): ## altExpNames(1): ERCC We use the reference dataset to identify phase-specific markers from genes with annotated roles in cell cycle. The use of prior annotation aims to avoid detecting markers for other biological processes that happen to be correlated with the cell cycle in the reference dataset, which would reduce classification performance if those processes are absent or uncorrelated in the test dataset. # Find genes that are present in both datasets and are cell cycle-related. library(org.Mm.eg.db) cycle.anno <- select(org.Mm.eg.db, keytype="GOALL", keys="GO:0007049", columns="ENSEMBL")[,"ENSEMBL"] candidates <- Reduce(intersect, list(rownames(sce.ref), rowData(sce.416b)ENSEMBL, cycle.anno))
str(candidates)
##  chr [1:1606] "ENSMUSG00000000001" "ENSMUSG00000000028" "ENSMUSG00000000103" ...
# Identifying markers between cell cycle phases.
sce.ref <- logNormCounts(sce.ref)
phase.stats <- pairwiseWilcox(logcounts(sce.ref), sce.ref$phase, direction="up", subset.row=candidates) cycle.markers <- getTopMarkers(phase.stats[[1]], phase.stats[[2]]) We use the identified markers to assign labels to the 416B data with the SingleR() function. Cluster 1 mostly consists of G1 cells while the other clusters have more cells in the other phases, which is broadly consistent with our conclusions from the cyclin-based analysis. Unlike the cyclin-based analysis, this approach yields “absolute” assignments of cell cycle phase that do not need to be interpreted relative to other cells in the same dataset. # Switching row names back to Ensembl to match the reference. test.data <- logcounts(sce.416b) rownames(test.data) <- rowData(sce.416b)$ENSEMBL

library(SingleR)
assignments <- SingleR(test.data, ref=sce.ref,
label=sce.ref$phase, genes=cycle.markers) tab <- table(assignments$labels, sce.416b$cluster) tab ## ## 1 2 3 4 ## G1 71 7 19 1 ## G2M 2 60 1 13 ## S 5 2 4 0 The key assumption here is that the cell cycle is orthogonal to cell type and other aspects of cell behavior. This justifies the use of a reference involving cell types that are quite different from the cells in the test dataset, provided that the cell cycle transcriptional program is conserved across datasets (Bertoli, Skotheim, and Bruin 2013; Conboy et al. 2007). However, it is not difficult to find routine violations of this assumption - for example, Lef1 is detected as one of the top markers to distinguish between G1 from G2/M in the reference but has no detectable expression in the 416B dataset (Figure 16.2). gridExtra::grid.arrange( plotExpression(sce.ref, features="ENSMUSG00000027985", x="phase"), plotExpression(sce.416b, features="Lef1", x="cluster"), ncol=2) Thus, a healthy dose of skepticism is required when interpreting these assignments. Our hope is that any systematic assignment error is consistent across clusters and conditions such that they cancel out in comparisons of phase frequencies, which is the more interesting analysis anyway. Indeed, while the availability of absolute phase calls may be more appealing, it may not make much practical difference to the conclusions if the frequencies are ultimately interpreted in a relative sense (e.g., using a chi-squared test). # Test for differences in phase distributions between clusters 1 and 2. chisq.test(tab[,1:2]) ## ## Pearson's Chi-squared test ## ## data: tab[, 1:2] ## X-squared = 108, df = 2, p-value <2e-16 ## 16.4 Using the cyclone() classifier The prediction method described by Scialdone et al. (2015) is another approach for classifying cells into cell cycle phases. Using a reference dataset, we first compute the sign of the difference in expression between each pair of genes. Pairs with changes in the sign across cell cycle phases are chosen as markers. Cells in a test dataset can then be classified into the appropriate phase, based on whether the observed sign for each marker pair is consistent with one phase or another. This approach is implemented in the cyclone() function from the scran package, which also contains pre-trained set of marker pairs for mouse and human data. set.seed(100) library(scran) mm.pairs <- readRDS(system.file("exdata", "mouse_cycle_markers.rds", package="scran")) # Using Ensembl IDs to match up with the annotation in 'mm.pairs'. assignments <- cyclone(sce.416b, mm.pairs, gene.names=rowData(sce.416b)$ENSEMBL)

The phase assignment result for each cell in the 416B dataset is shown in Figure 16.3. For each cell, a higher score for a phase corresponds to a higher probability that the cell is in that phase. We focus on the G1 and G2/M scores as these are the most informative for classification.

plot(assignments$score$G1, assignments$score$G2M,
xlab="G1 score", ylab="G2/M score", pch=16)

Cells are classified as being in G1 phase if the G1 score is above 0.5 and greater than the G2/M score; in G2/M phase if the G2/M score is above 0.5 and greater than the G1 score; and in S phase if neither score is above 0.5. We see that the results are quite similar to those from SingleR(), which is reassuring.

table(assignments$phases, sce.416b$cluster)
##
##        1  2  3  4
##   G1  74  8 20  0
##   G2M  1 48  0 13
##   S    3 13  4  1

The same considerations and caveats described for the SingleR-based approach are also applicable here. From a practical perspective, cyclone() takes much longer but does not require an explicit reference as the marker pairs are already computed.

## 16.5 Regressing out cell cycle phase

For some time, it was popular to regress out the cell cycle phase prior to downstream analyses. The aim was to remove uninteresting variation due to cell cycle, thus improving resolution of other biological processes of interest. We could implement this by performing cell cycle phase assignment as described above, treating each phase as a separate batch and applying any of the batch correction strategies described in Chapter 27.2.6. The most common approach is to use a linear model to simply regress out the phase effect, e.g., via regressBatches().

library(batchelor)
sce.nocycle <- regressBatches(sce.416b, batch=assignments$phases) # Similar use in related functions that support blocking: dec.nocycle <- modelGeneVarWithSpikes(sce.416b, "ERCC", block=assignments$phases)
marker.nocycle <- findMarkers(sce.416b, sce.416b$cluster, block=assignments$phases)

That said, we do not consider adjusting for cell cycle to be a necessary step in routine scRNA-seq analyses. In most applications, the cell cycle is a minor factor of variation, secondary to differences between cell types. Any attempt at removal would also need to assume that the cell cycle effect is orthogonal to other biological processes. For example, regression would potentially remove interesting signal if cell cycle activity varied across clusters or conditions, with a prime example being the increased proliferation of activated T cells (Richard et al. 2018). We suggest only performing cell cycle adjustment on an as-needed basis in populations with clear cell cycle effects.

Alternatively, users may consider just excluding cell cycle-related genes from downstream analysis. This should remove most of the cell cycle effect without making strong assumptions about orthogonality. Of course, this will not remove the effect of the cell cycle in genes with no annotated role in the cell cycle, but in such cases, there is ambiguity over whether that effect is truly due to the cell cycle or from some other (interesting) biological process that happens to be correlated with the cell cycle.

library(org.Mm.eg.db)
cc.genes <- select(org.Mm.eg.db, keys="GO:0007049", keytype="GOALL", column="ENSEMBL")
sce.416b.uncycle <- sce.416b[!rowData(sce.416b)$ENSEMBL %in% cc.genes$ENSEMBL,]

# Proceed with the rest of the analysis. Note that in this case, oncogene
# induction is quite strongly associated with the cell cycle but is considered
# to be a separate effect, so removal of the cell cycle-related genes does not
# change the clustering much.

## Session Info

R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS

Matrix products: default
BLAS:   /home/ramezqui/Rbuild/danbuild/R-3.6.1/lib/libRblas.so
LAPACK: /home/ramezqui/Rbuild/danbuild/R-3.6.1/lib/libRlapack.so

locale:
[1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8
[4] LC_COLLATE=C               LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] parallel  stats4    stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] batchelor_1.2.2             fossil_0.3.7                shapefiles_0.7
[4] foreign_0.8-72              maps_3.3.0                  sp_1.3-2
[7] SingleR_1.0.0               org.Mm.eg.db_3.10.0         AnnotationDbi_1.48.0
[10] scRNAseq_2.0.2              scran_1.14.3                scater_1.14.3
[13] ggplot2_3.2.1               SingleCellExperiment_1.8.0  SummarizedExperiment_1.16.0
[16] DelayedArray_0.12.0         BiocParallel_1.20.0         matrixStats_0.55.0
[19] Biobase_2.46.0              GenomicRanges_1.38.0        GenomeInfoDb_1.22.0
[22] IRanges_2.20.0              S4Vectors_0.24.0            BiocGenerics_0.32.0
[25] Cairo_1.5-10                BiocStyle_2.14.0            OSCAUtils_0.0.1

loaded via a namespace (and not attached):
[1] ggbeeswarm_0.6.0              colorspace_1.4-1              XVector_0.26.0
[4] BiocNeighbors_1.4.0           bit64_0.9-7                   interactiveDisplayBase_1.24.0
[7] knitr_1.26                    zeallot_0.1.0                 dbplyr_1.4.2
[10] pheatmap_1.0.12               shiny_1.4.0                   BiocManager_1.30.9
[13] compiler_3.6.1                httr_1.4.1                    dqrng_0.2.1
[16] backports_1.1.5               assertthat_0.2.1              Matrix_1.2-17
[19] fastmap_1.0.1                 lazyeval_0.2.2                limma_3.42.0
[22] later_1.0.0                   BiocSingular_1.2.0            htmltools_0.4.0
[25] tools_3.6.1                   rsvd_1.0.2                    igraph_1.2.4.1
[28] gtable_0.3.0                  glue_1.3.1                    GenomeInfoDbData_1.2.2
[31] dplyr_0.8.3                   rappdirs_0.3.1                Rcpp_1.0.3
[34] vctrs_0.2.0                   ExperimentHub_1.12.0          DelayedMatrixStats_1.8.0
[37] xfun_0.11                     stringr_1.4.0                 mime_0.7
[40] irlba_2.3.3                   statmod_1.4.32                AnnotationHub_2.18.0
[43] edgeR_3.28.0                  zlibbioc_1.32.0               scales_1.0.0
[46] promises_1.1.0                RColorBrewer_1.1-2            yaml_2.2.0
[49] curl_4.2                      memoise_1.1.0                 gridExtra_2.3
[52] stringi_1.4.3                 RSQLite_2.1.2                 BiocVersion_3.10.1
[55] highr_0.8                     rlang_0.4.1                   pkgconfig_2.0.3
[58] bitops_1.0-6                  evaluate_0.14                 lattice_0.20-38
[61] purrr_0.3.3                   labeling_0.3                  cowplot_1.0.0
[64] bit_1.1-14                    tidyselect_0.2.5              magrittr_1.5
[67] bookdown_0.15                 R6_2.4.1                      DBI_1.0.0
[70] pillar_1.4.2                  withr_2.1.2                   RCurl_1.95-4.12
[73] tibble_2.1.3                  crayon_1.3.4                  BiocFileCache_1.10.2
[76] rmarkdown_1.17                viridis_0.5.1                 locfit_1.5-9.1
[79] grid_3.6.1                    blob_1.2.0                    digest_0.6.22
[82] xtable_1.8-4                  httpuv_1.5.2                  munsell_0.5.0
[85] beeswarm_0.2.3                viridisLite_0.3.0             vipor_0.4.5                  

### Bibliography

Bertoli, C., J. M. Skotheim, and R. A. de Bruin. 2013. “Control of cell cycle transcription during G1 and S phases.” Nat. Rev. Mol. Cell Biol. 14 (8):518–28.

Buettner, F., K. N. Natarajan, F. P. Casale, V. Proserpio, A. Scialdone, F. J. Theis, S. A. Teichmann, J. C. Marioni, and O. Stegle. 2015. “Computational analysis of cell-to-cell heterogeneity in single-cell RNA-sequencing data reveals hidden subpopulations of cells.” Nat. Biotechnol. 33 (2):155–60.

Conboy, C. M., C. Spyrou, N. P. Thorne, E. J. Wade, N. L. Barbosa-Morais, M. D. Wilson, A. Bhattacharjee, et al. 2007. “Cell cycle genes are the evolutionarily conserved targets of the E2F4 transcription factor.” PLoS ONE 2 (10):e1061.

Richard, A. C., A. T. L. Lun, W. W. Y. Lau, B. Gottgens, J. C. Marioni, and G. M. Griffiths. 2018. “T cell cytolytic capacity is independent of initial stimulation strength.” Nat. Immunol. 19 (8):849–58.

Scialdone, A., K. N. Natarajan, L. R. Saraiva, V. Proserpio, S. A. Teichmann, O. Stegle, J. C. Marioni, and F. Buettner. 2015. “Computational assignment of cell-cycle stage from single-cell transcriptome data.” Methods 85 (September):54–61.