call_peaks: Call peaks

View source: R/call_peaks.R

call_peaksR Documentation

Call peaks

Description

Call peaks from a bedGraph or bigWig file using multiple methods. By default, it automatically infers a reasonable cutoff threshold as well.
Note : MACS3/MACSr is not currently compatible with Windows (see here for details).

Usage

call_peaks(
  bedgraph_path,
  method = c("MACSr", "SEACR"),
  cutoff = NULL,
  minlen = 200L,
  maxgap = 30L,
  call_summits = TRUE,
  trackline = TRUE,
  log = TRUE,
  norm = TRUE,
  stringent = TRUE,
  outdir = tempdir(),
  outputfile = paste0(method[[1]], ".peaks.bed"),
  return_path = FALSE,
  nThread = 1,
  verbose = TRUE
)

Arguments

bedgraph_path

Path to bedGraph file. Can instead provide a bigWig file, but this will first be converted to bedGraph format, which can take some time if trying to convert data from across the entire genome.

method

Method to call peaks with:

  • "MACSr" : Uses MACS3 via bdgpeakcall.

  • "SEACR" : Uses SEACR via find_packages.

cutoff
  • when method="MACSr" : Passed to cutoff argument. Cutoff depends on which method you used for score track. If the file contains pvalue scores from MACS3, score 5 means pvalue 1e-5. If NULL, a reasonable cutoff value will be inferred through a cutoff_analysis.

  • when method="SEACR" : Passed to control argument. Control (IgG) data bedgraph file to generate an empirical threshold for peak calling. Alternatively, a numeric threshold n between 0 and 1 returns the top n fraction of peaks based on total signal within peaks (default: 0.05).

minlen

minimum length of peak, better to set it as d value. DEFAULT: 200", default = 200.

maxgap

maximum gap between significant points in a peak, better to set it as tag size. DEFAULT: 30", default = 30.

call_summits

If set, MACS will use a more sophisticated approach to find all summits in each enriched peak region DEFAULT: False",default=False.

trackline

Tells MACS not to include trackline with bedGraph files. The trackline is required by UCSC.

log

Whether to capture logs.

norm

Field 3: "norm" (default: norm=TRUE) denotes normalization of control to target data, "non" (norm=FALSE) skips this behavior. "norm" is recommended unless experimental and control data are already rigorously normalized to each other (e.g. via spike-in).

stringent

Field 4:"relaxed" (stringent=FALSE) uses a total signal threshold between the knee and peak of the total signal curve, and corresponds to the “relaxed” mode described in the text, whereas “stringent” (default: stringent=TRUE) uses the peak of the curve, and corresponds to “stringent” mode.

outdir

Directory to store cutoff_analysis report and peak file in.

outputfile

Name of the peak output file (stored in BED format).

return_path

Whether to return the path to the saved peak file, or the peak data itself as a GRanges object.

nThread

When nThread>1, accelerates file importing and peak calling using multi-core parallelisation.

verbose

Print messages.

Value

GRanges or path to save peaks file.

Examples

files <- example_bg_bw()
peaks <- PeakyFinders::call_peaks(bedgraph_path = files$bedgraph,
                                  method="SEACR")

neurogenomics/PeakyFinders documentation built on March 24, 2024, 4:28 p.m.