Previous changeset 7:67c29afac85f (2019-03-17) Next changeset 9:ef2ad746b589 (2021-06-06) |
Commit message:
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/goseq commit 8e19f8bcaea6f607a1eaa14bb88f2d625ed63df0" |
modified:
goseq.r goseq.xml |
b |
diff -r 67c29afac85f -r 8b3e3657034e goseq.r --- a/goseq.r Sun Mar 17 10:27:17 2019 -0400 +++ b/goseq.r Fri Sep 06 07:50:46 2019 -0400 |
[ |
b'@@ -10,47 +10,32 @@\n library("ggplot2")\n })\n \n+sessionInfo()\n+\n option_list <- list(\n make_option(c("-d", "--dge_file"), type="character", help="Path to file with differential gene expression result"),\n- make_option(c("-w","--wallenius_tab"), type="character", help="Path to output file with P-values estimated using wallenius distribution."),\n- make_option(c("-s","--sampling_tab"), type="character", default=FALSE, help="Path to output file with P-values estimated using sampling distribution."),\n- make_option(c("-n","--nobias_tab"), type="character", default=FALSE, help="Path to output file with P-values estimated using hypergeometric distribution and no correction for gene length bias."),\n- make_option(c("-l","--length_bias_plot"), type="character", default=FALSE, help="Path to length-bias plot."),\n- make_option(c("-sw","--sample_vs_wallenius_plot"), type="character", default=FALSE, help="Path to plot comparing sampling with wallenius p-values."),\n- make_option(c("-r", "--repcnt"), type="integer", default=100, help="Number of repeats for sampling"),\n- make_option(c("-lf", "--length_file"), type="character", default="FALSE", help = "Path to tabular file mapping gene id to length"),\n- make_option(c("-cat_file", "--category_file"), default="FALSE", type="character", help = "Path to tabular file with gene_id <-> category mapping."),\n- make_option(c("-g", "--genome"), default=NULL, type="character", help = "Genome [used for looking up correct gene length]"),\n- make_option(c("-i", "--gene_id"), default=NULL, type="character", help = "Gene ID format of genes in DGE file"),\n- make_option(c("-p", "--p_adj_method"), default="BH", type="character", help="Multiple hypothesis testing correction method to use"),\n- make_option(c("-cat", "--use_genes_without_cat"), default=FALSE, type="logical",\n- help="A large number of gene may have no GO term annotated. If this option is set to FALSE, genes without category will be ignored in the calculation of p-values(default behaviour). If TRUE these genes will count towards the total number of genes outside the tested category (default behaviour prior to version 1.15.2)."),\n- make_option(c("-plots", "--make_plots"), default=FALSE, type="logical", help="produce diagnostic plots?"),\n- make_option(c("-fc", "--fetch_cats"), default=NULL, type="character", help="Categories to get can include one or more of GO:CC, GO:BP, GO:MF, KEGG"),\n- make_option(c("-rd", "--rdata"), default=NULL, type="character", help="Path to RData output file."),\n- make_option(c("-tp", "--top_plot"), default=NULL, type="logical", help="Output PDF with top10 over-rep GO terms?")\n+ make_option(c("-lf", "--length_file"), type="character", default=NULL, help="Path to tabular file mapping gene id to length"),\n+ make_option(c("-g", "--genome"), type="character", default=NULL, help="Genome [used for looking up correct gene length]"),\n+ make_option(c("-i", "--gene_id"), type="character", default=NULL, help="Gene ID format of genes in DGE file"),\n+ make_option(c("-fc", "--fetch_cats"), type="character", default=NULL, help="Categories to get can include one or more of GO:CC, GO:BP, GO:MF, KEGG"),\n+ make_option(c("-cat_file", "--category_file"), type="character", default=NULL, help="Path to tabular file with gene_id <-> category mapping"),\n+ make_option(c("-w","--wallenius_tab"), type="character", default=NULL, help="Path to output file with P-values estimated using wallenius distribution"),\n+ make_option(c("-n","--nobias_tab"), type="character", default=NULL, help="Path to output file with P-values estimated using hypergeometric distribution and no correction for gene length bias"),\n+ make_option(c("-r", "--repcnt"), type="integer", default=0, help="Number of repeats for sampling"),\n+ make_option(c("-s","--sampling_tab"), type="character", default=NULL, help="Path to output file with P-values estimated using sampling distribution"),\n+ make_optio'..b'etric\']] <- GO.nobias\n-}\n+if (!is.null(args$nobias_tab)) results[[\'Hypergeometric\']] <- runGoseq(\n+ pwf,\n+ genome=args$genome,\n+ gene_id=args$gene_id,\n+ goseq_method="Hypergeometric",\n+ use_genes_without_cat=args$use_genes_without_cat,\n+ repcnt=args$repcnt,\n+ gene2cat=go_map,\n+ p_adj_method=args$p_adj_method,\n+ out_fp=args$nobias_tab)\n \n # Sampling distribution\n-if (repcnt > 0) {\n-\n- # capture the sampling progress so it doesn\'t fill stdout \n- zz <- file("/dev/null", open = "wt")\n- sink(zz)\n- GO.samp=goseq(pwf, genome = genome, id = gene_id, method="Sampling", repcnt=repcnt, use_genes_without_cat = use_genes_without_cat, gene2cat=go_map)\n- sink()\n+if (args$repcnt > 0){\n+ results[[\'Sampling\']] <- runGoseq(\n+ pwf,\n+ genome=args$genome,\n+ gene_id=args$gene_id,\n+ goseq_method="Sampling",\n+ use_genes_without_cat=args$use_genes_without_cat,\n+ repcnt=args$repcnt,\n+ gene2cat=go_map,\n+ p_adj_method=args$p_adj_method,\n+ out_fp=args$sampling_tab)\n \n- GO.samp$p.adjust.over_represented = p.adjust(GO.samp$over_represented_pvalue, method=p_adj_method)\n- GO.samp$p.adjust.under_represented = p.adjust(GO.samp$under_represented_pvalue, method=p_adj_method)\n- write.table(GO.samp, sampling_tab, sep="\\t", row.names = FALSE, quote = FALSE)\n # Compare sampling with wallenius\n- if (make_plots == TRUE) {\n- pdf(sample_vs_wallenius_plot)\n- plot(log10(GO.wall[,2]), log10(GO.samp[match(GO.samp[,1],GO.wall[,1]),2]),\n- xlab="log10(Wallenius p-values)",ylab="log10(Sampling p-values)",\n- xlim=c(-3,0))\n- abline(0,1,col=3,lty=2)\n- dev.off()\n+ if (args$make_plots & !is.null(args$wallenius_tab)) {\n+ pdf(args$sample_vs_wallenius_plot)\n+ plot(log10(results[[\'Wallenius\']][,2]), \n+ log10(results[[\'Sampling\']][match(results[[\'Sampling\']][,1], results[[\'Wallenius\']][,1]), 2]),\n+ xlab="log10(Wallenius p-values)",\n+ ylab="log10(Sampling p-values)",\n+ xlim=c(-3,0))\n+ abline(0,1,col=3,lty=2)\n+ dev.off()\n }\n- results[[\'Sampling\']] <- GO.samp\n }\n \n+# Plot the top 10\n if (!is.null(args$top_plot)) {\n cats_title <- gsub("GO:","", args$fetch_cats)\n # modified from https://bioinformatics-core-shared-training.github.io/cruk-summer-school-2018/RNASeq2018/html/06_Gene_set_testing.nb.html\n- pdf("top10.pdf")\n+ pdf(args$top_plot)\n for (m in names(results)) {\n p <- results[[m]] %>%\n top_n(10, wt=-over_represented_pvalue) %>%\n@@ -165,16 +164,35 @@\n geom_point() +\n expand_limits(x=0) +\n labs(x="% DE in category", y="Category", colour="Adj P value", size="Count", title=paste("Top over-represented categories in", cats_title), subtitle=paste(m, " method")) +\n- theme(plot.title = element_text(hjust = 0.5), plot.subtitle = element_text(hjust = 0.5))\n+ theme(plot.title=element_text(hjust = 0.5), plot.subtitle=element_text(hjust = 0.5))\n print(p)\n }\n dev.off()\n }\n \n+# Extract the genes to the categories (GO/KEGG terms)\n+if (!is.null(args$categories_genes_out_fp)) {\n+ cat2gene = split(rep(names(go_map), sapply(go_map, length)), unlist(go_map, use.names = FALSE))\n+ # extract categories (GO/KEGG terms) for all results\n+ categories = c()\n+ for (m in names(results)) {\n+ categories = c(categories, results[[m]]$category)\n+ }\n+ categories = unique(categories)\n+ # extract the DE genes for each catge term\n+ categories_genes = data.frame(Categories=categories, DEgenes=rep(\'\', length(categories)))\n+ categories_genes$DEgenes = as.character(categories_genes$DEgenes)\n+ rownames(categories_genes) = categories\n+ for (cat in categories){\n+ tmp = pwf[cat2gene[[cat]],]\n+ tmp = rownames(tmp[tmp$DEgenes > 0, ])\n+ categories_genes[cat, \'DEgenes\'] = paste(tmp, collapse=\',\')\n+ }\n+ # output\n+ write.table(categories_genes, args$categories_genes_out_fp, sep = "\\t", row.names=FALSE, quote=FALSE)\n+}\n+\n # Output RData file\n if (!is.null(args$rdata)) {\n- save.image(file = "goseq_analysis.RData")\n+ save.image(file=args$rdata)\n }\n-\n-\n-sessionInfo()\n' |
b |
diff -r 67c29afac85f -r 8b3e3657034e goseq.xml --- a/goseq.xml Sun Mar 17 10:27:17 2019 -0400 +++ b/goseq.xml Fri Sep 06 07:50:46 2019 -0400 |
[ |
b'@@ -1,14 +1,18 @@\n-<tool id="goseq" name="goseq" version="1.34.0+galaxy1">\n+<tool id="goseq" name="goseq" version="@VERSION@+@GALAXY_VERSION@">\n <description>tests for overrepresented gene categories</description>\n+ <macros>\n+ <token name="@VERSION@">1.36.0</token>\n+ <token name="@GALAXY_VERSION@">galaxy0</token>\n+ </macros>\n <requirements>\n- <requirement type="package" version="1.34.0">bioconductor-goseq</requirement>\n- <requirement type="package" version="3.7.0">bioconductor-org.hs.eg.db</requirement>\n- <requirement type="package" version="3.7.0">bioconductor-org.dm.eg.db</requirement>\n- <requirement type="package" version="3.7.0">bioconductor-org.dr.eg.db</requirement>\n- <requirement type="package" version="3.7.0">bioconductor-org.mm.eg.db</requirement>\n- <requirement type="package" version="0.7.8">r-dplyr</requirement>\n- <requirement type="package" version="3.1.0">r-ggplot2</requirement>\n- <requirement type="package" version="1.6.0">r-optparse</requirement>\n+ <requirement type="package" version="@VERSION@">bioconductor-goseq</requirement>\n+ <requirement type="package" version="3.8.2">bioconductor-org.hs.eg.db</requirement>\n+ <requirement type="package" version="3.8.2">bioconductor-org.dm.eg.db</requirement>\n+ <requirement type="package" version="3.8.2">bioconductor-org.dr.eg.db</requirement>\n+ <requirement type="package" version="3.8.2">bioconductor-org.mm.eg.db</requirement>\n+ <requirement type="package" version="0.8.3">r-dplyr</requirement>\n+ <requirement type="package" version="3.2.1">r-ggplot2</requirement>\n+ <requirement type="package" version="1.6.2">r-optparse</requirement>\n </requirements>\n <stdio>\n <regex match="Execution halted"\n@@ -30,42 +34,54 @@\n <command><![CDATA[\n Rscript \'$__tool_directory__/goseq.r\'\n \n---dge_file \'$dge_file\'\n---length_file \'$length_file\'\n+ --dge_file \'$dge_file\'\n+ --length_file \'$length_file\'\n \n-#if $categorySource.catSource == \'getgo\':\n+#if $categorySource.catSource == \'getgo\'\n --genome $categorySource.genome\n --gene_id $categorySource.gene_id\n --fetch_cats \'$categorySource.fetchcats\'\n-#elif $categorySource.catSource == \'history\':\n+#elif $categorySource.catSource == \'history\'\n --category_file \'$categorySource.category_file\'\n #end if\n \n-#if $methods[\'wallenius\']:\n+#if $methods.wallenius\n --wallenius_tab \'$wallenius_tab\'\n #end if\n-#if $methods[\'hypergeometric\']:\n+#if $methods.hypergeometric\n --nobias_tab \'$nobias_tab\'\n #end if\n---repcnt \'$methods.repcnt\'\n---sampling_tab \'$sampling_tab\'\n \n---make_plots \'$out.make_plots\'\n---length_bias_plot \'$length_bias_plot\'\n---sample_vs_wallenius_plot \'$sample_vs_wallenius_plot\'\n+ --repcnt $methods.repcnt\n+#if $methods.repcnt != 0\n+ --sampling_tab \'$sampling_tab\'\n+#end if\n \n---rdata \'$out.rdata_out\'\n---p_adj_method \'$adv.p_adj_method\'\n---use_genes_without_cat \'$adv.use_genes_without_cat\'\n+ --p_adj_method \'$adv.p_adj_method\'\n+ --use_genes_without_cat \'$adv.use_genes_without_cat\'\n \n-#if $out.topgo_plot:\n- --top_plot \'$out.topgo_plot\'\n+#if $out.topgo_plot\n+ --top_plot \'$top_plot\'\n #end if\n \n- ]]></command>\n+#if str($out.make_plots) == \'TRUE\'\n+ --make_plots \'$out.make_plots\'\n+ --length_bias_plot \'$length_bias_plot\'\n+ #if $methods.repcnt != 0 and $methods.wallenius\n+ --sample_vs_wallenius_plot \'$sample_vs_wallenius_plot\'\n+ #end if\n+#end if\n \n- <!-- Input Files-->\n+#if $out.cat_genes\n+ --categories_genes_out_fp \'$cat_genes_tab\'\n+#end if\n+\n+#if $out.rdata_out\n+ --rdata \'$rdata\'\n+#end if\n+ ]]></command>\n <inputs>\n+ <!-- Input Files-->\n <param name="dge_file" type="data" format="tabular" label="Differentially expressed genes file" help="A tabular file with Gene IDs in the first column, and True or False in the second column. True means a gene is differentially expressed. See Help section for details."/>\n '..b'value="history" />\n+ <param name="category_file" value="category.tab" ftype="tabular" />\n+ </conditional>\n+ <section name="methods">\n+ <param name="wallenius" value="true"/>\n+ <param name="hypergeometric" value="false"/>\n+ <param name="repcnt" value="1000"/>\n+ </section>\n+ <section name="adv">\n+ <param name="p_adj_method" value="BH"/>\n+ <param name="use_genes_without_cat" value="true" />\n+ </section>\n+ <section name="out">\n+ <param name="topgo_plot" value="false"/>\n+ <param name="make_plots" value="true"/>\n+ <param name="cat_genes" value="false"/>\n+ <param name="rdata_out" value="false"/>\n+ </section>\n <output name="sampling_tab" file="samp.tab" compare="sim_size" />\n <output name="length_bias_plot" ftype="pdf" file="length_bias_plot.pdf" compare="sim_size" />\n <output name="sample_vs_wallenius_plot" ftype="pdf" file="sample_vs_wallenius_plot.pdf" compare="sim_size" />\n@@ -244,14 +351,28 @@\n <test expect_num_outputs="2">\n <param name="dge_file" value="dge_list.tab" ftype="tabular" />\n <param name="length_file" value="gene_length.tab" ftype="tabular" />\n- <param name="catSource" value="history" />\n- <param name="category_file" value="category.tab" ftype="tabular" />\n- <param name="use_genes_without_cat" value="true" />\n- <param name="rdata_out" value="true" />\n+ <conditional name="categorySource">\n+ <param name="catSource" value="history" />\n+ <param name="category_file" value="category.tab" ftype="tabular" />\n+ </conditional>\n+ <section name="methods">\n+ <param name="wallenius" value="true"/>\n+ <param name="hypergeometric" value="false"/>\n+ <param name="repcnt" value="0"/>\n+ </section>\n+ <section name="adv">\n+ <param name="p_adj_method" value="BH"/>\n+ <param name="use_genes_without_cat" value="true" />\n+ </section>\n+ <section name="out">\n+ <param name="topgo_plot" value="false"/>\n+ <param name="make_plots" value="false"/>\n+ <param name="cat_genes" value="false"/>\n+ <param name="rdata_out" value="true"/>\n+ </section>\n <output name="rdata" file="goseq_analysis.RData" compare="sim_size" />\n </test>\n </tests>\n-\n <help><![CDATA[\n \n .. class:: infomark\n@@ -312,8 +433,7 @@\n \n **Outputs**\n \n-* This tool outputs a tabular file containing a ranked list of gene categories, similar to below. The default output is the Wallenius method table. If the Sampling and/or Hypergeometric methods are also selected, additional tables are produced.\n-* Optionally, this tool can also output a plot of the top 10 over-represented GO categories, some diagnostic plots and an RData file, see **Output Options** above.\n+This tool outputs a tabular file containing a ranked list of gene categories, similar to below. The default output is the Wallenius method table. If the Sampling and/or Hypergeometric methods are also selected, additional tables are produced.\n \n Example:\n \n@@ -328,6 +448,12 @@\n GO\\:0070062 0.000428 0.999808 43 108 extracellular exosome CC 0.394825 1\n =========== =============== ================ ============ ========== ======================================== ========== =================== ====================\n \n+Optionally, this tool can also output:\n+ * a plot of the top 10 over-represented GO categories\n+ * some diagnostic plots\n+ * a tabular with the differentially expressed genes in categories (GO/KEGG terms)\n+ * an RData file\n+\n -----\n \n **Method options**\n' |