Previous changeset 15:194e3f2c1d86 (2019-07-09) Next changeset 17:2605cbdaa7d8 (2023-12-15) |
Commit message:
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/diffbind commit 77828512472bf9815bdda725a58a2321f7803661" |
modified:
diffbind.R diffbind.xml |
b |
diff -r 194e3f2c1d86 -r 163688bb8f73 diffbind.R --- a/diffbind.R Tue Jul 09 18:46:09 2019 -0400 +++ b/diffbind.R Wed Nov 18 12:54:07 2020 +0000 |
[ |
b'@@ -1,12 +1,14 @@\n ## Setup R error handling to go to stderr\n-options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )\n+options(show.error.messages = F, error = function() {\n+ cat(geterrmessage(), file = stderr()); q("no", 1, F)\n+})\n # we need that to not crash galaxy with an UTF8 error on German LC settings.\n Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")\n \n suppressPackageStartupMessages({\n- library(\'getopt\')\n- library(\'DiffBind\')\n- library(\'rjson\')\n+ library("getopt")\n+ library("DiffBind")\n+ library("rjson")\n })\n \n options(stringAsfactors = FALSE, useFancyQuotes = FALSE)\n@@ -14,128 +16,128 @@\n \n #get options, using the spec as defined by the enclosed list.\n #we read the options from the default: commandArgs(TRUE).\n-spec = matrix(c(\n- \'infile\' , \'i\', 1, "character",\n- \'outfile\' , \'o\', 1, "character",\n- \'scorecol\', \'n\', 1, "integer",\n- \'lowerbetter\', \'l\', 1, "logical",\n- \'summits\', \'s\', 1, "integer",\n- \'th\', \'t\', 1, "double",\n- \'format\', \'f\', 1, "character",\n- \'plots\' , \'p\', 2, "character",\n- \'bmatrix\', \'b\', 0, "logical",\n+spec <- matrix(c(\n+ "infile", "i", 1, "character",\n+ "outfile", "o", 1, "character",\n+ "scorecol", "n", 1, "integer",\n+ "lowerbetter", "l", 1, "logical",\n+ "summits", "s", 1, "integer",\n+ "th", "t", 1, "double",\n+ "format", "f", 1, "character",\n+ "plots", "p", 2, "character",\n+ "bmatrix", "b", 0, "logical",\n "rdaOpt", "r", 0, "logical",\n- \'infoOpt\' , \'a\', 0, "logical",\n- \'verbose\', \'v\', 2, "integer",\n- \'help\' , \'h\', 0, "logical"\n-), byrow=TRUE, ncol=4);\n+ "infoOpt", "a", 0, "logical",\n+ "verbose", "v", 2, "integer",\n+ "help", "h", 0, "logical"\n+), byrow = TRUE, ncol = 4);\n \n-opt = getopt(spec);\n+opt <- getopt(spec);\n \n # if help was asked for print a friendly message\n # and exit with a non-zero error code\n-if ( !is.null(opt$help) ) {\n- cat(getopt(spec, usage=TRUE));\n- q(status=1);\n+if (!is.null(opt$help)) {\n+ cat(getopt(spec, usage = TRUE));\n+ q(status = 1);\n }\n \n parser <- newJSONParser()\n parser$addData(opt$infile)\n-factorList <- parser$getObject()\n-filenamesIn <- unname(unlist(factorList[[1]][[2]]))\n-peaks <- filenamesIn[grepl("peaks.bed", filenamesIn)]\n-bams <- filenamesIn[grepl("bamreads.bam", filenamesIn)]\n-ctrls <- filenamesIn[grepl("bamcontrol.bam", filenamesIn)]\n+factor_list <- parser$getObject()\n+filenames_in <- unname(unlist(factor_list[[1]][[2]]))\n+peaks <- filenames_in[grepl("peaks.bed", filenames_in)]\n+bams <- filenames_in[grepl("bamreads.bam", filenames_in)]\n+ctrls <- filenames_in[grepl("bamcontrol.bam", filenames_in)]\n \n # get the group and sample id from the peaks filenames\n-groups <- sapply(strsplit(peaks,"-"), `[`, 1)\n-samples <- sapply(strsplit(peaks,"-"), `[`, 2)\n+groups <- sapply(strsplit(peaks, "-"), `[`, 1)\n+samples <- sapply(strsplit(peaks, "-"), `[`, 2)\n \n-if ( length(ctrls) != 0 ) {\n- sampleTable <- data.frame(SampleID=samples,\n- Condition=groups,\n- bamReads=bams,\n- bamControl=ctrls,\n- Peaks=peaks,\n- Tissue=samples) # using "Tissue" column to display ids as labels in PCA plot\n+if (length(ctrls) != 0) {\n+ sample_table <- data.frame(SampleID = samples,\n+ Condition = groups,\n+ bamReads = bams,\n+ bamControl = ctrls,\n+ Peaks = peaks,\n+ Tissue = samples) # using "Tissue" column to display ids as labels in PCA plot\n } else {\n \n- sampleTable <- data.frame(SampleID=samples,\n- Replicate=samples,\n- Condition=groups,\n- bamReads=bams,\n- Peaks=peaks,\n- Tissue=samples)\n+ sample_table <- data.frame(SampleID = samples,\n+ Replicate = samples,\n+ '..b'/89341/)\n if (opt$format == "bed") {\n- resSorted <- data.frame(Chrom=seqnames(resSorted),\n- Start=start(resSorted) - 1,\n- End=end(resSorted),\n- Name=rep("DiffBind", length(resSorted)),\n- Score=rep("0", length(resSorted)),\n- Strand=gsub("\\\\*", ".", strand(resSorted)))\n+ res_sorted <- data.frame(Chrom = seqnames(res_sorted),\n+ Start = start(res_sorted) - 1,\n+ End = end(res_sorted),\n+ Name = rep("DiffBind", length(res_sorted)),\n+ Score = rep("0", length(res_sorted)),\n+ Strand = gsub("\\\\*", ".", strand(res_sorted)))\n } else if (opt$format == "interval") {\n # Output as interval\n- df <- as.data.frame(resSorted)\n+ df <- as.data.frame(res_sorted)\n extrainfo <- NULL\n- for (i in 1:nrow(df)) {\n- extrainfo[i] <- paste0(c(df$width[i], df[i, 6:ncol(df)]), collapse="|")\n+ for (i in seq_len(nrow(df))) {\n+ extrainfo[i] <- paste0(c(df$width[i], df[i, 6:ncol(df)]), collapse = "|")\n }\n- resSorted <- data.frame(Chrom=seqnames(resSorted),\n- Start=start(resSorted) - 1,\n- End=end(resSorted),\n- Name=rep("DiffBind", length(resSorted)),\n- Score=rep("0", length(resSorted)),\n- Strand=gsub("\\\\*", ".", strand(resSorted)),\n- Comment=extrainfo)\n+ res_sorted <- data.frame(Chrom = seqnames(res_sorted),\n+ Start = start(res_sorted) - 1,\n+ End = end(res_sorted),\n+ Name = rep("DiffBind", length(res_sorted)),\n+ Score = rep("0", length(res_sorted)),\n+ Strand = gsub("\\\\*", ".", strand(res_sorted)),\n+ Comment = extrainfo)\n } else {\n # Output as 0-based tabular\n- resSorted <- data.frame(Chrom=seqnames(resSorted),\n- Start=start(resSorted) - 1,\n- End=end(resSorted),\n- Name=rep("DiffBind", length(resSorted)),\n- Score=rep("0", length(resSorted)),\n- Strand=gsub("\\\\*", ".", strand(resSorted)),\n- mcols(resSorted))\n+ res_sorted <- data.frame(Chrom = seqnames(res_sorted),\n+ Start = start(res_sorted) - 1,\n+ End = end(res_sorted),\n+ Name = rep("DiffBind", length(res_sorted)),\n+ Score = rep("0", length(res_sorted)),\n+ Strand = gsub("\\\\*", ".", strand(res_sorted)),\n+ mcols(res_sorted))\n }\n-write.table(resSorted, file = opt$outfile, sep="\\t", quote = FALSE, row.names = FALSE)\n+write.table(res_sorted, file = opt$outfile, sep = "\\t", quote = FALSE, row.names = FALSE)\n \n # Output binding affinity scores\n if (!is.null(opt$bmatrix)) {\n- bmat <- dba.peakset(sample_count, bRetrieve=TRUE, DataType=DBA_DATA_FRAME)\n+ bmat <- dba.peakset(sample_count, bRetrieve = TRUE, DataType = DBA_DATA_FRAME)\n # Output as 0-based tabular\n- bmat <- data.frame(Chrom=bmat[, 1],\n- Start=bmat[, 2] - 1,\n- End=bmat[, 3],\n+ bmat <- data.frame(Chrom = bmat[, 1],\n+ Start = bmat[, 2] - 1,\n+ End = bmat[, 3],\n bmat[, 4:ncol(bmat)])\n- write.table(bmat, file="bmatrix.tab", sep="\\t", quote=FALSE, row.names=FALSE)\n+ write.table(bmat, file = "bmatrix.tab", sep = "\\t", quote = FALSE, row.names = FALSE)\n }\n \n # Output RData file\n@@ -146,10 +148,10 @@\n # Output analysis info\n if (!is.null(opt$infoOpt)) {\n info <- "DiffBind_analysis_info.txt"\n- cat("dba.count Info\\n\\n", file=info, append = TRUE)\n- capture.output(sample, file=info, append=TRUE)\n- cat("\\ndba.analyze Info\\n\\n", file=info, append = TRUE)\n- capture.output(sample_analyze, file=info, append=TRUE)\n- cat("\\nSessionInfo\\n\\n", file=info, append = TRUE)\n- capture.output(sessionInfo(), file=info, append=TRUE)\n-}\n\\ No newline at end of file\n+ cat("dba.count Info\\n\\n", file = info, append = TRUE)\n+ capture.output(sample, file = info, append = TRUE)\n+ cat("\\ndba.analyze Info\\n\\n", file = info, append = TRUE)\n+ capture.output(sample_analyze, file = info, append = TRUE)\n+ cat("\\nSessionInfo\\n\\n", file = info, append = TRUE)\n+ capture.output(sessionInfo(), file = info, append = TRUE)\n+}\n' |
b |
diff -r 194e3f2c1d86 -r 163688bb8f73 diffbind.xml --- a/diffbind.xml Tue Jul 09 18:46:09 2019 -0400 +++ b/diffbind.xml Wed Nov 18 12:54:07 2020 +0000 |
b |
@@ -1,7 +1,8 @@ -<tool id="diffbind" name="DiffBind" version="2.10.0"> +<tool id="diffbind" name="DiffBind" version="2.10.0+galaxy0"> <description> differential binding analysis of ChIP-Seq peak data</description> <requirements> <requirement type="package" version="2.10.0">bioconductor-diffbind</requirement> + <requirement type="package" version="3.5.1">r-base</requirement> <requirement type="package" version="1.20.3">r-getopt</requirement> <requirement type="package" version="0.2.20">r-rjson</requirement> </requirements> |