changeset 17:1e45ea50f145 draft

planemo upload commit 640429adac783e2354f5caf12d7b6b81b8ddf54f-dirty
author proteore
date Thu, 07 Mar 2019 07:49:18 -0500
parents b6607b7e683f
children 5252bbcfbdd7
files id_converter.py id_converter.xml proteore_id_mapping_Human.loc.sample proteore_id_mapping_Mouse.loc.sample proteore_id_mapping_Rat.loc.sample tool-data/proteore_id_mapping.loc.sample tool_data_table_conf.xml.sample
diffstat 7 files changed, 45 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/id_converter.py	Mon Jan 28 11:08:47 2019 -0500
+++ b/id_converter.py	Thu Mar 07 07:49:18 2019 -0500
@@ -44,6 +44,7 @@
     for line in input_file :
         if line != [] and set(line) != {''}: 
             line[nb_col] = re.sub(r"\s+","",line[nb_col])
+            if line[nb_col] == "" : line[nb_col]='NA'
             if ";" in line[nb_col] :
                 ids = line[nb_col].split(";")
                 for id in ids :
@@ -119,6 +120,7 @@
     if args.input_type=="file" :
         args.column_number = nb_col_to_int(args.column_number)
         header = str2bool(args.header)
+    
 
     #Get ref file to build dictionary
     csv.field_size_limit(sys.maxsize) # to handle big files
@@ -151,7 +153,7 @@
     if args.input_type == "list" :
         ids = get_input_ids_from_string(args.input)
     elif args.input_type == "file" :
-        input_file, ids = get_input_ids_from_file(args.input,args.column_number,args.header)
+        input_file, ids = get_input_ids_from_file(args.input,args.column_number,header)
 
     #Mapping ids
     result_dict = map_to_dictionary(ids,ids_dictionary,args.id_type,target_ids)
--- a/id_converter.xml	Mon Jan 28 11:08:47 2019 -0500
+++ b/id_converter.xml	Thu Mar 07 07:49:18 2019 -0500
@@ -1,4 +1,4 @@
-<tool id="IDconverter" name="ID Converter" version="2019.01.28">
+<tool id="IDconverter" name="ID Converter" version="2019.03.07">
     <description>(Human, Mouse, Rat)
     </description>
     <requirements>
@@ -20,8 +20,11 @@
         #end if
         --target_ids="$species.idto.idtypeout"
         --output="$output"
-        --ref_file="$__tool_directory__/${ filter( lambda x: str( x[2] ) == str( $species.mapping_file ), $__app__.tool_data_tables['proteore_id_mapping'].get_fields() )[0][-1] }"
-        
+        #if "id_mapping" in str($species.mapping_file).split("/")
+            --ref_file="$species.mapping_file"
+        #else 
+            --ref_file="$__tool_directory__/$species.mapping_file"
+        #end if 
     ]]></command>
     <inputs>
         <conditional name="input" >
@@ -48,17 +51,21 @@
             <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 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="ncol" type="text" value="c1" label="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'>
+                    <validator type="regex" message="Please enter a column number, for example: 'c1' for the first column">[c]{0,1}[0-9]+</validator>
+                </param>
             </when>
         </conditional>
         <conditional name="species">
-            <param name="mapping_file" type="select" label="Species" >
-                <options from_data_table="proteore_id_mapping"/>
-                <option value="Human"></option>
-                <option value="Mouse"></option>
-                <option value="Rat"></option>
+            <param name="species" type="select" label="Species">
+                <option value="Human" selected="True">Human (Homo sapiens)</option>
+                <option value="Mouse" selected="True">Mouse (Mus musculus)</option>
+                <option value="Rat" selected="True">Rat (Rattus norvegicus)</option>
             </param>
             <when value="Human">
+                <param name="mapping_file" type="select" label="Release" >
+                    <options from_data_table="proteore_id_mapping_Human"/>
+                </param>    
                 <param name="idtypein" type="select" label="Type/source of IDs" optional="false" >
                     <option value="neXtProt" >neXtProt ID (e.g. NX_P31946)</option>
                     <option value="UniProt-AC" selected="True" >UniProt accession number (e.g. P31946)</option>
