Mercurial > repos > ufz > omero_import
annotate omero_get_value.py @ 4:d0c0f3c95368 draft
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
author | ufz |
---|---|
date | Tue, 22 Oct 2024 11:53:53 +0000 |
parents | |
children |
rev | line source |
---|---|
4
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
1 import argparse |
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
2 import csv |
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
3 import json |
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
4 import sys |
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
5 |
d0c0f3c95368
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 |
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
7 |
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
8 |
d0c0f3c95368
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): |
d0c0f3c95368
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 |
d0c0f3c95368
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): |
d0c0f3c95368
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: |
d0c0f3c95368
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') |
d0c0f3c95368
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 |
d0c0f3c95368
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: |
d0c0f3c95368
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 |
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
17 |
d0c0f3c95368
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 |
d0c0f3c95368
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): |
d0c0f3c95368
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: |
d0c0f3c95368
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') |
d0c0f3c95368
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 |
d0c0f3c95368
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(): |
d0c0f3c95368
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 |
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
25 |
d0c0f3c95368
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 |
d0c0f3c95368
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): |
d0c0f3c95368
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: |
d0c0f3c95368
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: |
d0c0f3c95368
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') |
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
31 |
d0c0f3c95368
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: |
d0c0f3c95368
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": |
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
34 ma_dict = {} |
d0c0f3c95368
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: |
d0c0f3c95368
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) |
d0c0f3c95368
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} |
d0c0f3c95368
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"]) |
d0c0f3c95368
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 |
d0c0f3c95368
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": |
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
41 tags = [] |
d0c0f3c95368
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: |
d0c0f3c95368
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)) |
d0c0f3c95368
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: |
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
45 tags.sort |
d0c0f3c95368
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") |
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
47 return tags |
d0c0f3c95368
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": |
d0c0f3c95368
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: |
d0c0f3c95368
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") |
d0c0f3c95368
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]) |
d0c0f3c95368
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) |
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
53 return table |
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
54 |
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
55 else: |
d0c0f3c95368
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}") |
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
57 |
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
58 |
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
59 # Argument parsing |
d0c0f3c95368
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__": |
d0c0f3c95368
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.") |
d0c0f3c95368
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, |
d0c0f3c95368
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)") |
d0c0f3c95368
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, |
d0c0f3c95368
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.") |
d0c0f3c95368
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, |
d0c0f3c95368
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') |
d0c0f3c95368
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, |
d0c0f3c95368
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.") |
d0c0f3c95368
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() |
d0c0f3c95368
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, |
d0c0f3c95368
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.") |
d0c0f3c95368
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', |
d0c0f3c95368
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).") |
d0c0f3c95368
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, |
d0c0f3c95368
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.") |
d0c0f3c95368
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() |
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
78 |
d0c0f3c95368
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: |
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
80 args.ids = [] |
d0c0f3c95368
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: |
d0c0f3c95368
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: |
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
83 try: |
d0c0f3c95368
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)) |
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
85 except ValueError: |
d0c0f3c95368
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.") |
d0c0f3c95368
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: |
d0c0f3c95368
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.") |
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
89 |
d0c0f3c95368
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: |
d0c0f3c95368
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) |
d0c0f3c95368
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 19d84fd5a372f1428e3e5670144881a56e8af8b2
ufz
parents:
diff
changeset
|
92 |
d0c0f3c95368
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 |
d0c0f3c95368
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, |
d0c0f3c95368
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, |
d0c0f3c95368
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, |
d0c0f3c95368
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, |
d0c0f3c95368
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) |