Last active
August 29, 2015 14:09
-
-
Save rcquan/c5d7fc2199cbb88ad6b1 to your computer and use it in GitHub Desktop.
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
library(BiSeq) | |
readBedgraph <- function(inputDirectory, nSamples = 8) { | |
## get list of file names | |
fileNames <- list.files(path = inputDirectory, pattern = ".bedGraph") | |
## parse sample name from file name | |
sampleNames <- sapply(fileNames,function(fileName) { | |
gsub("_r123_R1_val_1.fq_bismark_bt2_pe.bedGraph", "", fileName) | |
}, USE.NAMES = FALSE) | |
## label samples | |
colData <- data.frame(group = rep(c("control", "cancer"), nSamples), row.names = sampleNames) | |
rawBSObj <- readBismark(fileNames, colData) | |
return(rawBSObj) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment