changeset 2:8a6863adcd09 draft

planemo upload commit 9af2cf12c26c94e7206751ccf101a3368f92d0ba
author proteore
date Tue, 18 Dec 2018 09:23:35 -0500
parents 48f302ae5545
children f4938e47f2f8
files kegg_maps_visualization.R kegg_maps_visualization.xml
diffstat 2 files changed, 186 insertions(+), 163 deletions(-) [+]
line wrap: on
line diff
--- a/kegg_maps_visualization.R	Thu Dec 13 04:16:02 2018 -0500
+++ b/kegg_maps_visualization.R	Tue Dec 18 09:23:35 2018 -0500
@@ -169,6 +169,12 @@
   return(res)
 }
 
+get_limit <- function(mat) {
+  min = min(apply(mat,2,min))
+  max = max(apply(mat,2,max))
+  return(c(min,max))
+}
+
 get_args <- function(){
   
   ## Collect arguments
@@ -291,9 +297,11 @@
     geneID=mat$geneID
     mat = as.data.frame(mat[,-1])
     row.names(mat)=geneID
+    limit = get_limit(mat)
   } else {
     mat = unique(as.character(tab$geneID[!is.na(tab$geneID[tab$geneID!=""])]))
     geneID=mat
+    limit=1
   }
   
   #####mapping geneID (with or without expression values) on KEGG pathway
@@ -304,7 +312,7 @@
   if (!fold_change_data) {
     plot.col.key= FALSE   #if there's no exrepession data, we don't show the color key
     high_color = "#81BEF7" #blue
-  }
+  } 
   
   #create graph(s) and text output
   for (id in ids) {
@@ -322,7 +330,8 @@
              na.col="#D8D8D8", #gray
              cpd.data=NULL,
              plot.col.key = plot.col.key,
-             pdf.size=c(9,9)))
+             pdf.size=c(9,9),
+             limit=list(gene=limit, cpd=limit)))
     
     if (is.list(pv.out)){
     
--- a/kegg_maps_visualization.xml	Thu Dec 13 04:16:02 2018 -0500
+++ b/kegg_maps_visualization.xml	Tue Dec 18 09:23:35 2018 -0500
@@ -1,4 +1,4 @@
-<tool id="kegg_maps_visualization" name="KEGG maps visualization" version="2018.12.12">
+<tool id="kegg_maps_visualization" name="KEGG maps visualization" version="2018.12.18">
     <description>of (differentially expressed) genes/proteins</description>
     <requirements>
         <requirement type="package" version="1.18.0">bioconductor-pathview</requirement>
@@ -13,12 +13,12 @@
             --id_column="$input.ncol"
             --header="$input.header"  
         #end if
-        #if $species.pathways.pathways_id != "pathways_file"
-            --pathways_id="$species.pathways.pids" 
+        #if $pathways_section.species.pathways.pathways_id != "pathways_file"
+            --pathways_id="$pathways_section.species.pathways.pids" 
         #else 
-            --pathways_input="$species.pathways.file"
-            --header2="$species.pathways.header2"
-            --pathway_col="$species.pathways.ncol2"
+            --pathways_input="$pathways_section.species.pathways.file"
+            --header2="$pathways_section.species.pathways.header2"
+            --pathway_col="$pathways_section.species.pathways.ncol2"
         #end if
         --id_type="$id_type"  
         --native_kegg="$native"
@@ -31,157 +31,161 @@
             --fold_change_data="false"
         #end if
 
-        --species=${species.ref_file} 
-        --pathways_list=$__tool_directory__/${ filter( lambda x: str( x[0] ) == str( $species.ref_file ), $__app__.tool_data_tables['kegg_pathways_list_index'].get_fields() )[0][-1] } 
+        --species=${pathways_section.species.ref_file} 
+        --pathways_list=$__tool_directory__/${ filter( lambda x: str( x[0] ) == str( $pathways_section.species.ref_file ), $__app__.tool_data_tables['kegg_pathways_list_index'].get_fields() )[0][-1] } 
         --output="$text_output"
 
     ]]></command>
     <inputs>
