Call peaks using MACS. Fragment files linked to the specified assay will be used to call peaks. If multiple fragment files are present, all will be used in a single MACS invocation. Returns the .narrowPeak MACS output as a GRanges object.

CallPeaks(object, ...)

# S3 method for Seurat
CallPeaks(
  object,
  assay = NULL,
  group.by = NULL,
  idents = NULL,
  macs2.path = NULL,
  broad = FALSE,
  format = "BED",
  outdir = tempdir(),
  fragment.tempdir = tempdir(),
  combine.peaks = TRUE,
  effective.genome.size = 2.7e+09,
  extsize = 200,
  shift = -extsize/2,
  additional.args = NULL,
  name = Project(object),
  cleanup = TRUE,
  verbose = TRUE,
  ...
)

# S3 method for ChromatinAssay
CallPeaks(
  object,
  macs2.path = NULL,
  outdir = tempdir(),
  broad = FALSE,
  format = "BED",
  effective.genome.size = 2.7e+09,
  extsize = 200,
  shift = -extsize/2,
  additional.args = NULL,
  name = "macs2",
  cleanup = TRUE,
  verbose = TRUE,
  ...
)

# S3 method for Fragment
CallPeaks(
  object,
  macs2.path = NULL,
  outdir = tempdir(),
  broad = FALSE,
  format = "BED",
  effective.genome.size = 2.7e+09,
  extsize = 200,
  shift = -extsize/2,
  additional.args = NULL,
  name = "macs2",
  cleanup = TRUE,
  verbose = TRUE,
  ...
)

# S3 method for default
CallPeaks(
  object,
  macs2.path = NULL,
  outdir = tempdir(),
  broad = FALSE,
  format = "BED",
  effective.genome.size = 2.7e+09,
  extsize = 200,
  shift = -extsize/2,
  additional.args = NULL,
  name = "macs2",
  cleanup = TRUE,
  verbose = TRUE,
  ...
)

Arguments

object

A Seurat object, ChromatinAssay object, Fragment object, or the path to fragment file/s.

...

Arguments passed to other methods

assay

Name of assay to use

group.by

Grouping variable to use. If set, peaks will be called independently on each group of cells and then combined. Note that to call peaks using subsets of cells we first split the fragment file/s used, so using a grouping variable will require extra time to split the files and perform multiple MACS peak calls, and will store additional files on-disk that may be large. Note that we store split fragment files in the temp directory (tempdir) by default, and if the program is interrupted before completing these temporary files will not be removed. If NULL, peaks are called using all cells together (pseudobulk).

idents

List of identities to include if grouping cells (only valid if also setting the group.by parameter). If NULL, peaks will be called for all cell identities.

macs2.path

Path to MACS program. If NULL, try to find MACS automatically.

broad

Call broad peaks (--broad parameter for MACS)

format

File format to use. Should be either "BED" or "BEDPE" (see MACS documentation).

outdir

Path for output files

fragment.tempdir

Path to write temporary fragment files. Only used if group.by is not NULL.

combine.peaks

Controls whether peak calls from different groups of cells are combined using GenomicRanges::reduce when calling peaks for different groups of cells (group.by parameter). If FALSE, a list of GRanges object will be returned. Note that metadata fields such as the p-value, q-value, and fold-change information for each peak will be lost if combining peaks.

effective.genome.size

Effective genome size parameter for MACS (-g). Default is the human effective genome size (2.7e9).

extsize

extsize parameter for MACS. Only relevant if format="BED"

shift

shift parameter for MACS. Only relevant if format="BED"

additional.args

Additional arguments passed to MACS. This should be a single character string

name

Name for output MACS files. This will also be placed in the name field in the GRanges output.

cleanup

Remove MACS output files

verbose

Display messages

Value

Returns a GRanges object

Details

See https://macs3-project.github.io/MACS/ for MACS documentation.

If you call peaks using MACS2 please cite: doi:10.1186/gb-2008-9-9-r137