matLog2: log2-scale transform a dense OR sparse matrix

Description Usage Arguments Details Value

View source: R/utils.R

Description

This avoids the creation of a dense intermediate matrix when operating on sparse matrices

Usage

1
matLog2(spmat, scale = FALSE, scaleFactor = 1e+06)

Arguments

spmat

sparse Matrix

scale

boolean - whether or not to scale the columns to sum to 'scale_factor'

scaleFactor

if scale = TRUE, columns are scaled to sum to this number

Details

Either performs result <- log2(spmat+1) or if scale = TRUE returns result <- log2(spmat/colSums(spmat)*scaleFactor + 1)

Value

logmat sparse Matrix


zgyaru/testSctpa documentation built on Dec. 23, 2021, 9:17 p.m.