@@ -101,6 +108,9 @@
                 </section>
             </when>
             <when value="Mouse">
+                <param name="mapping_file" type="select" label="Release" >
+                    <options from_data_table="proteore_id_mapping_Mouse"/>
+                </param>    
                 <param name="idtypein" type="select" label="Type/source of IDs" optional="false" >
                     <option value="UniProt-AC" selected="True" >UniProt accession number (e.g. P31946)</option>
                     <option value="UniProt-ID" >UniProt ID (e.g 1433B_HUMAN)</option>
@@ -140,6 +150,9 @@
                 </section>
             </when>
             <when value="Rat">
+                <param name="mapping_file" type="select" label="Release" >
+                    <options from_data_table="proteore_id_mapping_Rat"/>
+                </param>    
                 <param name="idtypein" type="select" label="Select type/source of identifier of your list" optional="false" >
                     <option value="UniProt-AC" selected="True" >UniProt accession number (e.g. P31946)</option>
                     <option value="UniProt-ID" >UniProt ID (e.g 1433B_HUMAN)</option>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/proteore_id_mapping_Human.loc.sample	Thu Mar 07 07:49:18 2019 -0500
@@ -0,0 +1,3 @@
+#This file lists the locations of reference file for id_converter tool
+#<id>	<name>	<species>	<value>
+human_id_mapping_23-10-2018	Human (homo sapiens 23/10/2018)	Human	tool-data/human_id_mapping_23-10-2018.tsv
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/proteore_id_mapping_Mouse.loc.sample	Thu Mar 07 07:49:18 2019 -0500
@@ -0,0 +1,3 @@
+#This file lists the locations of reference file for id_converter tool
+#<id>	<name>	<species>	<value>
+mouse_id_mapping_23-10-2018	Mouse (Mus musculus 23/10/2018)	Mouse	tool-data/mouse_id_mapping_23-10-2018.tsv
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/proteore_id_mapping_Rat.loc.sample	Thu Mar 07 07:49:18 2019 -0500
@@ -0,0 +1,3 @@
+#This file lists the locations of reference file for id_converter tool
+#<id>	<name>	<species>	<value>
+rat_id_mapping_23-10-2018	Rat (Rattus norvegicus 23/10/2018)	Rat	tool-data/rat_id_mapping_23-10-2018.tsv
--- a/tool-data/proteore_id_mapping.loc.sample	Mon Jan 28 11:08:47 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-#This file lists the locations of reference file for id_converter tool
-#<id>	<name>	<value>	<path>
-human_id_mapping_23-10-2018	Human (homo sapiens)	Human	tool-data/human_id_mapping_23-10-2018.tsv
-mouse_id_mapping_23-10-2018	Mouse (Mus musculus)	Mouse	tool-data/mouse_id_mapping_23-10-2018.tsv
-rat_id_mapping_23-10-2018	Rat (Rattus norvegicus)	Rat	tool-data/rat_id_mapping_23-10-2018.tsv
--- a/tool_data_table_conf.xml.sample	Mon Jan 28 11:08:47 2019 -0500
+++ b/tool_data_table_conf.xml.sample	Thu Mar 07 07:49:18 2019 -0500
@@ -1,7 +1,15 @@
 <tables>
     <!-- Location of ID Mapping files for id_converter-->
-    <table name="proteore_id_mapping" comment_char="#">
-        <columns>id, name, value, path</columns>
-        <file path="tool-data/proteore_id_mapping.loc" />
+    <table name="proteore_id_mapping_Human" comment_char="#">
+      <columns>id, name, species, value</columns>
+      <file path="tool-data/proteore_id_mapping_Human.loc" />
+    </table>
+    <table name="proteore_id_mapping_Mouse" comment_char="#">
+      <columns>id, name, species, value</columns>
+      <file path="tool-data/proteore_id_mapping_Mouse.loc" />
+    </table>
+    <table name="proteore_id_mapping_Rat" comment_char="#">
+      <columns>id, name, species, value</columns>
+      <file path="tool-data/proteore_id_mapping_Rat.loc" />
     </table>
 </tables>
\ No newline at end of file