Mercurial > repos > ufz > omero_metadata_import
changeset 9:7cd85e1c50f3 draft default tip
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 3f4e79a4e8350481f3c8d70bc64f01b4cb0a4bf0
author | ufz |
---|---|
date | Fri, 13 Jun 2025 20:46:51 +0000 |
parents | 931eb5fed2c0 |
children | |
files | omero_metadata_import.xml omero_metadata_upload.py test-data/output_attachement_import.txt |
diffstat | 3 files changed, 28 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/omero_metadata_import.xml Tue Apr 08 15:13:27 2025 +0000 +++ b/omero_metadata_import.xml Fri Jun 13 20:46:51 2025 +0000 @@ -2,7 +2,7 @@ <description> with ezomero </description> <macros> <import>macros.xml</import> - <token name="@VERSION_SUFFIX@">4</token> + <token name="@VERSION_SUFFIX@">5</token> </macros> <xrefs> <xref type="bio.tools">omero</xref> @@ -47,6 +47,7 @@ <param argument="ann_type" type="select" optional="false" label="Annotation type" help="Select annotation format"> <option value="table">Table</option> <option value="KV">Key-Value Pairs</option> + <option value="attachement">File Attachment</option> </param> <param argument="ann_file" type="data" format="tabular" optional="false" label="Annotation file" help="Select annotation file"/> <param argument="an_name" type="text" optional="false" label="Annotation Name"/> @@ -110,6 +111,25 @@ </assert_contents> </output> </test> + <test> + <param name="omero_host" value="host.docker.internal"/> + <param name="omero_port" value="6064"/> + <param name="obj_type" value="dataset"/> + <param name="ann_type" value="attachement"/> + <conditional name="object_id"> + <param name="object_id_selection" value="existing_object"/> + <param name="did" value="1"/> + </conditional> + <param name="ann_file" value="metadata.tsv"/> + <param name="an_name" value="attachement_test"/> + <param name="test_username" value="root"/> + <param name="test_password" value="omero"/> + <output name="log" value="output_attachement_import.txt" ftype="txt"> + <assert_contents> + <has_text text="SUCCESS: Successfully uploaded metadata for dataset"/> + </assert_contents> + </output> + </test> </tests> <help> Description
--- a/omero_metadata_upload.py Tue Apr 08 15:13:27 2025 +0000 +++ b/omero_metadata_upload.py Fri Jun 13 20:46:51 2025 +0000 @@ -19,6 +19,9 @@ headers=True) tb_dict = ez.get_table(conn, id_tb_ann) return tb_dict + elif ann_type == "attachement": + id_file_attach = ez.post_file_annotation(conn, file_path=data_dict, ns=an_name, object_type=obj_type, object_id=int(did)) + return id_file_attach except Exception as e: log_error(f"Error uploading metadata for {obj_type} with ID {did}: {str(e)}") return None @@ -41,6 +44,8 @@ data_dict = df.to_dict(orient='records') elif ann_type == "KV": data_dict = {col: df[col].iloc[0] for col in df.columns} + elif ann_type == "attachement": + data_dict = ann_file try: with ez.connect(user, pws, "", host, port, secure=True) as conn: @@ -86,7 +91,7 @@ 'well ', 'image'], help='Type of OMERO object') parser.add_argument('--did', type=int, help='ID of the object (if it exists)') - parser.add_argument('--ann_type', required=True, choices=['table', 'KV'], help='Annotation type') + parser.add_argument('--ann_type', required=True, choices=['table', 'KV', "attachement"], help='Annotation type') parser.add_argument('--ann_file', required=True, help='Path to the annotation file') parser.add_argument('--an_name', required=True, help='Namespace or title for the annotation') parser.add_argument('--log_file', default='metadata_import_log.txt', help='Path to the log file')