Skip to content

Instantly share code, notes, and snippets.

@ATpoint
Last active February 25, 2020 11:01
Show Gist options
  • Save ATpoint/8353a000aad57baa94aba255e38edd0e to your computer and use it in GitHub Desktop.
Save ATpoint/8353a000aad57baa94aba255e38edd0e to your computer and use it in GitHub Desktop.
##
library(rtracklayer)
## Use rtracklayer to import a subset of a bigwig file from disk into R.
## reference.gr is a GRanges object with the ranges that will be used for subsetting
## selected.gr is a GRanges object with the count data for each interval stored in elementMetadata(selected.gr)
selected.gr <- rtracklayer::import(Path.To.BigWig, format = "BigWig", selection = BigWigSelection(reference.gr))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment