comparison omero_metadata_upload.py @ 5:4291d37da555 draft

planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 636cbb62d59819caca5bc9eab0a8ec31be5bdd46
author ufz
date Mon, 16 Dec 2024 20:56:56 +0000
parents e41f70e69349
children
comparison
equal deleted inserted replaced
4:351c6b43e16c 5:4291d37da555
54 result = upload_metadata(conn, "Screen", did, data_dict, df, ann_type, an_name) 54 result = upload_metadata(conn, "Screen", did, data_dict, df, ann_type, an_name)
55 elif obj_type == "dataset": 55 elif obj_type == "dataset":
56 if did is None: 56 if did is None:
57 did = ez.post_dataset(conn, dataset_name=str(datetime.now())) 57 did = ez.post_dataset(conn, dataset_name=str(datetime.now()))
58 result = upload_metadata(conn, "Dataset", did, data_dict, df, ann_type, an_name) 58 result = upload_metadata(conn, "Dataset", did, data_dict, df, ann_type, an_name)
59 elif obj_type == "plate":
60 result = upload_metadata(conn, "Plate", did, data_dict, df, ann_type, an_name)
61 elif obj_type == "well":
62 result = upload_metadata(conn, "Well", did, data_dict, df, ann_type, an_name)
59 elif obj_type == "image": 63 elif obj_type == "image":
60 result = upload_metadata(conn, "Image", did, data_dict, df, ann_type, an_name) 64 result = upload_metadata(conn, "Image", did, data_dict, df, ann_type, an_name)
61 else: 65 else:
62 raise ValueError("Unsupported object type provided: {}".format(obj_type)) 66 raise ValueError("Unsupported object type provided: {}".format(obj_type))
63 67
72 log_error(f"Connection error: {str(e)}") 76 log_error(f"Connection error: {str(e)}")
73 77
74 78
75 if __name__ == "__main__": 79 if __name__ == "__main__":
76 parser = argparse.ArgumentParser(description='Import metadata into OMERO.') 80 parser = argparse.ArgumentParser(description='Import metadata into OMERO.')
77 parser.add_argument("--credential-file", dest="credential_file", type=str, required=True, help="Credential file (JSON file with username and password for OMERO)") 81 parser.add_argument("--credential-file", dest="credential_file", type=str, required=True,
82 help="Credential file (JSON file with username and password for OMERO)")
78 parser.add_argument('--host', required=True, help='OMERO host') 83 parser.add_argument('--host', required=True, help='OMERO host')
79 parser.add_argument('--port', required=True, type=int, help='OMERO port') 84 parser.add_argument('--port', required=True, type=int, help='OMERO port')
80 parser.add_argument('--obj_type', required=True, choices=['project', 'screen', 'dataset', 'image'], 85 parser.add_argument('--obj_type', required=True, choices=['project', 'screen', 'dataset', 'plate',
86 'well ', 'image'],
81 help='Type of OMERO object') 87 help='Type of OMERO object')
82 parser.add_argument('--did', type=int, help='ID of the object (if it exists)') 88 parser.add_argument('--did', type=int, help='ID of the object (if it exists)')
83 parser.add_argument('--ann_type', required=True, choices=['table', 'KV'], help='Annotation type') 89 parser.add_argument('--ann_type', required=True, choices=['table', 'KV'], help='Annotation type')
84 parser.add_argument('--ann_file', required=True, help='Path to the annotation file') 90 parser.add_argument('--ann_file', required=True, help='Path to the annotation file')
85 parser.add_argument('--an_name', required=True, help='Namespace or title for the annotation') 91 parser.add_argument('--an_name', required=True, help='Namespace or title for the annotation')