Given a path to a bedGraph file, imports data into a GRanges object. Note: In the bedGraph format chromosome coordinates are zero-based and half-open (the first chromosome position is 0, and the last position in a chromosome of length N is N - 1). Imported data here are always converted to one-based format, irrespective of the format of the imported file.

import_bedGraph(path, keep_zeros = FALSE, local_copy = TRUE,
  use_rtracklayer = FALSE)

Arguments

path

Path to a bedGraph file. No default.

keep_zeros

Logical indicating whether to keep rows with a score of zero. In bedGraph files generated by our MACS2 FE ChIP-seq data analysis pipeline these correspond to missing values and should not be kept. Defaults to FALSE.

local_copy

Logical indicating whether to create local copy of target file before importing data. If TRUE a local copy is automatically created and deleted after use. Use this argument to avoid reading files directly from shared locations (namely LabShare). Defaults to TRUE.

use_rtracklayer

Logical indicating whether to use function import.bedGraph from rtracklayer. If FALSE, the file is read into a tibble using read_tsv and then converted to a GRanges object. Defaults to FALSE.

Value

GRanges object.

Examples

# NOT RUN {
x <- import_bedGraph('data.bdg', keep_zeros=TRUE, local_copy=FALSE, use_rtracklayer)

dot1 <- import_bedGraph('/Volumes/LabShare/HTGenomics/HiSeqOutputs/\
                         AveReps_SacCer3_MACS2_FE/\
                         Red1-dot1D-195-16-Reps-SacCer3-B3W3-MACS2/\
                         Red1-dot1D-195-16-Reps-SacCer3-2mis_B3W3_MACS2_FE.bdg.gz')
# }