Skip to contents

This function imports genomic data from various file formats (BED, bigWig, GFF, etc.) using rtracklayer and converts it to a tidy data frame suitable for ggplot2.

Usage

import_genomic_data(file, which = NULL, n_bins = 2000L, verbose = FALSE)

Arguments

file

Path to the genomic data file

which

GRanges object specifying the genomic region to import (default: NULL, import all)

n_bins

Number of bins used for megadepth BigWig queries. Only used for BigWig inputs when which is provided. Default: 2000.

verbose

Logical. If TRUE, print megadepth progress output for BigWig imports. If FALSE (default), suppress routine messages.

format

File format (default: NULL, auto-detected from file extension)

Value

A tidy data frame

Examples

if (FALSE) { # \dontrun{
# Import a BED file
peaks_df <- import_genomic_data("peaks.bed")

# Import a specific region from a bigWig file
library(GenomicRanges)
region <- GRanges("chr1", IRanges(1000000, 2000000))
signal_df <- import_genomic_data("signal.bw", which = region)
} # }