-        <conditional name="species">
-        <param name="ref_file" type="select" label="Select species" >
-            <option value="hsa">Human (H. sapiens)</option>
-            <option value="mmu">Mouse (M. musculus)</option>
-            <option value="rno">Rat (R. norvegicus)</option>
-        </param>
-            <when value="hsa">
-                <conditional name="pathways">
-                <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>
+        <!--section name="pathways_section" title="Pathways" expanded="True"--> 
+            <conditional name="species">
+                <param name="ref_file" type="select" label="Species" >
+                    <option value="hsa">Human (Homo sapiens)</option>
+                    <option value="mmu">Mouse (Mus musculus)</option>
+                    <option value="rno">Rat (Rattus norvegicus)</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'>
-                        <options from_data_table="hsa_pathways">
-                            <filter type="sort_by" column="1"/>
-                            <validator type="no_options" message="No indexes are available for the selected input dataset"/>
-                        </options>
-                    </param>
+                <when value="hsa">
+                    <conditional name="pathways">
+                        <param name="pathways_id" type="select" label="Enter 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 IDs</option>
+                            <option value="pathways_file">KEGG pathway IDs from file</option>
+                        </param>         
+                        <when value="pathways_names">
+                            <param name="pids" type="select" label="Select pathway(s) (by clicking in the box)" multiple="true" help='You can select one or several pathway(s), you can write the beginning of your pathways to search using autocomplete'>
+                                <options from_data_table="hsa_pathways">
+                                    <filter type="sort_by" column="1"/>
+                                    <validator type="no_options" message="No indexes are available for the selected input dataset"/>
+                                </options>
+                            </param>
+                        </when>
+                        <when value="pathways_ids">
+                            <param name="pids" type="text" label="Copy/paste your pathway IDs" help='IDs must be separated by tab, space or carriage return into the form field, for example: "hsa00010 hsa05412"'>
+                                <sanitizer invalid_char=''>
+                                <valid initial="string.printable">
+                                    <remove value="&apos;"/>
+                                </valid>
+                                <mapping>
+                                    <add source="&#x20;" target=""/> 
+                                </mapping>
+                                </sanitizer>
+                            </param>
+                        </when>
+                        <when value="pathways_file">
+                            <param name="file" type="data" format="txt,tabular" label="Select your file" help="Pathway id format : 'path:hsa00010' or 'hsa00010' or '00010'" />
+                            <param name="header2" type="boolean" checked="true" truevalue="true" falsevalue="false" label="Does file contain header?" />
+                            <param name="ncol2" type="text" value="c1" label="Column of 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="pathways_ids">
-                    <param name="pids" type="text" label="Copy/paste your pathway id(s)" help='IDs must be separated by tab, space or carriage return into the form field, for example: "hsa00010 hsa05412"'>
-                        <sanitizer invalid_char=''>
-                        <valid initial="string.printable">
-                            <remove value="&apos;"/>
-                        </valid>
-                        <mapping>
-                            <add source="&#x20;" target=""/> 
-                        </mapping>
-                        </sanitizer>
+                <when value="mmu">
+                    <conditional name="pathways">
+                    <param name="pathways_id" type="select" label="Enter 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 IDs</option>
+                        <option value="pathways_file">KEGG pathway IDs from file</option>
                     </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 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'>
