changeset 8:33c9bd75882a draft

planemo upload commit 1953798eb28b6e45c78342ed4c6a6a978d096fca
author proteore
date Thu, 30 Aug 2018 06:12:51 -0400
parents b617d4bbebf8
children 560541195c3f
files PathView.R Pathview.xml README.rst
diffstat 3 files changed, 59 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/PathView.R	Mon Aug 27 11:21:34 2018 -0400
+++ b/PathView.R	Thu Aug 30 06:12:51 2018 -0400
@@ -56,6 +56,9 @@
       --expression_values3    Column containing expression values (third condition)
       --native_kegg           TRUE : native KEGG graph, FALSE : Graphviz graph
       --species               KEGG species (hsa, mmu, ...)
+      --pathways_input        Tab with pathways in a column, output format of find_pathways
+      --pathway_col           Column of pathways to use
+      --header2               Boolean, TRUE if header FALSE if not
 
       Example:
       ./PathView.R --input 'input.csv' --pathway_id '05412' --id_type 'uniprotID' --id_column 'c1' --header TRUE \n\n")
@@ -108,7 +111,14 @@
 #load("/home/dchristiany/proteore_project/ProteoRE/tools/pathview/args.Rda")
 
 ###setting variables
-if (!is.null(args$pathways_id)) { ids <- sapply(rapply(strsplit(clean_bad_character(args$pathways_id),","),c), function(x) remove_kegg_prefix(x),USE.NAMES = FALSE)}
+if (!is.null(args$pathways_id)) { 
+  ids <- sapply(rapply(strsplit(clean_bad_character(args$pathways_id),","),c), function(x) remove_kegg_prefix(x),USE.NAMES = FALSE)
+}else if (!is.null(args$pathways_input)){
+  header2 <- str2bool(args$header2)
+  pathway_col <- as.numeric(gsub("c", "" ,args$pathway_col))
+  pathways_file = read_file(args$pathways_input,header2)
+  ids <- sapply(rapply(strsplit(clean_bad_character(pathways_file[,pathway_col]),","),c), function(x) remove_kegg_prefix(x),USE.NAMES = FALSE)
+}
 #if (!is.null(args$pathways_name)) {names <- as.vector(sapply(strsplit(args$pathways_name,","), function(x) concat_string(x),USE.NAMES = FALSE))}
 if (!is.null(args$id_list)) {id_list <- as.vector(strsplit(clean_bad_character(args$id_list),","))}
 id_type <- tolower(args$id_type)
@@ -117,6 +127,10 @@
 #output <- args$output
 native_kegg <- str2bool(args$native_kegg)
 species=args$species
+#org list used in mapped2geneID
+org <- c('Hs','Mm')
+names(org) <- c('hsa','mmu')
+
 
 
 #read input file or list
