annotate save_to_db.xml @ 3:eca0d710bbe9 draft

planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
author tduigou
date Fri, 23 May 2025 08:51:50 +0000
parents 81e9e1d803fa
children c7a7520afb4b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
1 <tool id="save_to_db" name="Save Data To DB" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="21.09">
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
2 <description>Save data to SQL DB</description>
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
3 <macros>
2
81e9e1d803fa planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 1
diff changeset
4 <token name="@VERSION_SUFFIX@">1</token>
0
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
5 <token name="@TOOL_VERSION@">0.1.0</token>
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
6 </macros>
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
7 <requirements>
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
8 <requirement type="package" version="2.2.3">pandas</requirement>
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
9 <requirement type="package" version="2.0.40">sqlalchemy</requirement>
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
10 <requirement type="package" version="2.9.9">psycopg2</requirement>
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
11 </requirements>
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
12 <command detect_errors="exit_code"><![CDATA[
2
81e9e1d803fa planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 1
diff changeset
13 #set genbank_file_paths = ','.join([str(f) for f in $genbank_files])
0
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
14 #set $file_name_mapping = ",".join(["%s:%s" % (file.file_name, file.name) for file in $genbank_files])
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
15 python '$__tool_directory__/save_to_db.py'
2
81e9e1d803fa planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 1
diff changeset
16 --input '$genbank_file_paths'
0
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
17 --sequence_column '$sequence_column'
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
18 --annotation_column '$annotation_column'
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
19 --db_uri '$db_uri'
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
20 --table '$table'
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
21 --fragment_column '$fragment_column'
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
22 --output '$output'
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
23 --file_name_mapping '$file_name_mapping'
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
24 ]]></command>
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
25 <inputs>
2
81e9e1d803fa planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 1
diff changeset
26 <param name="genbank_files" type="data_collection" collection_type="list" format="genbank" label="GenBank File(s)"/>
3
eca0d710bbe9 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 2
diff changeset
27 <param name="table" type="text" label="DB Table Name" optional="false" />
eca0d710bbe9 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 2
diff changeset
28 <param name="sequence_column" type="text" label="DB Column Contains Sequence For ganbank File" optional="false" />
eca0d710bbe9 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 2
diff changeset
29 <param name="annotation_column" type="text" label="DB Column Contains Annotation For Ganbank File" optional="false" />
eca0d710bbe9 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 2
diff changeset
30 <param name="fragment_column" type="text" label="DB IDs Column Name" optional="false" />
eca0d710bbe9 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 2
diff changeset
31 <param name="db_uri" type="text" label="DB Connection URI" help="postgresql+psycopg2://username:password@db_container_name:port/database" optional="false" />
0
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
32 </inputs>
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
33 <outputs>
1
6854ac8c5d2b planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 0
diff changeset
34 <data name="output" format="txt" label="saving report" />
0
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
35 </outputs>
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
36 <tests>
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
37 <!--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'
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
38 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 -->
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
39 <test>
2
81e9e1d803fa planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 1
diff changeset
40 <param name="genbank_files">
81e9e1d803fa planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 1
diff changeset
41 <collection type="list">
81e9e1d803fa planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 1
diff changeset
42 <element name="p7_L7Ae-Weiss" value="p7_L7Ae-Weiss.gb" />
81e9e1d803fa planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 1
diff changeset
43 <element name="p7_gfp_sequence" value="p6_Nt-IgKLsequence.gb" />
81e9e1d803fa planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 1
diff changeset
44 <element name="p14_CMVp" value="p6_Kozak-ATG.gb" />
81e9e1d803fa planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 1
diff changeset
45 <element name="p16_bGHpolyA" value="p4_Kt-L7Ae-Weiss.gb" />
81e9e1d803fa planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 1
diff changeset
46 <element name="p18_CMVp" value="HC_Amp_ccdB.gb" />
81e9e1d803fa planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 1
diff changeset
47 </collection>
81e9e1d803fa planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 1
diff changeset
48 </param>
0
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
49 <param name="table" value="sample" />
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
50 <param name="sequence_column" value="sequence" />
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
51 <param name="annotation_column" value="annotation" />
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
52 <param name="fragment_column" value="fragment" />
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
53 <param name="db_uri" value="postgresql://postgres:RK17@localhost:5432/test_fragments_db" />
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
54 <output name="output" file="test_raport.txt" ftype="txt" >
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
55 <assert_contents>
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
56 <has_n_lines n="5" />
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
57 <has_line_matching expression="p7_L7Ae-Weiss" />
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
58 <has_line_matching expression="p6_Nt-IgKLsequence" />
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
59 <has_line_matching expression="p6_Kozak-ATG" />
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
60 <has_line_matching expression="p4_Kt-L7Ae-Weiss" />
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
61 <has_line_matching expression="HC_Amp_ccdB" />
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
62 </assert_contents>
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
63 </output>
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
64 </test>
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
65 </tests>
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
66
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
67 <help><![CDATA[
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
68 Save Data To DB
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
69 ===================
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
70
3
eca0d710bbe9 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 2
diff changeset
71 Implemented a system to save GenBank (.gb) files in SQL DB, based on a connection via URI requests.
eca0d710bbe9 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 2
diff changeset
72 The tool is tested on a locally hosted PostgreSQL database running in a Docker container.
eca0d710bbe9 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 2
diff changeset
73
eca0d710bbe9 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 2
diff changeset
74 **Parameters**:
eca0d710bbe9 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 2
diff changeset
75 ---------------
eca0d710bbe9 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 2
diff changeset
76 * **GenBank File(s)**: List of GenBaks files.
eca0d710bbe9 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 2
diff changeset
77 * **DB Table Name**: Name of the target table in the PostgreSQL database.
eca0d710bbe9 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 2
diff changeset
78 * **DB Column Contains Sequence For ganbank File**: Column storing sequence data, expected to start with "ORIGIN".
eca0d710bbe9 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 2
diff changeset
79 * **DB Column Contains Annotation For Ganbank File**: Column containing annotation data, to save al part before "ORIGIN" in the .gb file.
eca0d710bbe9 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 2
diff changeset
80 * **DB IDs Column Name**: Column holding the unique fragment IDs.
eca0d710bbe9 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents: 2
diff changeset
81 * **DB Connection URI**: URI used to connect to the database (e.g., postgresql://user:password@host:port/DB_name).
0
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
82 ]]></help>
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
83 <citations>
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
84 <citation type="bibtex">
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
85 @unpublished{save_to_db
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
86 author = {Ramiz Khaled},
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
87 title = {{save_to_db}},
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
88 url = {https://github.com/brsynth/},
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
89 }
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
90 </citation>
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
91 </citations>
034686b5bc15 planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
tduigou
parents:
diff changeset
92 </tool>