+                            <options from_data_table="mmu_pathways">
+                                <filter type="sort_by" column="1"/>
+                                <validator type="no_options" message="No indexes are available for the selected input dataset"/>
+                            </options>
+                        </param>
+                    </when>
+                    <when value="pathways_ids">
+                        <param name="pids" type="text" label="Copy/paste your pathway IDs" help='IDs must be separated by tab, space or carriage return into the form field, for example: "mmu00053 mmu00340"'>
+                            <sanitizer invalid_char=''>
+                            <valid initial="string.printable">
+                                <remove value="&apos;"/>
+                            </valid>
+                            <mapping>
+                                <add source="&#x20;" target=""/> 
+                            </mapping>
+                            </sanitizer>
+                        </param>
+                    </when>
+                    <when value="pathways_file">
+                        <param name="file" type="data" format="txt,tabular" label="Enter your file" help="Pathway id format : 'path:mmu00053' or 'mmu00053' or '00053'" />
+                        <param name="header2" type="boolean" checked="true" truevalue="true" falsevalue="false" label="Does file contain header?" />
+                        <param name="ncol2" type="text" value="c1" label="Column of 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>
-            </when>
-            <when value="mmu">
-                <conditional name="pathways">
-                <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>
+                <when value="rno">
+                    <conditional name="pathways">
+                    <param name="pathways_id" type="select" label="Enter your pathway(s) name/id" 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 IDs</option>
+                        <option value="pathways_file">KEGG pathway IDs 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'>
+                            <options from_data_table="rno_pathways">
+                                <filter type="sort_by" column="1"/>
+                                <validator type="no_options" message="No indexes are available for the selected input dataset"/>
+                            </options>
+                        </param>
+                    </when>
+                    <when value="pathways_ids">
+                        <param name="pids" type="text" label="Copy/paste your pathway IDs" help='IDs must be separated by tab, space or carriage return into the form field, for example: "hsa00010 hsa05412"'>
+                            <sanitizer invalid_char=''>
+                            <valid initial="string.printable">
+                                <remove value="&apos;"/>
+                            </valid>
+                            <mapping>
+                                <add source="&#x20;" target=""/> 
+                            </mapping>
+                            </sanitizer>
+                        </param>
+                    </when>
+                    <when value="pathways_file">
+                        <param name="file" type="data" format="txt,tabular" label="Select your file" help="Pathway id format : 'path:hsa00010' or 'hsa00010' or '00010'" />
+                        <param name="header2" type="boolean" checked="true" truevalue="true" falsevalue="false" label="Does file contain header?" />
+                        <param name="ncol2" type="text" value="c1" label="Column of 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>
+        <!--/section-->
+        <!--section name="genes_section" title="Genes/prot" expanded="True"--> 
+            <param name="id_type" type="select" label="Select ID type for genes to map to the pathway(s):">
+                <option value="geneID" selected="true">Entrez Gene ID</option>
+                <option value="keggid">KEGG Genes ID</option>
+                <option value="uniprotID">UniProt Accession number</option>
+            </param>
+            <conditional name="input" >
+                <param name="ids" type="select" label="Enter your IDs" help="Copy/paste or ID from file (e.g. table)" >
+                    <option value="text">Copy/paste your IDs</option>
+                    <option value="file" selected="true">Input file containing your IDs</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'>
-                        <options from_data_table="mmu_pathways">
-                            <filter type="sort_by" column="1"/>
-                            <validator type="no_options" message="No indexes are available for the selected input dataset"/>
-                        </options>
-                    </param>
-                </when>
-                <when value="pathways_ids">
-                    <param name="pids" type="text" label="Copy/paste your pathway id(s)" help='IDs must be separated by tab, space or carriage return into the form field, for example: "mmu00053 mmu00340"'>
+                <when value="text" >
+                    <param name="txt" type="text" label="Copy/paste your IDs" help='IDs must be separated by tab, space or carriage return into the form field, for example: P31946 P62258' >
                         <sanitizer invalid_char=''>
-                        <valid initial="string.printable">
-                            <remove value="&apos;"/>
-                        </valid>
-                        <mapping>
-                            <add source="&#x20;" target=""/> 
-                        </mapping>
+                            <valid initial="string.printable">
+                                <remove value="&apos;"/>
+                            </valid>
+                            <mapping initial="none">
+                                <add source="&apos;" target="__sq__"/>
+                            </mapping>
                         </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>
