Compute consensus peaks from a list of GRanges.

compute_consensus_peaks(
  grlist,
  groups = NULL,
  genome_build,
  lower = 2,
  upper = Inf,
  min.gapwidth = 1L,
  method = c("granges", "consensusseeker"),
  ...
)

Arguments

grlist

Named list of GRanges objects.

groups

A character vector of the same length as grlist defining how to group GRanges objects when computing consensus peaks.

genome_build

Genome build name.

lower, upper

The lower and upper bounds for the slice.

min.gapwidth

Ranges separated by a gap of at least min.gapwidth positions are not merged.

method

Method to call peaks with:

  • "granges" : Simple overlap procedure using GRanges functions. Faster but less accurate.

  • "consensusseeker" : Uses findConsensusPeakRegions to compute consensus peaks. Slower but more accurate.

...

Arguments passed on to consensusSeekeR::findConsensusPeakRegions

narrowPeaks

a GRanges containing called peak regions of signal enrichment based on pooled, normalized data for all analyzed experiments. All GRanges entries must have a metadata field called "name" which identifies the region to the called peak. All GRanges entries must also have a row name which identifies the experiment of origin. Each peaks entry must have an associated narrowPeaks entry. A GRanges entry is associated to a narrowPeaks entry by having a identical metadata "name" field and a identical row name.

peaks

a GRanges containing called peaks of signal enrichment based on pooled, normalized data for all analyzed experiments. All GRanges entries must have a metadata field called "name" which identifies the called peak. All GRanges entries must have a row name which identifies the experiment of origin. Each peaks entry must have an associated narrowPeaks entry. A GRanges entry is associated to a narrowPeaks entry by having a identical metadata "name" field and a identical row name.

chrInfo

a Seqinfo containing the name and the length of the chromosomes to analyze. Only the chomosomes contained in this Seqinfo will be analyzed.

extendingSize

a numeric value indicating the size of padding on both sides of the position of the peaks median to create the consensus region. The minimum size of the consensus region is equal to twice the value of the extendingSize parameter. The size of the extendingSize must be a positive integer. Default = 250.

expandToFitPeakRegion

a logical indicating if the region size, which is set by the extendingSize parameter is extended to include the entire narrow peak regions of all peaks included in the unextended consensus region. The narrow peak regions of the peaks added because of the extension are not considered for the extension. Default: FALSE.

shrinkToFitPeakRegion

a logical indicating if the region size, which is set by the extendingSize parameter is shrinked to fit the narrow peak regions of the peaks when all those regions are smaller than the consensus region. Default: FALSE.

minNbrExp

a positive numeric or a positive integer indicating the minimum number of experiments in which at least one peak must be present for a potential consensus region. The numeric must be a positive integer inferior or equal to the number of experiments present in the narrowPeaks and peaks parameters. Default = 1.

nbrThreads

a numeric or a integer indicating the number of threads to use in parallel. The nbrThreads must be a positive integer. Default = 1.

Value

Named list of consensus peak GRanges.

Details

NOTE: If you get the error "Error in serialize(data, node$con) : error writing to connection", try running closeAllConnections and rerun compute_consensus_peaks. This error can sometimes occur when compute_consensus_peaks has been disrupted partway through.

Examples

data("encode_H3K27ac") # example dataset as GRanges object
data("CnT_H3K27ac") # example dataset as GRanges object
data("CnR_H3K27ac") # example dataset as GRanges object 
grlist <- list(CnR=CnR_H3K27ac, CnT=CnT_H3K27ac, ENCODE=encode_H3K27ac)

consensus_peaks <- compute_consensus_peaks(grlist = grlist,
                                           groups = c("Imperial",
                                                      "Imperial",
                                                      "ENCODE"))
#> Removing non-standard chromosomes.
#> Computing consensus peaks for group: Imperial 
#>  - 2 files 
#>  - 1,670-2,707 peaks each
#> Identified 1,325 consensus peaks from 2 peak files
#> Computing consensus peaks for group: ENCODE 
#>  - 1 files 
#>  - 5,142-5,142 peaks each
#> WARNING: Cannot compute consensus peaks when group has <2 peak files. Returning original GRanges object instead.
#> Done computing consensus peaks in 0 min.