Repository 'proteore_goprofiles'
hg clone https://toolshed.g2.bx.psu.edu/repos/proteore/proteore_goprofiles

Changeset 15:601027649251 (2021-04-06)
Previous changeset 14:45b4ede6940e (2020-01-24)
Commit message:
"planemo upload commit 6bc2c32177acd823d5025bc90a562e6e6b2a233a"
modified:
goprofiles.R
goprofiles.xml
b
diff -r 45b4ede6940e -r 601027649251 goprofiles.R
--- a/goprofiles.R Fri Jan 24 05:10:14 2020 -0500
+++ b/goprofiles.R Tue Apr 06 16:59:30 2021 +0000
[
b'@@ -1,12 +1,14 @@\n-options(warn=-1)  #TURN OFF WARNINGS !!!!!!\n+options(warn = -1)  #TURN OFF WARNINGS !!!!!!\n \n # Load necessary libraries\n-suppressMessages(library(goProfiles,quietly = TRUE))\n+suppressMessages(library(goProfiles, quietly = TRUE))\n \n # Read file and return file content as data.frame\n-read_file <- function(path,header){\n-  file <- try(read.csv(path,header=header, sep="\\t",stringsAsFactors = FALSE, quote="\\"", check.names = F),silent=TRUE)\n-  if (inherits(file,"try-error")){\n+read_file <- function(path, header) {\n+  file <- try(read.csv(path, header = header,\n+    sep = "\\t", stringsAsFactors = FALSE,\n+      quote = "\\"", check.names = F), silent = TRUE)\n+  if (inherits(file, "try-error")) {\n     stop("File not found !")\n   }else{\n     return(file)\n@@ -14,27 +16,30 @@\n }\n \n #convert a string to boolean\n-str2bool <- function(x){\n-  if (any(is.element(c("t","true"),tolower(x)))){\n-    return (TRUE)\n-  }else if (any(is.element(c("f","false"),tolower(x)))){\n-    return (FALSE)\n+str2bool <- function(x) {\n+  if (any(is.element(c("t", "true"), tolower(x)))) {\n+    return(TRUE)\n+  }else if (any(is.element(c("f", "false"), tolower(x)))) {\n+    return(FALSE)\n   }else{\n     return(NULL)\n   }\n }\n \n-check_ids <- function(vector,type) {\n-  uniprot_pattern = "^([OPQ][0-9][A-Z0-9]{3}[0-9]|[A-NR-Z][0-9]([A-Z][A-Z0-9]{2}[0-9]){1,2})$"\n-  entrez_id = "^([0-9]+|[A-Z]{1,2}_[0-9]+|[A-Z]{1,2}_[A-Z]{1,4}[0-9]+)$"\n-  if (type == "Entrez"){\n-    return(grepl(entrez_id,vector))\n+check_ids <- function(vector, type) {\n+ # nolint start\n+  uniprot_pattern <-\n+    "^([OPQ][0-9][A-Z0-9]{3}[0-9]|[A-NR-Z][0-9]([A-Z][A-Z0-9]{2}[0-9]){1,2})$"\n+  entrez_id <- "^([0-9]+|[A-Z]{1,2}_[0-9]+|[A-Z]{1,2}_[A-Z]{1,4}[0-9]+)$"\n+  # nolint end\n+  if (type == "Entrez") {\n+    return(grepl(entrez_id, vector))\n   } else if (type == "UniProt") {\n-    return(grepl(uniprot_pattern,vector))\n+    return(grepl(uniprot_pattern, vector))\n   }\n }\n \n-getprofile = function(ids, id_type, level, duplicate,species) {\n+getprofile <- function(ids, id_type, level, duplicate, species) {\n   ####################################################################\n   # Arguments\n   #   - ids: list of input IDs\n@@ -43,89 +48,100 @@\n   #   - duplicate: if the duplicated IDs should be removed or not (TRUE/FALSE)\n   #   - species\n   ####################################################################\n-  \n+\n   library(species, character.only = TRUE, quietly = TRUE)\n-  \n-  if (species=="org.Hs.eg.db"){\n-    package=org.Hs.eg.db\n-  } else if (species=="org.Mm.eg.db"){\n-    package=org.Mm.eg.db\n-  } else if (species=="org.Rn.eg.db"){\n-    package=org.Rn.eg.db\n+\n+  if (species == "org.Hs.eg.db") {\n+    package <- org.Hs.eg.db #nolint\n+  } else if (species == "org.Mm.eg.db") {\n+    package <- org.Mm.eg.db #nolint\n+  } else if (species == "org.Rn.eg.db") {\n+    package <- org.Rn.eg.db #nolint\n   }\n-  \n+\n   # Check if level is number\n   if (! as.numeric(level) %% 1 == 0) {\n     stop("Please enter an integer for level")\n   } else {\n-    level = as.numeric(level)\n+    level <- as.numeric(level)\n   }\n-  #genes = as.vector(file[,ncol])\n-  \n+\n+\n   # Extract Gene Entrez ID\n   if (id_type == "Entrez") {\n-    id = select(package, ids, "ENTREZID", multiVals = "first")\n+    id <- select(package, ids, "ENTREZID", multiVals = "first") #nolint\n   } else {\n-    id = select(package, ids, "ENTREZID", "UNIPROT", multiVals = "first")\n+    id <- select(package, ids, "ENTREZID", "UNIPROT", multiVals = "first") #nolint\n+  }\n+  if (duplicate) {\n+    id <- unique(id)\n   }\n-  if (duplicate) { id = unique(id) }\n-  genes_ids = id$ENTREZID[which( ! is.na(id$ENTREZID))]\n-  NAs = id$UNIPROT[which(is.na(id$ENTREZID))] # IDs that have NA ENTREZID\n-  \n+  genes_ids <- id$ENTREZID[which(!is.na(id$ENTREZID))]\n+  nas <- id$UNIPROT[which(is.na(id$ENTREZID))] # IDs that have NA ENTREZID #nolint\n+\n   # Create basic profiles\n-  profile.CC = basicProfile(genes_ids, onto=\'CC\', level=level, orgPackage=species, empty.cats=F, ord=T, na.rm=T)'..b'      --text_output: text output filename \\n\n         --species")\n-    q(save="no")\n+    q(save = "no")\n   }\n-  \n+\n   # Parse arguments\n-  parseArgs <- function(x) strsplit(sub("^--", "", x), "=")\n-  argsDF <- as.data.frame(do.call("rbind", parseArgs(args)))\n-  args <- as.list(as.character(argsDF$V2))\n-  names(args) <- argsDF$V1\n+  parse_args <- function(x) strsplit(sub("^--", "", x), "=")\n+  args_df <- as.data.frame(do.call("rbind", parse_args(args)))\n+  args <- as.list(as.character(args_df$V2))\n+  names(args) <- args_df$V1\n \n-  #save(args,file="/home/dchristiany/proteore_project/ProteoRE/tools/goprofiles/args.Rda")\n-  #load("/home/dchristiany/proteore_project/ProteoRE/tools/goprofiles/args.Rda")\n-  \n-  id_type = args$id_type\n-  input_type = args$input_type\n+\n+  id_type <- args$id_type\n+  input_type <- args$input_type\n   if (input_type == "text") {\n-    input = unlist(strsplit(strsplit(args$input, "[ \\t\\n]+")[[1]],";"))\n+    input <- unlist(strsplit(strsplit(args$input, "[ \\t\\n]+")[[1]], ";"))\n   } else if (input_type == "file") {\n-    filename = args$input\n-    ncol = args$ncol\n+    filename <- args$input\n+    ncol <- args$ncol\n     # Check ncol\n     if (! as.numeric(gsub("c", "", ncol)) %% 1 == 0) {\n       stop("Please enter an integer for level")\n     } else {\n-      ncol = as.numeric(gsub("c", "", ncol))\n+      ncol <- as.numeric(gsub("c", "", ncol))\n     }\n-    header = str2bool(args$header)\n+    header <- str2bool(args$header)\n     # Get file content\n-    file = read_file(filename, header)\n+    file <- read_file(filename, header)\n     # Extract Protein IDs list\n-    input = unlist(strsplit(as.character(file[,ncol]),";"))\n+    input <- unlist(strsplit(as.character(file[, ncol]), ";"))\n   }\n-  input = input [which(!is.na(gsub("NA",NA,input)))]\n-  \n-  if (! any(check_ids(input,id_type))){\n-    stop(paste(id_type,"not found in your ids list, please check your IDs in input or the selected column of your input file"))\n+  input <- input [which(!is.na(gsub("NA", NA, input)))]\n+\n+  if (! any(check_ids(input, id_type))) {\n+    stop(paste(id_type,\n+    "not found in your ids list, please check your IDs in input\n+     or the selected column of your input file"))\n   }\n-  \n-  ontoopt = strsplit(args$onto_opt, ",")[[1]]\n-  onto_pos = as.integer(gsub("BP",3,gsub("MF",2,gsub("CC",1,ontoopt))))\n-  plotopt = args$plot_opt\n-  level = args$level\n-  per = as.logical(args$per)\n-  title = args$title\n-  duplicate = str2bool(args$duplicate)\n-  text_output = args$text_output\n-  species=args$species\n+\n+  ontoopt <- strsplit(args$onto_opt, ",")[[1]]\n+  onto_pos <- as.integer(gsub("BP", 3, gsub("MF", 2, gsub("CC", 1, ontoopt))))\n+  plotopt <- args$plot_opt\n+  level <- args$level\n+  per <- as.logical(args$per)\n+  title <- args$title\n+  duplicate <- str2bool(args$duplicate)\n+  text_output <- args$text_output\n+  species <- args$species\n \n-  profiles = getprofile(input, id_type, level, duplicate,species)\n-  \n+  profiles <- getprofile(input, id_type, level, duplicate, species)\n+\n   for (index in onto_pos) {\n-    onto = names(profiles[index])\n-    profile=profiles[index]\n-    make_plot(profile,per,title,onto,plotopt)\n-    text_output=paste("goProfiles_",onto,"_",title,".tsv",sep="",collapse="")\n-    profile = as.data.frame(profile)\n-    profile <- as.data.frame(apply(profile, c(1,2), function(x) gsub("^$|^ $", NA, x)))  #convert "" and " " to NA\n-    write.table(profile, text_output, sep="\\t", row.names = FALSE, quote=FALSE, col.names = T)\n+    onto <- names(profiles[index])\n+    profile <- profiles[index]\n+    make_plot(profile, per, title, onto, plotopt)\n+    text_output <- paste("goProfiles_", onto, "_",\n+            title, ".tsv", sep = "", collapse = "")\n+    profile <- as.data.frame(profile)\n+    profile <- as.data.frame(apply(profile, c(1, 2),\n+                function(x) gsub("^$|^ $", NA, x)))  #convert "" and " " to NA\n+    write.table(profile, text_output, sep = "\\t",\n+                row.names = FALSE, quote = FALSE, col.names = T)\n   }\n }\n \n'
b
diff -r 45b4ede6940e -r 601027649251 goprofiles.xml
--- a/goprofiles.xml Fri Jan 24 05:10:14 2020 -0500
+++ b/goprofiles.xml Tue Apr 06 16:59:30 2021 +0000
[
@@ -1,14 +1,13 @@
-<tool id="goProfiles" name="Compute functional profiles" version="2020.01.23">
+<tool id="goProfiles" name="Compute functional profiles" version="2021.04.03">
     <description>(Human, Mouse) [goProfiles]</description>
     <requirements>
-        <requirement type="package" >R</requirement>
-        <requirement type="package" version="3.8.2">bioconductor-org.hs.eg.db</requirement>
-        <requirement type="package" version="3.8.2">bioconductor-org.mm.eg.db</requirement>
-        <!--requirement type="package" version="3.5.0">bioconductor-org.rn.eg.db</requirement-->
-        <requirement type="package" version="1.46.0">bioconductor-annotationdbi</requirement>
-        <requirement type="package" version="2.44.0">bioconductor-biobase</requirement>
-        <requirement type="package" version="1.46.0">bioconductor-goprofiles</requirement>
-
+        <requirement type="package" version="4.0.3">r-base</requirement>
+        <requirement type="package" version="3.12.0">bioconductor-org.hs.eg.db</requirement>
+        <requirement type="package" version="3.12.0">bioconductor-org.mm.eg.db</requirement>
+        <requirement type="package" version="1.52.0">bioconductor-annotationdbi</requirement>
+        <requirement type="package" version="2.50.0">bioconductor-biobase</requirement>
+        <requirement type="package" version="3.12.1">bioconductor-go.db</requirement>
+        <requirement type="package" version="1.52.0">bioconductor-goprofiles</requirement>
     </requirements>
     <stdio>
         <exit_code range="1:" />
@@ -135,9 +134,9 @@
             <param name="title" value="Test" />
             <param name="plot_opt" value="PDF" />
             <output_collection name="output" type="list" >
-                <element name="profile.BP.pdf" file="profile.BP.pdf" ftype="pdf" compare="sim_size"/>
-                <element name="profile.CC.pdf" file="profile.CC.pdf" ftype="pdf" compare="sim_size"/>
-                <element name="profile.MF.pdf" file="profile.MF.pdf" ftype="pdf" compare="sim_size"/>
+                <element name="profile_BP.pdf" file="profile.BP.pdf" ftype="pdf" compare="sim_size"/>
+                <element name="profile_CC.pdf" file="profile.CC.pdf" ftype="pdf" compare="sim_size"/>
+                <element name="profile_MF.pdf" file="profile.MF.pdf" ftype="pdf" compare="sim_size"/>
             </output_collection>
             <output name="log" file="GO_Profile_text_output.tsv"/>
         </test>
@@ -183,11 +182,12 @@
 .. class:: infomark
 
 Packages used:
-    - bioconductor-org.hs.eg.db v3.5.0
-    - bioconductor-org.mm.eg.db v3.5.0
-    - bioconductor-annotationdbi v1.40.0
-    - bioconductor-biobase v2.98.0
-    - goprofiles v1.38.0
+    - bioconductor-org.hs.eg.db v3.12.0
+    - bioconductor-org.mm.eg.db v3.12.0
+    - bioconductor-annotationdbi v1.52.0
+    - bioconductor-biobase v2.50.0
+    - bioconductor-go.db v3.12.1
+    - goprofiles v1.52.0
 
 -----