-            <when value="rno">
-                <conditional name="pathways">
-                <param name="pathways_id" type="select" label="Enter your pathway(s) name/id" 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'>
-                        <options from_data_table="rno_pathways">
-                            <filter type="sort_by" column="1"/>
-                            <validator type="no_options" message="No indexes are available for the selected input dataset"/>
-                        </options>
-                    </param>
-                </when>
-                <when value="pathways_ids">
-                    <param name="pids" type="text" label="Copy/paste your pathway id(s)" help='IDs must be separated by tab, space or carriage return into the form field, for example: "hsa00010 hsa05412"'>
-                        <sanitizer invalid_char=''>
-                        <valid initial="string.printable">
-                            <remove value="&apos;"/>
-                        </valid>
-                        <mapping>
-                            <add source="&#x20;" target=""/> 
-                        </mapping>
-                        </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 value="file" >
+                    <param name="file" type="data" format="txt,tabular" label="Select your file" help="" />
+                    <param name="header" type="boolean" checked="true" truevalue="true" falsevalue="false" label="Does file contain header?" />
+                    <param name="ncol" type="text" value="c1" label="Column if 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="foldchange" >
+                        <param name="fc" type="boolean" checked="false" truevalue="true" falsevalue="false" label="Map quantitative data on the pathway?"/>
+                            <when value="true">
+                                <param name="fc_col" type="text" label="Column(s) number of quantitative data (separated by ','. 3 columns max)" help="For example : c1,c3,c4"/>
+                            </when>
+                            <when value="false"/>
+                    </conditional>
                 </when>
-                </conditional>
-            </when>
-        </conditional>
-        <param name="id_type" type="select" label="Select your identifiers type for the genes to map on the pathway(s):">
-            <option value="geneID" selected="true">Entrez gene ID</option>
-            <option value="keggid">KEGG genes ID</option>
-            <option value="uniprotID">Uniprot Accession number</option>
-        </param>
-        <conditional name="input" >
-            <param name="ids" type="select" label="Enter your identifiers" help="Copy/paste or ID list from a file (e.g. table)" >
-                <option value="text">Copy/paste your identifiers</option>
-                <option value="file" selected="true">Input file containing your identifiers</option>
-            </param>
-            <when value="text" >
-                <param name="txt" type="text" label="Copy/paste your identifiers" help='IDs must be separated by tab, space or carriage return into the form field, for example: P31946 P62258' >
-                    <sanitizer invalid_char=''>
-                        <valid initial="string.printable">
-                            <remove value="&apos;"/>
-                        </valid>
-                        <mapping initial="none">
-                            <add source="&apos;" target="__sq__"/>
-                        </mapping>
-                    </sanitizer>
-                </param>
-            </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 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="foldchange" >
-                <param name="fc" type="boolean" checked="false" truevalue="true" falsevalue="false" label="Do you have fold change values to represent on the graph ?"/>
-                    <when value="true">
-                        <param name="fc_col" type="text" label="Please enter column(s) number of fold change data separated by ','. 3 columns max" help="For example : c1,c3,c4"/>
-                    </when>
-                    <when value="false"/>
-                </conditional>
-            </when>
-        </conditional>
-        <param name="native" type="select" label="Choose the output graphical format">
+            </conditional>
+        <!--/section-->
+        <param name="native" type="select" label="Graphical format">
             <option value="true">KEGG map (.png)</option>
             <option value="false">Graphviz layout engine (.pdf)</option> 
         </param>
