log2se: calculate the log2 transformed ratios for...

View source: R/log2se.R

log2seR Documentation

calculate the log2 transformed ratios for SummarizedExperiment class

Description

Calculate the log2 transformed ratios for nucleolus vs genome. pseudo-count will be used to avoid x/0 or log(0).

Usage

log2se(
  se,
  nucleolusCols,
  genomeCols,
  pseudocount = 1L,
  transformation = c("log2OddsRatio", "log2CPMRatio", "log2Ratio"),
  chrom.level.lib = TRUE
)

Arguments

se

A RangedSummarizedExperiment object. The output of tileCount.

nucleolusCols, genomeCols

column Names of counts for nucleolus and genome. They should be the column names in the assays of se. Ratios will be calculated as log2(transformed nucleolusCols/transformed genomeCols).

pseudocount

default to 1, pseudo-count used to aviod x/0 or log(0).

transformation

transformation type

chrom.level.lib

indicating whether calculating CPM or odds using sequence depth of the whole genome or the corresponding chromosome

Value

A RangedSummarizedExperiment object with log2 transformed ratios. Assays will be named as nucleolus, genome and ratio.

Author(s)

Jianhong Ou and Julie Zhu

Examples

library(SummarizedExperiment)
se <- SummarizedExperiment(assays=list(counts=DataFrame(A=seq_len(3),
       B=rep(1, 3), C=rep(4, 3), D=rep(2, 3))),              
                  rowRanges=GRanges(c("chr1","chr1", "chr2"),
                      IRanges(c(1, 10, 20),
                            width=9)))
metadata(se)$lib.size.chrom <- data.frame( c(1000, 1000), c(2000, 2000), c(200,200), c(300,300))
colnames(metadata(se)$lib.size.chrom) <- c("A", "B", "C", "D")
rownames(metadata(se)$lib.size.chrom) <- c("chr1", "chr2")
log2se(se, nucleolusCols = c("A", "C"), genomeCols = c("B", "D"), transformation = "log2Ratio")
log2se(se, nucleolusCols = c("A", "C"), genomeCols = c("B", "D"), transformation = "log2CPMRatio")
log2se(se, nucleolusCols = c("A", "C"), genomeCols = c("B", "D"),
    transformation = "log2OddsRatio")

jianhong/NADfinder documentation built on Nov. 2, 2024, 12:09 a.m.