applyNFsGRanges: Apply normalization factors to GRanges object

Description Usage Arguments Value Author(s) See Also Examples

View source: R/normalization.R

Description

Convenience function for multiplying signal counts in one or more GRanges object by their normalization factors.

Usage

1
2
3
4
5
6
applyNFsGRanges(
  dataset.gr,
  NF,
  field = "score",
  ncores = getOption("mc.cores", 2L)
)

Arguments

dataset.gr

A GRanges object with signal data in one or more metadata fields, or a list of such GRanges objects.

NF

One or more normalization factors to apply by multiplication. The number of normalization factors should match the number of datasets in dataset.gr.

field

The metadata field(s) in dataset.gr that contain signal to be normalized.

ncores

The number of cores to use for computations. Multicore only used if there are multiple datasets present.

Value

A GRanges object, or a list of GRanges objects.

Author(s)

Mike DeBerardine

See Also

getSpikeInNFs

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Apply NFs to a single GRanges
gr <- GRanges(seqnames = "chr1",
              ranges = IRanges(1:3, 3:5),
              strand = c("+", "+", "-"),
              score = c(2, 3, 4))
gr

applyNFsGRanges(gr, NF = 0.5, ncores = 1)

# Apply NFs to a list of GRanges
gr2 <- gr
ranges(gr2) <- IRanges(4:6, 5:7)
grl <- list(gr, gr2)
grl

applyNFsGRanges(grl, NF = c(0.5, 0.75), ncores = 1)

# Apply NFs to a multiplexed GRanges
gr_multi <- gr
names(mcols(gr_multi)) <- "gr1"
gr_multi$gr2 <- c(3, 5, 7)
gr_multi

applyNFsGRanges(gr_multi, NF = c(2, 3), field = c("gr1", "gr2"),
                ncores = 1)

BRGenomics documentation built on Nov. 8, 2020, 8:03 p.m.