@@ -226,23 +230,24 @@
         </test-->
     </tests>
     <help><![CDATA[
-This tool map a list identifiers to KEGG pathway with the R package 'pathview'.
 
-You can map Entrez gene ID, KEGG genes ID or Uniprot accession number from three species : human, mouse and rat.
+**Description**
 
-If your input have another type of IDs, please use the ID_Converter tool.
+This tool based on the Pathview R package, is set for pathway based data integration and visualization. 
 
-**Input:**
+It maps and renders a wide variety of biological data on relevant KEGG pathway graphs. All users need is to supply their data and specify the target pathway. Pathview automatically downloads the pathway graph data, parses the data file, maps user data to the pathway, and render pathway graph with the mapped data.
 
+**Input**
 
-- KEGG Pathways IDs to be used for mapping can be set by:
-    - chosing from the KEGG pathways name list 
-    - giving a list (copy/paste)
-    - importing a list from a dataset (column) - output of KEGG pathways identification and coverage can be used (1st column)
-- Identifiers to map can be either a list of Entrez genes IDs, KEGG genes ID or Uniprot accession number or in a column of a file (tabular, tsv, txt). 
-- Fold change values (up to three columns) from a dataset (same dataset as identifiers to map) can be added.
+1. "Enter your pathway(s)": target KEGG Pathways to be specify can be set by:
 
-You can see below an example of an input file with identifiers (uniprot_AC) and fold_change values.
+    - choosing from the KEGG pathways name list 
+    - giving a list of KEGG pathway IDs (e.g.hsa00010) (copy/paste mode)
+    - selecting a list from a dataset (column) - for instance, output from the "KEGG pathways identification and coverage" tool can be used (1st column, c1)
+2. "Select ID type for genes to map on the pathway(s)": Identifiers to map can be either a list of Entrez genes IDs, KEGG genes ID or Uniprot accession number. IDs to be mapped can be either provided by copy/paste or a file (tabular, tsv, txt) with a column containing the IDs. 
+3. "Map quantitative data on the pathway ?": Yes/No (default is No). Fold change values (up to three columns) from a dataset (same file as identifiers to map) can be graphically represented on the final figure (using a range of color representing the fold-change values).
+
+Below is an example of an input file with identifiers (uniprot_AC) and fold_change values.
 
 .. csv-table:: Simulated data
    :header: "Uniprot_AC","Protein.name","Number_of_peptides","fc_values 1","fc_values 2","fc_values 3"
@@ -254,10 +259,9 @@
 
 |
 
-
 .. class:: warningmark 
 
-If there's more than one id per line in the defined column, it will be split to have only one id per line. For example this table:
+If there's more than one ID per line in the specified column, it will be splitted resulting in one unique ID per line. For example this table:
 
 .. csv-table:: Simulated data
    :header: "Ensembl_Gene","UniProt.AC","UniProt.ID"
@@ -268,7 +272,7 @@
 
 |
 
-will become:
+will be converted as follow:
 
 .. csv-table:: Simulated data
    :header: "Ensembl_Gene","UniProt.AC","UniProt.ID"
@@ -281,9 +285,12 @@
 
 |
 
+-----
+
 **Output:**
 
 - a **collection dataset** named 'KEGG maps visualization from <dataset>', one file (png or pdf) for each given pathway.
+
 - a **summary text file** (.tsv) of the mapping(s) with the following columns
     - **KEGG pathway ID**: KEGG pathway(s) used to map given genes/proteins ids
     - **pathway name**: name(s) of KEGG pathway(s) used for mapping
@@ -299,22 +306,29 @@
 
 .. class:: infomark
 
-**Database:**
+**Data source (release date)**
 
 KEGG Pathways names list are from  http://rest.kegg.jp/list/pathway/
 
 User manual / Documentation: http://www.bioconductor.org/packages/release/bioc/html/pathview.html
 
-
 -----
 
 .. class:: infomark
 
 **Authors**
 
-David Christiany, Florence Combes, Yves Vandenbrouck CEA, INSERM, CNRS, Grenoble-Alpes University, BIG Institute, FR
+Luo, Weijun, Brouwer, Cory (2013). “Pathview: an R/Bioconductor package for pathway-based data integration and visualization.” Bioinformatics, 29(14), 1830-1831. doi: 10.1093/bioinformatics/btt285.
+
+-----
+
+.. class:: infomark
 
-Sandra Dérozier, Olivier Rué, Christophe Caron, Valentin Loux INRA, Paris-Saclay University, MAIAGE Unit, Migale Bioinformatics platform
+**Galaxy integration**
+
+David Christiany, Florence Combes, Yves Vandenbrouck - CEA, INSERM, CNRS, Grenoble-Alpes University, BIG Institute, FR
+
+Sandra Dérozier, Olivier Rué, Christophe Caron, Valentin Loux - INRA, Paris-Saclay University, MAIAGE Unit, Migale Bioinformatics platform, FR
 
 This work has been partially funded through the French National Agency for Research (ANR) IFB project.