Last active
February 21, 2017 07:54
-
-
Save endrebak/19c09dcde0d8f5691f3ad6518bc59cc0 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
grouping <- c("A","A","B","B") | |
design<-model.matrix(~factor(grouping)) | |
############################################################# | |
### csaw, with its combined window methodology. | |
############################################################ | |
xparam <- readParam(dedup=FALSE) | |
if (is.tf) { | |
test.widths <- 10 | |
names <- c("csaw") | |
} else { | |
test.widths <- c(50, 150, 250) | |
names <- c("csaw.short", "csaw", "csaw.long") | |
} | |
for (w in seq_along(test.widths)) { | |
data <- windowCounts(bam.files, width=test.widths[w], ext=fraglen, param=xparam, filter=20) | |
binned <- windowCounts(bam.files, width=2000, bin=TRUE, param=xparam) | |
bin.ab <- scaledAverage(asDGEList(binned), scale=median(getWidths(binned))/median(getWidths(data))) | |
threshold <- median(bin.ab) + log2(2) | |
keep <- aveLogCPM(asDGEList(data)) > threshold | |
data <- data[keep,] | |
tabres <- analyzeQLCounts(assay(data), design, totals=data$totals) | |
merged <- mergeWindows(rowRanges(data), tol=100, max.width=5000) | |
tabneg <- combineTests(merged$id, tabres) | |
for (cutoff in fdr.thresholds) { | |
resultDump(merged$region, tabneg, cutoff, out=ofile) | |
result<-assessChIP(ofile, lfile, tol=NA, checkfc=FALSE) | |
dump2file(names[w], cutoff, result) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment