getScaledCountsPerTx:

Usage Arguments Examples

Usage

1
getScaledCountsPerTx(SE, features = rowRanges(SE), counts = assays(SE)$counts, read_length = colData(SE)$read_length, lib_size = colData(SE)$lib_size)

Arguments

SE
features
counts
read_length
lib_size

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (SE, features = rowRanges(SE), counts = assays(SE)$counts, 
    read_length = colData(SE)$read_length, lib_size = colData(SE)$lib_size) 
{
    if (is.null(lib_size)) 
        stop("Lib size is essential")
    if (is.null(read_length)) 
        stop("Read length is essential")
    if (is.null(features)) 
        stop("Feature range is essential")
    n_features <- length(features)
    n_samples <- ncol(SE)
    E <- matrix(NA_real_, nrow = n_features, ncol = n_samples)
    R <- rep(read_length, each = n_features)
    L <- rep(sum(width(features)), n_samples)
    E <- matrix(L + R - 1, nrow = n_features, ncol = n_samples)
    X <- counts/(E * 0.001)
    X <- sweep(X, 2, lib_size * 1e-06, FUN = "/")
    return(X)
  }

TapscottLab/SeqPipelineTools documentation built on May 16, 2019, 2:28 a.m.