gather_files: Gather files

View source: R/gather_files.R

gather_filesR Documentation

Gather files

Description

Recursively find peak/picard files stored within subdirectories and import them as a list of GRanges objects.

Usage

gather_files(
  dir,
  type = "peaks.stringent",
  nfcore_cutandrun = FALSE,
  return_paths = FALSE,
  rbind_list = FALSE,
  workers = check_workers(),
  verbose = TRUE
)

Arguments

dir

Directory to search within.

type

File type to search for. Options include:

  • "<pattern>"Finds files matching an arbitrary regex pattern specified by user.

  • "peaks.stringent"Finds files ending in "*.stringent.bed$"

  • "peaks.consensus"Finds files ending in "*.consensus.peaks.bed$"

  • "peaks.consensus.filtered" Finds files ending in"*.consensus.peaks.filtered.awk.bed$"

  • "picard"Finds files ending in "*.target.markdup.MarkDuplicates.metrics.txt$"

nfcore_cutandrun

Whether the files were generated by the nf-core/cutandrun Nextflow pipeline. If TRUE, can use the standardised folder structure to automatically generate more descriptive file names with sample IDs.

return_paths

Return only the file paths without actually reading them in as GRanges.

rbind_list

Bind all objects into one.

workers

Number of cores to parallelise across (in applicable functions). If NULL, will set to the total number of available cores minus 1.

verbose

Print messages.

Details

For "peaks.stringent" files called with SEACR, column names will be automatically added:

  • total_signal : Total signal contained within denoted coordinates.

  • max_signalMaximum bedgraph signal attained at any base pair within denoted coordinates.

  • max_signal_region Region representing the farthest upstream and farthest downstream bases within the denoted coordinates that are represented by the maximum bedgraph signal.

Value

A named list of GRanges objects.

Examples

#### Make example files ####
save_paths <- EpiCompare::write_example_peaks()
dir <- unique(dirname(save_paths))
#### Gather/import files ####
peaks <- EpiCompare::gather_files(dir=dir, 
                                  type="peaks.narrow",
                                  workers = 1)

neurogenomics/EpiCompare documentation built on Oct. 18, 2024, 11:04 p.m.