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