Transforms an assay in an scMethrix object.

transform_assay(
  scm,
  assay = "score",
  new_assay = "new_assay",
  trans = NULL,
  h5_temp = NULL
)

Arguments

scm

scMethrix; the single cell methylation experiment

assay

string; name of an existing assay. Default = "score"

new_assay

string; name for transformed assay. Default = "new_assay"

trans

closure; The transformation function. Default = mean

h5_temp

string; temporary directory to store the temporary HDF5 files

Value

An scMethrix object

Details

Uses the inputted function to transform an assay in the scMethrix object. The function is applied column-wise as to optimize how HDF5 files access sample data.

If HDF5 objects are used, transform functions need to accept 'DelayedMatrix' (e.g., from DelayedMatrixStats). Otherwise,

Examples

data('scMethrix_data') transform_assay(scMethrix_data,assay="score",new_assay="plus1",trans=function(x){x+1})
#> An object of class scMethrix #> n_CpGs: 286 #> n_samples: 4 #> assays: score, counts, plus1 #> reduced dims: #> is_h5: FALSE #> Reference: hg19 #> Physical size: 56.7 Kb