fit_cyclical_many: Estimate Cyclic Trend For Several Genes Using Trendfiltering

Description Usage Arguments Value Author(s) See Also Examples

View source: R/fit_cyclic_many.R

Description

For each gene, apply trend filtering as implemented in the genlasso package to estimate cell cycle. For more details, see link{fit_trendfiltering}.

Usage

1
fit_cyclical_many(Y, theta, polyorder = 2, ncores = 2)

Arguments

Y

A matrix (gene by sample) of gene expression values. The expression values are assumed to have been normalized and transformed to the standard normal distribution.

theta

A vector of cell cycle phase (angles) for single-cell samples.

polyorder

Argument passed to fit_trendfilter specifying the degree of the polynomials used in nonparametric trend filtering.

ncores

Argument passed to makeCluster specifying the number of threads.

Value

A list containing the following elements:

predict.yy

A matrix of predicted expression values at observed cell cycle.

cellcycle_peco_ordered

A vector of predicted cell cycle. Values range between 0 to 2pi

cellcycle_function

List of predicted cell cycle functions.

pve

Vector of proportion of variance explained in each gene by the predicted cell cycle.

Author(s)

Joyce Hsiao

See Also

fit_trendfilter

fit_trendfilter for fitting one gene using trend filtering.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library(SingleCellExperiment)
data(sce_top101genes)

# Select top 10 cyclic genes.
sce_top10 <- sce_top101genes[order(rowData(sce_top101genes)$pve_fucci,
                                  decreasing=TRUE)[1:10],]
coldata <- colData(sce_top10)

# Get cell cycle phase based on FUCCI scores.
theta <- coldata$theta
names(theta) <- rownames(coldata)

# Normalize expression counts.
sce_top10 <- data_transform_quantile(sce_top10, ncores=2)
exprs_quant <- assay(sce_top10, "cpm_quantNormed")

# Order FUCCI phase and expression.
theta_ordered <- theta[order(theta)]
yy_ordered <- exprs_quant[, names(theta_ordered)]

fit <- fit_cyclical_many(Y=yy_ordered, theta=theta_ordered)

jhsiao999/peco documentation built on Nov. 21, 2020, 5:34 p.m.