Mercurial > repos > proteore > proteore_maps_visualization
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="'"/> + </valid> + <mapping> + <add source=" " 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="'"/> - </valid> - <mapping> - <add source=" " 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="'"/> + </valid> + <mapping> + <add source=" " 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="'"/> + </valid> + <mapping> + <add source=" " 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="'"/> - </valid> - <mapping> - <add source=" " target=""/> - </mapping> + <valid initial="string.printable"> + <remove value="'"/> + </valid> + <mapping initial="none"> + <add source="'" 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="'"/> - </valid> - <mapping> - <add source=" " 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="'"/> - </valid> - <mapping initial="none"> - <add source="'" 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><