comparison diffbind.R @ 10:d7725c5596ab draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/diffbind commit f970dcbe9d0e4c3714b1db74c404ea34223cf8ed
author iuc
date Tue, 20 Mar 2018 04:51:25 -0400
parents 6171163112de
children 4c7ab9995f9e
comparison
equal deleted inserted replaced
9:6171163112de 10:d7725c5596ab
19 'outfile' , 'o', 1, "character", 19 'outfile' , 'o', 1, "character",
20 'plots' , 'p', 2, "character", 20 'plots' , 'p', 2, "character",
21 'infile' , 'i', 1, "character", 21 'infile' , 'i', 1, "character",
22 'format', 'f', 1, "character", 22 'format', 'f', 1, "character",
23 'th', 't', 1, "double", 23 'th', 't', 1, "double",
24 'bmatrix', 'b', 0, "logical" 24 'bmatrix', 'b', 0, "logical",
25 "rdaOpt", "r", 0, "logical"
25 ), byrow=TRUE, ncol=4); 26 ), byrow=TRUE, ncol=4);
26 27
27 opt = getopt(spec); 28 opt = getopt(spec);
28 29
29 # if help was asked for print a friendly message 30 # if help was asked for print a friendly message
41 sample_count = dba.count(sample) 42 sample_count = dba.count(sample)
42 sample_contrast = dba.contrast(sample_count, categories=DBA_CONDITION, minMembers=2) 43 sample_contrast = dba.contrast(sample_count, categories=DBA_CONDITION, minMembers=2)
43 sample_analyze = dba.analyze(sample_contrast) 44 sample_analyze = dba.analyze(sample_contrast)
44 diff_bind = dba.report(sample_analyze) 45 diff_bind = dba.report(sample_analyze)
45 orvals = dba.plotHeatmap(sample_analyze, contrast=1, correlations=FALSE) 46 orvals = dba.plotHeatmap(sample_analyze, contrast=1, correlations=FALSE)
47 dev.off()
46 48
47 resSorted <- diff_bind[order(diff_bind$FDR),] 49 resSorted <- diff_bind[order(diff_bind$FDR),]
48 write.table(as.data.frame(resSorted), file = opt$outfile, sep="\t", quote = FALSE, append=TRUE, row.names = FALSE, col.names = FALSE) 50 write.table(as.data.frame(resSorted), file = opt$outfile, sep="\t", quote = FALSE, append=TRUE, row.names = FALSE, col.names = FALSE)
49 51
50 # Output binding affinity scores 52 # Output binding affinity scores
51 if (!is.null(opt$bmatrix)) { 53 if (!is.null(opt$bmatrix)) {
52 bmat <- dba.peakset(sample_count, bRetrieve=TRUE, DataType=DBA_DATA_FRAME) 54 bmat <- dba.peakset(sample_count, bRetrieve=TRUE, DataType=DBA_DATA_FRAME)
53 write.table(as.data.frame(bmat), file="bmatrix.tab", sep="\t", quote=FALSE, row.names=FALSE, col.names=FALSE) 55 write.table(as.data.frame(bmat), file="bmatrix.tab", sep="\t", quote=FALSE, row.names=FALSE, col.names=FALSE)
54 } 56 }
55 57
56 dev.off() 58 ## Output RData file
59
60 if (!is.null(opt$rdaOpt)) {
61 save.image(file = "DiffBind_analysis.RData")
62 }
63
57 sessionInfo() 64 sessionInfo()