Skip to content

Instantly share code, notes, and snippets.

@aaronwolen
Created November 20, 2012 17:08
Show Gist options
  • Save aaronwolen/4119307 to your computer and use it in GitHub Desktop.
Save aaronwolen/4119307 to your computer and use it in GitHub Desktop.
Example: loading data from a bigWig file
library(IRanges)
library(GenomicRanges)
library(rtracklayer)
# Select a BigWig file
bw.dir <- "/home/chromatin/roadmap/DNase_hypersensitivity/brain_fetal"
bw.file <- dir(bw.dir, full.names = TRUE, pattern = "*.bigWig")[1]
# Specify a genomic range
selection <- GRanges(seqnames = "chr4",
ranges = IRanges(start = 46251581, end = 46392421))
# Extract BigWig data
bw.data <- import.bw(con = BigWigFile(bw.file),
selection = BigWigSelection(selection))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment