fit_loess {peco} | R Documentation

## Use loess to estimate cyclic trends of expression values

### Description

Use loess to estimate cyclic trends of expression values

### Usage

    fit_loess(yy, time)

### Arguments

`yy` | A vector of gene expression values for one gene. The expression values are assumed to have been normalized and transformed to standard normal distribution.
`time` | A vector of angles (cell cycle phase).

### Value

A list with one element, `pred.yy`, giving the estimated cyclic trend.

### Author(s)

Joyce Hsiao

### Examples

    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)

    # 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[1, names(theta_ordered)]

    fit <- fit_loess(yy_ordered, time=theta_ordered)

    plot(x=theta_ordered, y=yy_ordered, pch=16, cex=.7, axes=FALSE,
      ylab="quantile-normalized expression values", xlab="FUCCI phase",
      main = "loess fit")
    points(x=theta_ordered, y=fit$pred.yy, col="blue", pch=16, cex=.7)
    axis(2)
    axis(1,at=c(0,pi/2, pi, 3*pi/2, 2*pi),
      labels=c(0,expression(pi/2), expression(pi), expression(3*pi/2),
      expression(2*pi)))
    abline(h=0, lty=1, col="black", lwd=.7)

[Package peco version 0.99.16 Index]