Skip to contents

Expand the rows of a RangedSummarizedExperiment to single base resolution.

Usage

expandSEToBaseSpace(
  se,
  regions = NULL,
  seqinfo = NULL,
  keepAssays = getReadLevelAssayNames(se),
  ignore.strand = TRUE
)

Arguments

se

RangedSummarizedExperiment object to be expanded to single base resolution.

regions

A GRanges object with one or more regions defining the ranges for expanding se. Alternatively, the regions can be specified as character scalars (e.g. "chr1:1200-1300") that can be coerced into a GRanges object. If NULL (the default), regions is set to the range of the data in se.

seqinfo

NULL or a Seqinfo object containing information about the set of genomic sequences (chromosomes). Alternatively, a named numeric vector with genomic sequence names and lengths. Used to convert a character region to a GRanges object.

keepAssays

Character vector indicating which (read-level) assays to expand to base space. Only these assays will be present in the returned object.

ignore.strand

A logical scalar defining whether to ignore the strand of the rowRanges(se).

Value

A single-base resolution RangedSummarizedExperiment corresponding to se.

Author

Charlotte Soneson, Michael Stadler

Examples

modbamfile <- system.file("extdata", "6mA_1_10reads.bam",
                          package = "SingleMoleculeGenomicsIO")
se <- readModBam(bamfiles = modbamfile, regions = "chr1:6940000-6955000",
                 modbase = "a", verbose = TRUE,
                 BPPARAM = BiocParallel::SerialParam())
#> ℹ extracting base modifications from modBAM files
#> ⠙ 0.000 Mio. genomic positions processed (0.001 Mio./s) [2ms]

#> ⠙ 0.000 Mio. genomic positions processed (0.002 Mio./s) [1ms]
#> ℹ finding unique genomic positions...
#> ✔ finding unique genomic positions... [17ms]
#> 
#> ⠙ 0.000 Mio. genomic positions processed (0.002 Mio./s) [1ms]

#> ℹ collapsed 11300 positions to 4772 unique ones
#> ✔ collapsed 11300 positions to 4772 unique ones [101ms]
#> 
#> ⠙ 0.000 Mio. genomic positions processed (0.002 Mio./s) [1ms]

se_exp <- expandSEToBaseSpace(se)
dim(se)
#> [1] 4772    1
dim(se_exp)
#> [1] 15802     1