Previous changeset 8:8b3e3657034e (2019-09-06) Next changeset 10:43798b4caee0 (2022-06-09) |
Commit message:
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/goseq commit e230a8db9e090c6e0ea9577863ec6153df79e145" |
modified:
goseq.r goseq.xml test-data/nobias.tab test-data/samp.tab |
b |
diff -r 8b3e3657034e -r ef2ad746b589 goseq.r --- a/goseq.r Fri Sep 06 07:50:46 2019 -0400 +++ b/goseq.r Sun Jun 06 22:47:36 2021 +0000 |
[ |
b'@@ -1,170 +1,183 @@\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())\n+ q("no", 1, F)\n+})\n \n # we need that to not crash galaxy with an UTF8 error on German LC settings.\n loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")\n \n suppressPackageStartupMessages({\n- library("goseq")\n- library("optparse")\n- library("dplyr")\n- library("ggplot2")\n+ library("goseq")\n+ library("optparse")\n+ library("dplyr")\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("-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_option(c("-p", "--p_adj_method"), type="character", default="BH", help="Multiple hypothesis testing correction method to use"),\n- make_option(c("-cat", "--use_genes_without_cat"), type="logical", default=FALSE, 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("-tp", "--top_plot"), type="character", default=NULL, help="Path to output PDF with top10 over-rep GO terms"),\n- make_option(c("-plots", "--make_plots"), default=FALSE, type="logical", help="Produce diagnostic plots?"),\n- make_option(c("-l","--length_bias_plot"), type="character", default=NULL, help="Path to length-bias plot"),\n- make_option(c("-sw","--sample_vs_wallenius_plot"), type="character", default=NULL, help="Path to plot comparing sampling with wallenius p-values"),\n- make_option(c("-rd", "--rdata"), type="character", default=NULL, help="Path to RData output file"),\n- make_option(c("-g2g", "--categories_genes_out_fp"), type="character", default=NULL, help="Path to file with categories (GO/KEGG terms) and associated DE genes")\n- )\n+ make_option("--dge_file", type = "character", help = "Path to file with differential gene expression result"),\n+ make_option("--length_file", type = "character", default = NULL, help = "Path to tabular file mapping gene id to length"),\n+ make_option("--genome", type = "character", default = NULL, help = "Genome [used for looking up correct gene length]"),\n+ make_option("--gene_id", type = "character", default = NULL, help = "Gene ID format of genes in DGE file"),\n+ make_option("--fetch_cats", type = "character", default = NULL, help = "Categories to get can include one or more of GO:CC, GO:BP'..b' p-values)",\n- ylab="log10(Sampling p-values)",\n- xlim=c(-3,0))\n- abline(0,1,col=3,lty=2)\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+ )\n+ abline(0, 1, col = 3, lty = 2)\n dev.off()\n }\n }\n \n # Plot the top 10\n if (!is.null(args$top_plot)) {\n- cats_title <- gsub("GO:","", args$fetch_cats)\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(args$top_plot)\n for (m in names(results)) {\n p <- results[[m]] %>%\n- top_n(10, wt=-over_represented_pvalue) %>%\n- mutate(hitsPerc=numDEInCat*100/numInCat) %>%\n- ggplot(aes(x=hitsPerc,\n- y=reorder(substr(term, 1, 40), -over_represented_pvalue), # only use 1st 40 chars of terms otherwise squashes plot\n- colour=p.adjust.over_represented,\n- size=numDEInCat)) +\n+ top_n(10, wt = -over_represented_pvalue) %>%\n+ mutate(hitsPerc = numDEInCat * 100 / numInCat) %>%\n+ ggplot(aes(\n+ x = hitsPerc,\n+ y = reorder(substr(term, 1, 40), -over_represented_pvalue), # only use 1st 40 chars of terms otherwise squashes plot\n+ colour = p_adjust_over_represented,\n+ size = numDEInCat\n+ )) +\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+ 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 print(p)\n }\n dev.off()\n@@ -172,27 +185,27 @@\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+ 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+ categories <- c()\n for (m in names(results)) {\n- categories = c(categories, results[[m]]$category)\n+ categories <- c(categories, results[[m]]$category)\n }\n- categories = unique(categories)\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+ categories_genes <- data.frame(category = categories, de_genes = rep("", length(categories)))\n+ categories_genes$de_genes <- as.character(categories_genes$de_genes)\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, "de_genes"] <- paste(tmp, collapse = ",")\n }\n # output\n- write.table(categories_genes, args$categories_genes_out_fp, sep = "\\t", row.names=FALSE, quote=FALSE)\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=args$rdata)\n+ save.image(file = args$rdata)\n }\n' |
b |
diff -r 8b3e3657034e -r ef2ad746b589 goseq.xml --- a/goseq.xml Fri Sep 06 07:50:46 2019 -0400 +++ b/goseq.xml Sun Jun 06 22:47:36 2021 +0000 |
b |
@@ -1,18 +1,27 @@ <tool id="goseq" name="goseq" version="@VERSION@+@GALAXY_VERSION@"> <description>tests for overrepresented gene categories</description> + <xrefs> + <xref type="bio.tools">goseq</xref> + </xrefs> + <edam_topics> + <edam_topic>topic_3308</edam_topic> + </edam_topics> + <edam_operations> + <edam_operation>operation_2436</edam_operation> + </edam_operations> <macros> - <token name="@VERSION@">1.36.0</token> + <token name="@VERSION@">1.44.0</token> <token name="@GALAXY_VERSION@">galaxy0</token> </macros> <requirements> <requirement type="package" version="@VERSION@">bioconductor-goseq</requirement> - <requirement type="package" version="3.8.2">bioconductor-org.hs.eg.db</requirement> - <requirement type="package" version="3.8.2">bioconductor-org.dm.eg.db</requirement> - <requirement type="package" version="3.8.2">bioconductor-org.dr.eg.db</requirement> - <requirement type="package" version="3.8.2">bioconductor-org.mm.eg.db</requirement> - <requirement type="package" version="0.8.3">r-dplyr</requirement> - <requirement type="package" version="3.2.1">r-ggplot2</requirement> - <requirement type="package" version="1.6.2">r-optparse</requirement> + <requirement type="package" version="3.13.0">bioconductor-org.hs.eg.db</requirement> + <requirement type="package" version="3.13.0">bioconductor-org.dm.eg.db</requirement> + <requirement type="package" version="3.13.0">bioconductor-org.dr.eg.db</requirement> + <requirement type="package" version="3.13.0">bioconductor-org.mm.eg.db</requirement> + <requirement type="package" version="1.0.6">r-dplyr</requirement> + <requirement type="package" version="3.3.3">r-ggplot2</requirement> + <requirement type="package" version="1.6.6">r-optparse</requirement> </requirements> <stdio> <regex match="Execution halted" @@ -194,7 +203,7 @@ <output name="top_plot" ftype="pdf" file="topgo.pdf" compare="sim_size"/> <output name="wallenius_tab"> <assert_contents> - <has_text_matching expression="category.*over_represented_pvalue.*under_represented_pvalue.*numDEInCat.*numInCat.*term.*ontology.*p.adjust.over_represented.*p.adjust.under_represented" /> + <has_text_matching expression="category.*over_represented_pvalue.*under_represented_pvalue.*numDEInCat.*numInCat.*term.*ontology.*p_adjust_over_represented.*p_adjust_under_represented" /> <has_text_matching expression="GO:0000278.*0.01" /> </assert_contents> </output> @@ -226,13 +235,13 @@ </section> <output name="wallenius_tab"> <assert_contents> - <has_text_matching expression="category.*over_represented_pvalue.*under_represented_pvalue.*numDEInCat.*numInCat.*term.*ontology.*p.adjust.over_represented.*p.adjust.under_represented" /> - <has_text_matching expression="GO:0005576.*9.0" /> + <has_text_matching expression="category.*over_represented_pvalue.*under_represented_pvalue.*numDEInCat.*numInCat.*term.*ontology.*p_adjust_over_represented.*p_adjust_under_represented" /> + <has_text_matching expression="GO:0005576.*0.9" /> </assert_contents> </output> <output name="cat_genes_tab"> <assert_contents> - <has_text_matching expression="Categories.*DEgenes" /> + <has_text_matching expression="category.*de_genes" /> <has_text_matching expression="GO:0005615.*ENSG00000090402,ENSG00000108953,ENSG00000070961" /> </assert_contents> </output> @@ -264,8 +273,8 @@ </section> <output name="wallenius_tab"> <assert_contents> - <has_text_matching expression="category.*over_represented_pvalue.*under_represented_pvalue.*numDEInCat.*numInCat.*term.*ontology.*p.adjust.over_represented.*p.adjust.under_represented" /> - <has_text_matching expression="GO:0016569.*0.8" /> + <has_text_matching expression="category.*over_represented_pvalue.*under_represented_pvalue.*numDEInCat.*numInCat.*term.*ontology.*p_adjust_over_represented.*p_adjust_under_represented" /> + <has_text_matching expression="GO:0016569.*0.90" /> </assert_contents> </output> </test> @@ -438,7 +447,7 @@ Example: =========== =============== ================ ============ ========== ======================================== ========== =================== ==================== -*category* *over_rep_pval* *under_rep_pval* *numDEInCat* *numInCat* *term* *ontology* *p.adjust.over_rep* *p.adjust.under_rep* +*category* *over_rep_pval* *under_rep_pval* *numDEInCat* *numInCat* *term* *ontology* *p_adjust_over_rep* *p_adjust_under_rep* ----------- --------------- ---------------- ------------ ---------- ---------------------------------------- ---------- ------------------- -------------------- GO\:0005576 0.000054 0.999975 56 142 extracellular region CC 0.394825 1 GO\:0005840 0.000143 0.999988 9 12 ribosome CC 0.394825 1 |
b |
diff -r 8b3e3657034e -r ef2ad746b589 test-data/nobias.tab --- a/test-data/nobias.tab Fri Sep 06 07:50:46 2019 -0400 +++ b/test-data/nobias.tab Sun Jun 06 22:47:36 2021 +0000 |
b |
@@ -1,3 +1,3 @@ -category over_represented_pvalue under_represented_pvalue numDEInCat numInCat term ontology p.adjust.over_represented p.adjust.under_represented +category over_represented_pvalue under_represented_pvalue numDEInCat numInCat term ontology p_adjust_over_represented p_adjust_under_represented GO:0000278 0.0129827306163772 0.999244816412166 4 5 mitotic cell cycle BP 0.0259654612327543 0.999244816412166 GO:0000003 1 0.761 0 1 reproduction BP 1 0.999244816412166 |
b |
diff -r 8b3e3657034e -r ef2ad746b589 test-data/samp.tab --- a/test-data/samp.tab Fri Sep 06 07:50:46 2019 -0400 +++ b/test-data/samp.tab Sun Jun 06 22:47:36 2021 +0000 |
b |
@@ -1,3 +1,3 @@ -category over_represented_pvalue under_represented_pvalue numDEInCat numInCat term ontology p.adjust.over_represented p.adjust.under_represented +category over_represented_pvalue under_represented_pvalue numDEInCat numInCat term ontology p_adjust_over_represented p_adjust_under_represented GO:0000278 0.016983016983017 1 4 5 mitotic cell cycle BP 0.033966033966034 1 GO:0000003 1 0.802197802197802 0 1 reproduction BP 1 1 |