Skip to contents

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 unless the cells or group.by parameters are used. Returns the .narrowPeak MACS output as a GenomicRanges::GRanges object.

Usage

CallPeaks(object, ...)

# S3 method for class 'Seurat'
CallPeaks(
  object,
  assay = NULL,
  group.by = NULL,
  idents = NULL,
  cells = NULL,
  macs3.path = NULL,
  mode = "callpeak",
  broad = FALSE,
  genome = "hs",
  gsize = NULL,
  outdir = tempdir(),
  combine.peaks = TRUE,
  additional.args = NULL,
  name = Project(object),
  cleanup = TRUE,
  verbose = TRUE,
  ...
)

# S3 method for class 'ChromatinAssay5'
CallPeaks(
  object,
  macs3.path = NULL,
  combine.peaks = TRUE,
  mode = "callpeak",
  outdir = tempdir(),
  broad = FALSE,
  cells = NULL,
  genome = "hs",
  gsize = NULL,
  additional.args = NULL,
  name = "macs3",
  cleanup = TRUE,
  verbose = TRUE,
  ...
)

# S3 method for class 'Fragment2'
CallPeaks(
  object,
  macs3.path = NULL,
  mode = "callpeak",
  outdir = tempdir(),
  broad = FALSE,
  cells = NULL,
  genome = "hs",
  gsize = NULL,
  additional.args = NULL,
  name = "macs3",
  cleanup = TRUE,
  verbose = TRUE,
  ...
)

# Default S3 method
CallPeaks(
  object,
  macs3.path = NULL,
  mode = "callpeak",
  outdir = tempdir(),
  broad = FALSE,
  barcodes = NULL,
  genome = "hs",
  gsize = NULL,
  additional.args = NULL,
  name = "macs3",
  cleanup = TRUE,
  verbose = TRUE,
  ...
)

Arguments

object

A SeuratObject::Seurat object, ChromatinAssay5 object, Fragment2 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. If multiple fragments are present in the object, peaks will be called separately for each fragment file and for each group of cells. Note that to call peaks using a subset of cells, we write the cell barcodes into .txt file/s that are stored in the temp directory (base::tempdir()) by default and removed upon completion (if cleanup=TRUE). If NULL, peaks are called using all cells.

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.

cells

Vector of cell barcodes to call peaks on. If NULL, use all cells present in the fragment files, unless group.by or idents is set.

macs3.path

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

mode

MACS function to call, choose between callpeak or hmmratac. Default is callpeak. If using hmmratac mode, runtime may be longer than callpeak and additional arguments may be needed. See MACS HMMRATAC documentation for more details: https://deepwiki.com/macs3-project/MACS/3.2-atac-seq-analysis-with-hmmratac

broad

Call broad peaks (--broad parameter for MACS).

genome

MACS3 built-in effective genome size. Default is hs (Human, GRCh38). Genome sizes for mm (Mice, GRCm38), ce (C. elegans, WBcel235), and dm (Drosophila M., dm6) are also available.

gsize

Manually set effective genome size parameter. If specified, overrides MACS3 built-in genome sizes.

outdir

Path for output files.

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 GenomicRanges::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.

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.

barcodes

Path to cell barcodes (--barcodes parameter for MACS).

Value

Returns a GenomicRanges::GRanges() object

Details

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

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