Extracts and summarizes methylation or coverage info by regions of interest

get_region_summary(
  scm = NULL,
  assay = "score",
  regions = NULL,
  group = NULL,
  n_chunks = 1,
  n_threads = 1,
  by = c("mean", "median", "maximum", "minimum", "sum", "sd"),
  overlap_type = c("within", "start", "end", "any", "equal"),
  verbose = TRUE
)

Arguments

scm

scMethrix; the single cell methylation experiment

assay

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

regions

GRanges; genomic regions to be summarized. Could be a data.table with 3 columns (chr, start, end) or a GenomicRanges object

group

a column name from sample annotation that defines groups. In this case, the number of min_samples will be tested group-wise.

n_chunks

integer; Number of chunks to split the scMethrix object in case it is very large. Default = 1

n_threads

integer; Maximum number of parallel instances. Default = 1

by

closure; mathematical function by which regions should be summarized. Can be one of the following: mean, sum, max, min. Default 'mean'

overlap_type

defines the type of the overlap of the CpG sites with the target region. Default value is within. For detailed description, see the findOverlaps function of the IRanges package.

verbose

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

Value

table of summary statistic for the given region

Details

Takes scMethrix object and summarizes regions

Examples

data('scMethrix_data') get_region_summary(scMethrix_data, regions = GenomicRanges::GRanges(seqnames = c("chr1","chr2"), ranges = IRanges(1,100000000)), assay = 'score', by = 'mean')
#> Generating region summary...
#> Summarizing by average
#> Region summary generating in 0.13s
#> chr start end n_overlap_CpGs rid C1 C2 C3 C4 #> 1: chr1 1 100000000 67 1 0.7333333 0.7428571 0.7300 0.6710526 #> 2: chr2 1 100000000 67 2 0.7027027 0.6527778 0.6125 0.5526316