R/scmethrix_operations.R
get_region_summary.RdExtracts 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 )
| scm |
|
|---|---|
| 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 |
| 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 |
| 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 |
| verbose | boolean; Flag for outputting function status messages. Default = TRUE |
table of summary statistic for the given region
Takes scMethrix object and summarizes regions
data('scMethrix_data') get_region_summary(scMethrix_data, regions = GenomicRanges::GRanges(seqnames = c("chr1","chr2"), ranges = IRanges(1,100000000)), assay = 'score', by = 'mean')#>#>#>#> 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