This function will take a SummarizedExperiment
object with read-level footprinting data (e.g. returned by
readModkitExtract
or readModBam
) and summarize
reads in each sample, for instance to generate modified and total counts at
each position for each sample.
Usage
addReadsSummary(
se,
assay.type = "mod_prob",
statistics = c("Nmod", "Nvalid", "FracMod"),
keep.reads = FALSE,
verbose = FALSE
)
Arguments
- se
SummarizedExperiment
object with read-level footprinting data. Rows should correspond to positions and columns to samples.- assay.type
A string or integer scalar specifying the assay of
se
containing the read-level data to be summarized. Typically, this assay contains modification probabilities.- statistics
Character vector specifying the type of statistics to be computed. Currently supported values are "Nmod" (number of modification probabilities greater or equal to 0.5), "Nvalid" (number of overlapping reads), "Pmod" (average modification probability), "AvgConf" (average confidence of (non-)modification probabilities).
- keep.reads
A scalar logical. If
TRUE
, the read-level data fromassay.type
will be retained in an assay of the same name.- verbose
If
TRUE
, report on progress.
Value
A SummarizedExperiment
object
with the same dimensions as se
(positions in rows and samples in
columns), and added assays corresponding to the requested statistics.
See also
SummarizedExperiment
for the
returned object type, readModkitExtract
for the function
used to read the input files.
Examples
exfile <- system.file("extdata", "modkit_extract_rc_6mA_1.tsv.gz", package = "footprintR")
se <- readModkitExtract(exfile, modbase = "a")
se
#> class: RangedSummarizedExperiment
#> dim: 8344 1
#> metadata(2): modkit_threshold filter_threshold
#> assays(1): mod_prob
#> rownames(8344): chr1:6929104:+ chr1:6929106:+ ... chr1:6941530:-
#> chr1:6941531:-
#> rowData names(0):
#> colnames(1): s1
#> colData names(2): sample modbase
se_summary <- addReadsSummary(se, keep.reads = TRUE)
se_summary
#> class: RangedSummarizedExperiment
#> dim: 8344 1
#> metadata(0):
#> assays(4): Nmod Nvalid FracMod mod_prob
#> rownames(8344): chr1:6929104:+ chr1:6929106:+ ... chr1:6941530:-
#> chr1:6941531:-
#> rowData names(0):
#> colnames(1): s1
#> colData names(2): sample modbase