Masks CpGs by cell count

mask_by_sample(
  scm = NULL,
  assay = "score",
  low_threshold = NULL,
  prop_threshold = NULL,
  n_threads = 1,
  verbose = TRUE
)

Arguments

scm

scMethrix; the single cell methylation experiment

assay

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

low_threshold

numeric; The minimal cell count allowed. Everything below will get masked.

prop_threshold

numeric; The minimal proportion of covered cells.

n_threads

integer; Number of parallel instances. Can only be used if scMethrix is in HDF5 format. Default = 1.

verbose

boolean; Flag for outputting function status messages. Default = TRUE

Value

An object of class scMethrix

Details

Takes scMethrix object and masks sites with too high or too low coverage by putting NA for assay values. The sites will remain in the object and all assays will be affected.

low_threshold is used to mask sites with low overall cell counts. A site represented by a single sample is typically not useful. prop_threshold is used to mask sites with a low proportional count

Examples

data('scMethrix_data') mask_by_sample(scMethrix_data,low_threshold=2)
#> Masking by sample count...
#> Finding low coverage CpG sites...
#> Found 67 CpGs with count < 2
#> Masked 67 [23.43%] CpG sites in 0.06s
#> An object of class scMethrix #> n_CpGs: 286 #> n_samples: 4 #> assays: score, counts #> reduced dims: #> is_h5: FALSE #> Reference: hg19 #> Physical size: 47 Kb
mask_by_sample(scMethrix_data,prop_threshold=0.5)
#> Masking by sample count...
#> Finding high average count CpG sites...
#> Found 67 CpGs with missing cell proportion < 0.5
#> Masked 67 [23.43%] CpG sites in 0.08s
#> An object of class scMethrix #> n_CpGs: 286 #> n_samples: 4 #> assays: score, counts #> reduced dims: #> is_h5: FALSE #> Reference: hg19 #> Physical size: 47 Kb