Read collapsed single-molecule footprinting data from a bedMethyl
file.
Source: R/readBedMethyl.R
readBedMethyl.Rd
This function will read collapsed single-molecule footprinting data
(reads combined per genomic position) from a bedMethyl
file.
Usage
readBedMethyl(
fnames,
modbase = NULL,
nrows = Inf,
seqinfo = NULL,
sequence.context.width = 0,
sequence.reference = NULL,
ncpu = 1L,
verbose = FALSE
)
Arguments
- fnames
Character vector with one or several paths of
bedMethyl
files, such as generated bymodkit pileup
. Each file will be read separately and become one of the columns in the returnedSummarizedExperiment
object. Iffnames
is a named vector, the names are used as column names in the returned object. Otherwise, the column names will bes1
, ...,sN
, whereN
is the length offnames
. If several elements offnames
have identical names, the data from the corresponding files are summed into a single column in the returned object.- modbase
Character vector defining the modified base (or bases) to read. Useful for reading a subset of the data from
bedMethyl
files that contain multiple types of modified bases. IfNULL
(the default), all rows in the input file are read.- nrows
Only read
nrows
rows of the input file.- seqinfo
NULL
or aSeqinfo
object containing information about the set of genomic sequences (chromosomes). Alternatively, a named numeric vector with genomic sequence names and lengths. Useful to set the sorting order of sequence names.- sequence.context.width, sequence.reference
Define the sequence context to be extracted around modified bases. By default (
sequence.context.width = 0
), no sequence context will be extracted, otherwise it will be returned inrowData(x)$sequence.context
. SeeaddSeqContext
for details.- ncpu
A numeric scalar giving the number of parallel CPU threads to to use for some of the steps in
readBedMethyl()
.- verbose
If
TRUE
, report on progress.
Value
A SummarizedExperiment
object
with genomic positions in rows and samples (the unique names of
fnames
) in the columns. If sequence.context.width != 0
,
rowData(x)$sequence.context
will be a DNAStringSet
object with the extracted sequences.
See also
modkit
software,
bedMethyl
format description,
SummarizedExperiment
for the returned object type,
fread
for the function used to read the input files,
addSeqContext
used to add the sequence context.
Examples
bmfile <- system.file("extdata", "modkit_pileup_1.bed.gz", package = "footprintR")
readBedMethyl(bmfile)
#> class: RangedSummarizedExperiment
#> dim: 10000 1
#> metadata(0):
#> assays(2): Nmod Nvalid
#> rownames: NULL
#> rowData names(0):
#> colnames(1): s1
#> colData names(0):