R/scTensor-internal.R

Defines functions .importAssays .FTT .CPT .CPM .CPMED

.CPMED <- function(input){
    libsize <- colSums(input)
    median(libsize) * t(t(input) / libsize)
}

.CPM <- function(input){
    libsize <- colSums(input)
    1e6 * t(t(input) / libsize)
}

.CPT <- function(input){
    libsize <- colSums(input)
    1e4 * t(t(input) / libsize)
}

.FTT <- function(input){
    sqrt(input) + sqrt(input + 1)
}

.importAssays <- function(sce, assayNames){
    if(assayNames %in% names(assays(sce))){
        eval(parse(text=paste0("assays(sce)$", assayNames)))
    }else{
        stop("Please specify the valid assayNames (cf. names(assays(sce)))")
    }
}

'%ni%' <- Negate('%in%')

Try the scTensor package in your browser

Any scripts or data that you put into this service are public.

scTensor documentation built on Nov. 8, 2020, 5 p.m.