comparison diffbind.R @ 10:b1b96b6ed60c draft

Uploaded
author bgruening
date Thu, 16 Jan 2014 04:17:16 -0500
parents 20c431b4cf74
children a8dc71379df0
comparison
equal deleted inserted replaced
9:20c431b4cf74 10:b1b96b6ed60c
28 } 28 }
29 29
30 30
31 library('DiffBind') 31 library('DiffBind')
32 # used to save to BED, GFF or WIG format 32 # used to save to BED, GFF or WIG format
33 library('rtracklayer')
34 33
35 if ( !is.null(opt$plots) ) { 34 if ( !is.null(opt$plots) ) {
36 pdf(opt$plots) 35 pdf(opt$plots)
37 } 36 }
38 37
39 38
40 sample = dba(sampleSheet=opt$infile, peakFormat='bed') 39 sample = dba(sampleSheet=opt$infile, peakFormat='bed')
41 sample_count = dba.count(sample) 40 sample_count = dba.count(sample)
42 sample_contrast = dba.contrast(sample_count, categories=DBA_CONDITION) 41 sample_contrast = dba.contrast(sample_count, categories=DBA_CONDITION, minMembers=2)
43 sample_analyze = dba.analyze(sample_contrast) 42 sample_analyze = dba.analyze(sample_contrast)
44 diff_bind = dba.report(sample_analyze) 43 diff_bind = dba.report(sample_analyze)
44 orvals = dba.plotHeatmap(sample_analyze, contrast=1, correlations=FALSE)
45 45
46 resSorted <- diff_bind[order(diff_bind$FDR),]
47 write.table(as.data.frame(resSorted), file = opt$outfile, sep="\t", quote = FALSE, append=TRUE, row.names = FALSE, col.names = FALSE)
46 48
47 export(diff_bind, opt$outfile, format=opt$format)
48 49
49 dev.off() 50 dev.off()
50 sessionInfo() 51 sessionInfo()