mergeReplicates: Merge replicates of basepair-resolution GRanges objects

View source: R/dataset_functions.R

mergeReplicatesR Documentation

Merge replicates of basepair-resolution GRanges objects

Description

This simple convenience function uses mergeGRangesData to combine replicates (e.g. biological replicates) of basepair-resolution GRanges objects.

Usage

mergeReplicates(
  ...,
  field = "score",
  sample_names = NULL,
  makeBRG = TRUE,
  exact_overlaps = FALSE,
  ncores = getOption("mc.cores", 2L)
)

Arguments

...

Either a list of GRanges objects, or any number of GRanges objects (see mergeGRangesData). However, the names of the datasets must end in "_rep#", where "#" is one or more characters indicating the replicate.

field

The metadata field that contains count information for each range. length(field) should either be 1, or equal to the number of datasets.

sample_names

Optional character vector with which to rename the datasets. This is useful if the sample names do not conform to the "_rep" naming scheme.

makeBRG, exact_overlaps

See mergeGRangesData.

ncores

The number of cores to use. This function will try to maximize the use of the ncores given, but care should be taken as mergeGRangesData can be memory intensive. Excessive memory usage can cause dramatic reductions in performance.

Value

A list of GRanges objects.

Examples

data("PROseq")
ps_list <- list(a_rep1 = PROseq[seq(1, length(PROseq), 4)],
                b_rep1 = PROseq[seq(2, length(PROseq), 4)],
                a_rep2 = PROseq[seq(3, length(PROseq), 4)],
                b_rep2 = PROseq[seq(4, length(PROseq), 4)])
mergeReplicates(ps_list, ncores = 1)

mdeber/BRGenomics documentation built on March 4, 2024, 9:46 a.m.