Mercurial > repos > ufz > omero_get_id
annotate omero_get_value.py @ 1:ae07ea142e0f draft
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit d69e684236ce5d36a09e84f1eae6d8c98ed7499b
author | ufz |
---|---|
date | Tue, 29 Oct 2024 06:59:40 +0000 |
parents | c23735b45a4a |
children |
rev | line source |
---|---|
0
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
1 import argparse |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
2 import csv |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
3 import json |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
4 import sys |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
5 |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
6 import ezomero as ez |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
7 |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
8 |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
9 def get_object_ezo(user, pws, host, port, obj_type, ids, tsv_file): |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
10 # Function to write tabular file from the ezomero output |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
11 def write_values_to_tsv(data, header): |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
12 with open(tsv_file, 'w', newline='') as f: |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
13 writer = csv.writer(f, delimiter='\t') |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
14 writer.writerow([header]) # Write the header |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
15 for item in data: |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
16 writer.writerow([item]) # Write each value |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
17 |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
18 # Function to write tabular file from a dictionary ezomero output |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
19 def write_dict_to_tsv(data, headers): |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
20 with open(tsv_file, 'w', newline='') as f: |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
21 writer = csv.writer(f, delimiter='\t') |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
22 writer.writerow(headers) # Write the headers |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
23 for key, value in data.items(): |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
24 writer.writerow([key, value]) # Write each key-value pair |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
25 |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
26 # Function to write tabular file from list of list ezomero output |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
27 def write_table_to_tsv(data): |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
28 with open(tsv_file, 'w') as f: |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
29 for row in data: |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
30 f.write('\t'.join([str(val) for val in row]) + '\n') |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
31 |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
32 with ez.connect(user, pws, "", host, port, secure=True) as conn: |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
33 if obj_type == "Annotation": |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
34 ma_dict = {} |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
35 for maid in ids: |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
36 current_ma_dict = ez.get_map_annotation(conn, maid) |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
37 ma_dict = {**ma_dict, **current_ma_dict} |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
38 write_dict_to_tsv(ma_dict, ["Annotation ID", "Annotation Value"]) |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
39 return ma_dict |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
40 elif obj_type == "Tag": |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
41 tags = [] |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
42 for tag_id in ids: |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
43 tags.append(ez.get_tag(conn, tag_id)) |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
44 # Sort the tags for consistency: |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
45 tags.sort |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
46 write_values_to_tsv(tags, "Tags") |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
47 return tags |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
48 elif obj_type == "Table": |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
49 if len(ids) > 1: |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
50 raise ValueError("Only one table can be exported at a time") |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
51 table = ez.get_table(conn, ids[0]) |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
52 write_table_to_tsv(table) |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
53 return table |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
54 |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
55 else: |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
56 sys.exit(f"Unsupported object type: {filter}") |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
57 |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
58 |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
59 # Argument parsing |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
60 if __name__ == "__main__": |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
61 parser = argparse.ArgumentParser(description="Fetch and save data as TSV based on object type.") |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
62 parser.add_argument("--credential-file", dest="credential_file", type=str, |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
63 required=True, help="Credential file (JSON file with username and password for OMERO)") |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
64 parser.add_argument('--host', required=True, |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
65 help="Host server address.") |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
66 parser.add_argument('--port', required=True, type=int, |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
67 help='OMERO port') |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
68 parser.add_argument('--obj_type', required=True, |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
69 help="Type of object to fetch: Annotation, Table or Tag.") |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
70 group = parser.add_mutually_exclusive_group() |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
71 group.add_argument('--ids', nargs='+', type=int, |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
72 help="IDs of the OMERO objects.") |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
73 group.add_argument('--ids_path', |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
74 help="File with IDs of the OMERO objects (one per line).") |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
75 parser.add_argument('--tsv_file', default='id_list.tsv', required=True, |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
76 help="Output TSV file path.") |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
77 args = parser.parse_args() |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
78 |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
79 if args.ids_path: |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
80 args.ids = [] |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
81 with open(args.ids_path, 'r') as f: |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
82 for line in f: |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
83 try: |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
84 args.ids.append(int(line)) |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
85 except ValueError: |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
86 print(f"{line.strip()} is not a valid ID.") |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
87 if len(args.ids) == 0: |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
88 raise ValueError("Cound not find a single ID in the file.") |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
89 |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
90 with open(args.credential_file, 'r') as f: |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
91 crds = json.load(f) |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
92 |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
93 # Call the main function to get the object and save it as a TSV |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
94 get_object_ezo(user=crds['username'], pws=crds['password'], host=args.host, |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
95 port=args.port, |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
96 obj_type=args.obj_type, |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
97 ids=args.ids, |
c23735b45a4a
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
98 tsv_file=args.tsv_file) |