truncate_peak_file: truncate_peak_file

View source: R/function_truncate_peak_file.R

truncate_peak_fileR Documentation

truncate_peak_file

Description

truncate_peak_file

Usage

truncate_peak_file(
  np_file,
  order_VAR,
  out_dir = paste0(dirname(np_file), ".diffbind_input"),
  top_fraction = 0.1,
  top_n = NULL,
  decreasing = TRUE,
  col.names = c("seqnames", "start", "end", "id", "score", "strand", "signalValue",
    "pValue", "qValue", "summit"),
  sep = "\t"
)

Arguments

np_file

path to .narrowPeak file or any .bed file using the same format

order_VAR

variable to order by, typically signalValue or pValue. Must be present in col.names.

out_dir

output location of truncated peaks, default is input file directory with ".diffbind_input" appended.

top_fraction

fraction of top ranking peaks to retain. Default is .1

top_n

number of top ranking peaks to retain. supersedes top_fraction if set. Default is NULL.

decreasing

same as "decreasing" argument for order(), default is TRUE where high values of order_VAR are good.

col.names

column names for file. Default is valid for a .narrowPeak file. order_VAR must match one of these columns

sep

delimeter to use. Default is tab, "\t"

Value

path to truncated file

Examples

peaks2 = dir("/slipstream/galaxy/uploads/working/qc_framework/output/old_peaks/", 
             pattern = "H3K4ME3_pooled_peaks.narrowPeak$", full.names = TRUE)
peaks2.truncated_20percent = sapply(peaks2, truncate_peak_file, order_VAR= "signalValue", top_fraction = .2)
peaks2.truncated_5k = sapply(peaks2, truncate_peak_file, order_VAR= "pValue", top_n = 5e3)

jrboyd/ssvRecipes documentation built on May 22, 2022, 7:07 a.m.