Created
November 20, 2014 22:54
-
-
Save Jfortin1/394b68ef34f31f927eb8 to your computer and use it in GitHub Desktop.
Extract only a portion of a bigWig file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extract.portion <- function(file, chr, start, end, verbose = TRUE){ | |
rl <- IRanges::RangesList(IRanges::IRanges(start=start, end=end)) | |
names(rl) <- chr | |
portion <- import(file, as="Rle",format = "bw", selection = BigWigSelection(rl)) | |
portion <- portion[chr] | |
portion <- as.numeric(portion[[chr]]) | |
portion | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment