diff save_to_db.xml @ 0:034686b5bc15 draft

planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
author tduigou
date Thu, 24 Apr 2025 09:56:36 +0000
parents
children 6854ac8c5d2b
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/save_to_db.xml	Thu Apr 24 09:56:36 2025 +0000
@@ -0,0 +1,73 @@
+<tool id="save_to_db" name="Save Data To DB" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="21.09">
+    <description>Save data to SQL DB</description>
+    <macros>
+        <token name="@VERSION_SUFFIX@">0</token>
+        <token name="@TOOL_VERSION@">0.1.0</token>
+    </macros>
+    <requirements>
+        <requirement type="package" version="2.2.3">pandas</requirement>
+        <requirement type="package" version="2.0.40">sqlalchemy</requirement>
+        <requirement type="package" version="2.9.9">psycopg2</requirement>
+    </requirements>
+    <command detect_errors="exit_code"><![CDATA[
+        #set $file_name_mapping = ",".join(["%s:%s" % (file.file_name, file.name) for file in $genbank_files])
+        python '$__tool_directory__/save_to_db.py'
+            --input '$genbank_files' 
+            --sequence_column '$sequence_column'
+            --annotation_column '$annotation_column'
+            --db_uri '$db_uri' 
+            --table '$table' 
+            --fragment_column '$fragment_column'
+            --output '$output'
+            --file_name_mapping '$file_name_mapping'
+    ]]></command>
+    <inputs>
+        <param name="genbank_files" type="data" format="genbank" multiple="true" label="GenBank File(s)"/>
+        <param name="table" type="text" label="Database Table Name" optional="false" />
+        <param name="sequence_column" type="text" label="DB column contains sequence for ganbank file" optional="false" />
+        <param name="annotation_column" type="text" label="DB column contains annotation for ganbank file" optional="false" />
+        <param name="fragment_column" type="text" label="Database Fragments Column Name" optional="false" />
+        <param name="db_uri" type="text" label="Database Connection URI" help="postgresql+psycopg2://username:password@db_container_name:port/database" optional="false" />
+    </inputs>   
+    <outputs>
+        <data name="output" format="txt" label="text raport" />
+    </outputs>
+    <tests>
+    <!--python save_to_db.py -input 'test-data/p7_L7Ae-Weiss.gb,test-data/p6_Nt-IgKLsequence.gb,test-data/p6_Kozak-ATG.gb,test-data/p4_Kt-L7Ae-Weiss.gb,test-data/HC_Amp_ccdB.gb' -sequence_column 'sequence' -annotation_column 'annotation' -db_uri 'postgresql://postgres:RK17@localhost:5432/test_fragments_db' -table 'sample' -fragment_column 'fragment' -output 'test-data/test_raport.txt'
+    but it will not work as there is an extra param '-file_name_mapping' that are generated by galaxy and contain the dict for 'file.dat:fragment name' to stock the fragment name from file name thus use planemo with debug to test -->
+        <test> 
+            <param name="genbank_files" value="p7_L7Ae-Weiss.gb,p6_Nt-IgKLsequence.gb,p6_Kozak-ATG.gb,p4_Kt-L7Ae-Weiss.gb,HC_Amp_ccdB.gb" />
+            <param name="table" value="sample" />
+            <param name="sequence_column" value="sequence" />
+            <param name="annotation_column" value="annotation" />
+            <param name="fragment_column" value="fragment" />
+            <param name="db_uri" value="postgresql://postgres:RK17@localhost:5432/test_fragments_db" />
+            <output name="output" file="test_raport.txt" ftype="txt" >
+                <assert_contents>
+                     <has_n_lines n="5" />
+                     <has_line_matching expression="p7_L7Ae-Weiss" />
+                     <has_line_matching expression="p6_Nt-IgKLsequence" />
+                     <has_line_matching expression="p6_Kozak-ATG" />
+                     <has_line_matching expression="p4_Kt-L7Ae-Weiss" />
+                     <has_line_matching expression="HC_Amp_ccdB" />
+                </assert_contents>
+            </output>
+        </test>
+    </tests>
+    
+    <help><![CDATA[
+Save Data To DB
+===================
+
+Save GanDank data in SQL DB.
+    ]]></help>
+    <citations>
+        <citation type="bibtex">
+            @unpublished{save_to_db
+                author = {Ramiz Khaled},
+                title = {{save_to_db}},
+                url = {https://github.com/brsynth/},
+            }
+        </citation>
+    </citations>
+</tool>
\ No newline at end of file