@@ -140,7 +154,7 @@
 if (id_type == "uniprotid") {
   
   uniprotID = tab[,ncol]
-  mapped2geneID = id2eg(ids = uniprotID, category = "uniprot", org = "Hs", pkg.name = NULL)
+  mapped2geneID = id2eg(ids = uniprotID, category = "uniprot", org = org[[species]], pkg.name = NULL)
   geneID = mapped2geneID[,2]
   tab = cbind(tab,geneID)
 
@@ -188,6 +202,8 @@
 
 
 #####mapping geneID (with or without expression values) on KEGG pathway
+plot.col.key=!is.null(tab$e1)   #if there's no exrepession data, we don't show the color key
+
 for (id in ids) {
   pathview(gene.data = mat,
            #gene.idtype = "geneID",
@@ -217,6 +233,8 @@
            #high = list(gene = "red", cpd = "yellow"), 
            #na.col = "transparent",
            #sign.pos="bottomleft",
+           plot.col.key = plot.col.key,
+           #high = "lightgreen",
            #key.pos="topright",
            #new.signature=TRUE,
            #rankdir="LB",
--- a/Pathview.xml	Mon Aug 27 11:21:34 2018 -0400
+++ b/Pathview.xml	Thu Aug 30 06:12:51 2018 -0400
@@ -1,4 +1,4 @@
-<tool id="Pathview" name="KEGG pathway mapping (pathview)" version="2018.08.27">
+<tool id="Pathview" name="KEGG pathway mapping (pathview)" version="2018.08.30">
     <requirements>
         <requirement type="package" version="1.18.0">bioconductor-pathview</requirement>
     </requirements>
@@ -11,10 +11,12 @@
             --id_column="$input.ncol"
             --header="$input.header"  
         #end if
-        #if $species.pathways.pathways_id == "pathways_ids"
+        #if $species.pathways.pathways_id != "pathways_file"
             --pathways_id="$species.pathways.pids" 
         #else 
-            --pathways_id="$species.pathways.pids"
+            --pathways_input="$species.pathways.file"
+            --header2="$species.pathways.header2"
+            --pathway_col="$species.pathways.ncol2"
         #end if
         --id_type="$id_type"  
         --native_kegg="$native"
@@ -36,6 +38,10 @@
 
     ]]></command>
     <inputs>
+        <param name="id_type" type="select" label="Select your identifiers type :">
+            <option value="uniprotID">Uniprot Accession number</option>
+            <option value="geneID">Entrez gene ID</option>
+        </param>
         <conditional name="input" >
             <param name="ids" type="select" label="Provide your identifiers" help="Copy/paste or ID list from a file (e.g. table)" >
                 <option value="text">Copy/paste your identifiers</option>
@@ -55,8 +61,8 @@
             </when>
             <when value="file" >
                 <param name="file" type="data" format="txt,tabular" label="Select a file that contains your list of IDs" help="" />
-                <param name="header" type="boolean" checked="true" truevalue="true" falsevalue="false" label="Does your input file contain header?" />
-                <param name="ncol" type="text" value="c1" label="The column number of IDs to map" help='For example, fill in "c1" if it is the first column, "c2" if it is the second column and so on' />
+                <param name="header" type="boolean" checked="true" truevalue="true" falsevalue="false" label="Does your input file contains a header?" />
+                <param name="ncol" type="text" value="c1" label="The column which contains your IDs to map" help='For example, fill in "c1" if it is the first column, "c2" if it is the second column and so on' />
                 <conditional name="expression_values">
                     <param name="nb_exp" type="select" label="How many expression values column in your file ?">
                         <option value="0" >0</option>
@@ -81,11 +87,6 @@
                 </conditional>
             </when>
         </conditional>
-        <param name="id_type" type="select" label="select your identifiers type :">
-            <option value="uniprotID">Uniprot Accession number</option>
-            <option value="geneID">Entrez gene ID</option>
-        </param>
-
         <conditional name="species">
         <param name="ref_file" type="select" label="Select species" >
             <option value="hsa">Human (hsa)</option>
@@ -96,6 +97,7 @@
                 <param name="pathways_id" type="select" label="Provide your pathway(s)" help="Enter KEGG pathway name(s) or KEGG pathway id(s)">
                     <option value="pathways_names">KEGG pathway name(s)</option>
                     <option value="pathways_ids">KEGG pathway id(s)</option>
+                    <option value="pathways_file">KEGG pathway id(s) from file</option>
                 </param>
                 <when value="pathways_names">
                     <param name="pids" type="select" label="Select pathway(s)" multiple="true" help='You can select one or several pathway(s), you can write the beginning of your pathways to search using autocomplete'>
@@ -106,7 +108,7 @@
                     </param>
                 </when>
                 <when value="pathways_ids">
-                    <param name="pids" type="text" label="Copy/paste your pathway id(s)" help='IDs must be separated by "," into the form field, for example: "00010,05412" or "hsa00010,hsa05412"'>
+                    <param name="pids" type="text" label="Copy/paste your pathway id(s)" help='IDs must be separated by "," into the form field, for example: "00010,05412" or "hsa00010,hsa05412" or "path:hsa00010"'>
                         <sanitizer invalid_char=''>
                         <valid initial="string.printable">
                             <remove value="&apos;"/>
@@ -117,6 +119,11 @@
                         </sanitizer>
                     </param>
                 </when>
+                <when value="pathways_file">
+                    <param name="file" type="data" format="txt,tabular" label="Select a file with a column of pathways id" help="Pathway id format : 'path:hsa00010' or 'hsa00010' or '00010'" />
+                    <param name="header2" type="boolean" checked="true" truevalue="true" falsevalue="false" label="Does your input file contains a header?" />
+                    <param name="ncol2" type="text" value="c1" label="The column which contains your pathways ids" help='For example, fill in "c1" if it is the first column, "c2" if it is the second column and so on' />
+                </when>
                 </conditional>
             </when>
             <when value="mmu">
@@ -124,6 +131,7 @@
                 <param name="pathways_id" type="select" label="Provide your pathway(s)" help="Enter KEGG pathway name(s) or KEGG pathway id(s)">
                     <option value="pathways_names">KEGG pathway name(s)</option>
                     <option value="pathways_ids">KEGG pathway id(s)</option>
+                    <option value="pathways_file">KEGG pathway id(s) from file</option>
                 </param>
                 <when value="pathways_names">
                     <param name="pids" type="select" label="Select pathway(s)" multiple="true" help='You can select one or several pathway(s), you can write the beginning of your pathways to search using autocomplete'>
@@ -134,7 +142,7 @@
                     </param>
                 </when>
                 <when value="pathways_ids">
-                    <param name="pids" type="text" label="Copy/paste your pathway id(s)" help='IDs must be separated by "," into the form field, for example: "00010,05412" or "hsa00010,hsa05412"'>
+                    <param name="pids" type="text" label="Copy/paste your pathway id(s)" help='IDs must be separated by "," into the form field, for example: "path:mmu00053" or "mmu00053,mmu00340" or "00053"'>
                         <sanitizer invalid_char=''>
                         <valid initial="string.printable">
                             <remove value="&apos;"/>
@@ -145,6 +153,11 @@
                         </sanitizer>
                     </param>
                 </when>
+                <when value="pathways_file">
+                    <param name="file" type="data" format="txt,tabular" label="Select a file with a column of pathways id " help="Pathway id format : 'path:mmu00053' or 'mmu00053' or '00053'" />
+                    <param name="header2" type="boolean" checked="true" truevalue="true" falsevalue="false" label="Does your input file contain header?" />
+                    <param name="ncol2" type="text" value="c1" label="The column which contains your pathways ids" help='For example, fill in "c1" if it is the first column, "c2" if it is the second column and so on' />
+                </when>
                 </conditional>
             </when>
         </conditional>
@@ -194,13 +207,17 @@
     <help><![CDATA[
 This tool map a list of Uniprot Accession number or Entrez gene ID to KEGG pathway with pathview R package.
 
+Select your identifier type : UniprotAC or Entrez gene ID
+
 Select an input file containing ids in a column, set header and column number or copy/paste your ids. 
 
-Select your identifier type and a species of interest (for now only human available). 
+You can import 1 to 3 column(s) of expression values if you are importing ids from a file.
+
+Select a species of interest. 
 
-Select one or several pathways of interest from the dropdown menu or copy/paste KEGG pathway id(s)
+Select one or several pathways of interest from the dropdown menu or copy/paste KEGG pathway id(s) or import it from a file.
 
-Select the graph format : KEGG or graphviz
+Select the graph format : KEGG (jpg) or graphviz (pdf)
 
 Uniprot accession number converted to Entrez geneID or Entrez geneID are mapped to each selected pathways.
 
--- a/README.rst	Mon Aug 27 11:21:34 2018 -0400
+++ b/README.rst	Thu Aug 30 06:12:51 2018 -0400
@@ -15,13 +15,17 @@
 
 This tool map a list of Uniprot Accession number or Entrez gene ID to KEGG pathway with pathview R package.
 
+Select your identifier type : UniprotAC or Entrez gene ID
+
 Select an input file containing ids in a column, set header and column number or copy/paste your ids. 
 
-Select your identifier type and a species of interest (for now only human available). 
+You can import 1 to 3 column(s) of expression values if you are importing ids from a file.
+
+Select a species of interest. 
 
-Select one or several pathways of interest from the dropdown menu or copy/paste KEGG pathway id(s)
+Select one or several pathways of interest from the dropdown menu or copy/paste KEGG pathway id(s) or import it from a file.
 
-Select the graph format : KEGG or graphviz
+Select the graph format : KEGG (jpg) or graphviz (pdf)
 
 Uniprot accession number converted to Entrez geneID or Entrez geneID are mapped to each selected pathways.