Mercurial > repos > tduigou > retrorules
annotate query.py @ 4:815748762646 draft default tip
planemo upload for repository https://github.com/brsynth/galaxytools commit d7030c1af6fe06a1d45af115756ee775721e39b5
| author | tduigou |
|---|---|
| date | Thu, 02 Oct 2025 14:27:31 +0000 |
| parents | 95b4196b4ded |
| children |
| rev | line source |
|---|---|
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
1 import argparse |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
2 import json |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
3 import logging |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
4 import sys |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
5 from typing import Dict, Tuple |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
6 |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
7 import requests |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
8 |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
9 BASE_URL = "https://retrorules.org/api" |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
10 |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
11 |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
12 def from_templates( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
13 smarts_str: str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
14 template_ids_str: str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
15 reaction_ids_str: str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
16 datasets_str: str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
17 chemical_domain_str: str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
18 ec_number_str: str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
19 min_radius_int: int, |
|
4
815748762646
planemo upload for repository https://github.com/brsynth/galaxytools commit d7030c1af6fe06a1d45af115756ee775721e39b5
tduigou
parents:
3
diff
changeset
|
20 valid_str: str, |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
21 dedup_str: str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
22 limit_int: int, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
23 offset_int: int, |
|
4
815748762646
planemo upload for repository https://github.com/brsynth/galaxytools commit d7030c1af6fe06a1d45af115756ee775721e39b5
tduigou
parents:
3
diff
changeset
|
24 ) -> Tuple: |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
25 url = f"{BASE_URL}/templates" |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
26 params = [] |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
27 if smarts_str: |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
28 params.append(("q", smarts_str)) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
29 if template_ids_str: |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
30 params.append(("template_ids", ",".join(template_ids_str))) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
31 if reaction_ids_str: |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
32 params.append(("reaction_ids", ",".join(reaction_ids_str))) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
33 if datasets_str and datasets_str != "any": |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
34 params.append(("datasets", datasets_str)) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
35 if chemical_domain_str and chemical_domain_str != "any": |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
36 params.append(("chemical_domain", chemical_domain_str)) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
37 if ec_number_str: |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
38 params.append(("ec", ec_number_str)) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
39 if min_radius_int is not None: |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
40 params.append(("min_radius", str(min_radius_int))) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
41 if valid_str and valid_str != "any": |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
42 params.append(("valid", valid_str)) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
43 if dedup_str and dedup_str != "any": |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
44 params.append(("dedup", dedup_str)) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
45 if limit_int: |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
46 params.append(("limit", str(limit_int))) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
47 if offset_int: |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
48 params.append(("offset", str(offset_int))) |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
49 return url, params |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
50 |
|
4
815748762646
planemo upload for repository https://github.com/brsynth/galaxytools commit d7030c1af6fe06a1d45af115756ee775721e39b5
tduigou
parents:
3
diff
changeset
|
51 |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
52 def from_templates_summary(template_id_str: str) -> Tuple: |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
53 url = f"{BASE_URL}/templates/{template_id_str}/summary" |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
54 params = {} |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
55 return url, params |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
56 |
|
4
815748762646
planemo upload for repository https://github.com/brsynth/galaxytools commit d7030c1af6fe06a1d45af115756ee775721e39b5
tduigou
parents:
3
diff
changeset
|
57 |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
58 def from_templates_sources(template_id_str: str) -> Tuple: |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
59 url = f"{BASE_URL}/templates/{template_id_str}/sources" |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
60 params = {} |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
61 return url, params |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
62 |
|
4
815748762646
planemo upload for repository https://github.com/brsynth/galaxytools commit d7030c1af6fe06a1d45af115756ee775721e39b5
tduigou
parents:
3
diff
changeset
|
63 |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
64 def from_templates_count( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
65 smarts_str: str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
66 template_ids_str: str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
67 reaction_ids_str: str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
68 datasets_str: str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
69 chemical_domain_str: str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
70 ec_number_str: str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
71 min_radius_int: int, |
|
4
815748762646
planemo upload for repository https://github.com/brsynth/galaxytools commit d7030c1af6fe06a1d45af115756ee775721e39b5
tduigou
parents:
3
diff
changeset
|
72 valid_str: str, |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
73 dedup_str: str, |
|
4
815748762646
planemo upload for repository https://github.com/brsynth/galaxytools commit d7030c1af6fe06a1d45af115756ee775721e39b5
tduigou
parents:
3
diff
changeset
|
74 ) -> Tuple: |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
75 url = f"{BASE_URL}/templates_count" |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
76 params = [] |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
77 if smarts_str: |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
78 params.append(("q", smarts_str)) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
79 if template_ids_str: |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
80 params.append(("template_ids", ",".join(template_ids_str))) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
81 if reaction_ids_str: |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
82 params.append(("reaction_ids", ",".join(reaction_ids_str))) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
83 if datasets_str and datasets_str != "any": |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
84 params.append(("datasets", datasets_str)) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
85 if chemical_domain_str and chemical_domain_str != "any": |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
86 params.append(("chemical_domain", chemical_domain_str)) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
87 if ec_number_str: |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
88 params.append(("ec", ec_number_str)) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
89 if min_radius_int is not None: |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
90 params.append(("min_radius", str(min_radius_int))) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
91 if valid_str and valid_str != "any": |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
92 params.append(("valid", valid_str)) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
93 if dedup_str and dedup_str != "any": |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
94 params.append(("dedup", dedup_str)) |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
95 return url, params |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
96 |
|
4
815748762646
planemo upload for repository https://github.com/brsynth/galaxytools commit d7030c1af6fe06a1d45af115756ee775721e39b5
tduigou
parents:
3
diff
changeset
|
97 |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
98 def from_templates_export( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
99 generation_token_str: str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
100 smarts_str: str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
101 template_ids_str: str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
102 reaction_ids_str: str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
103 datasets_str: str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
104 chemical_domain_str: str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
105 ec_number_str: str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
106 min_radius_int: int, |
|
4
815748762646
planemo upload for repository https://github.com/brsynth/galaxytools commit d7030c1af6fe06a1d45af115756ee775721e39b5
tduigou
parents:
3
diff
changeset
|
107 valid_str: str, |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
108 dedup_str: str, |
|
4
815748762646
planemo upload for repository https://github.com/brsynth/galaxytools commit d7030c1af6fe06a1d45af115756ee775721e39b5
tduigou
parents:
3
diff
changeset
|
109 ) -> Tuple: |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
110 url = f"{BASE_URL}/templates_export" |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
111 params = [] |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
112 if generation_token_str: |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
113 params.append(("gen_token", generation_token_str)) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
114 if smarts_str: |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
115 params.append(("q", smarts_str)) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
116 if template_ids_str: |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
117 params.append(("template_ids", ",".join(template_ids_str))) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
118 if reaction_ids_str: |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
119 params.append(("reaction_ids", ",".join(reaction_ids_str))) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
120 if datasets_str and datasets_str != "any": |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
121 params.append(("datasets", datasets_str)) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
122 if chemical_domain_str and chemical_domain_str != "any": |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
123 params.append(("chemical_domain", chemical_domain_str)) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
124 if ec_number_str: |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
125 params.append(("ec", ec_number_str)) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
126 if min_radius_int is not None: |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
127 params.append(("min_radius", str(min_radius_int))) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
128 if valid_str and valid_str != "any": |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
129 params.append(("valid", valid_str)) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
130 if dedup_str and dedup_str != "any": |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
131 params.append(("dedup", dedup_str)) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
132 return url, params |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
133 |
|
4
815748762646
planemo upload for repository https://github.com/brsynth/galaxytools commit d7030c1af6fe06a1d45af115756ee775721e39b5
tduigou
parents:
3
diff
changeset
|
134 |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
135 def query(url: str, params: Dict): |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
136 response = requests.get(url, params=params) |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
137 response.raise_for_status() |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
138 return response |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
139 |
|
4
815748762646
planemo upload for repository https://github.com/brsynth/galaxytools commit d7030c1af6fe06a1d45af115756ee775721e39b5
tduigou
parents:
3
diff
changeset
|
140 |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
141 def write_json(path: str, data: Dict): |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
142 with open(path, "w") as fd: |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
143 json.dump(data, fd, indent=4) |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
144 |
|
4
815748762646
planemo upload for repository https://github.com/brsynth/galaxytools commit d7030c1af6fe06a1d45af115756ee775721e39b5
tduigou
parents:
3
diff
changeset
|
145 |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
146 def write_tab(path: str, data: str): |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
147 with open(path, "w") as fd: |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
148 fd.write(data) |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
149 |
|
4
815748762646
planemo upload for repository https://github.com/brsynth/galaxytools commit d7030c1af6fe06a1d45af115756ee775721e39b5
tduigou
parents:
3
diff
changeset
|
150 |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
151 def main(): |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
152 parser = argparse.ArgumentParser( |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
153 description="Query RetroRules API via command-line endpoints." |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
154 ) |
|
2
58bbbff358d6
planemo upload for repository https://github.com/brsynth/galaxytools commit 469ebd8616b81810ead4633c278dc4c65ab8603b
tduigou
parents:
0
diff
changeset
|
155 subparsers = parser.add_subparsers(dest="command") |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
156 |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
157 # Subcommand: templates |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
158 parser_tem = subparsers.add_parser("templates", help="From templates") |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
159 parser_tem.add_argument("--input-smarts-str", help="Exact SMARTS") |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
160 parser_tem.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
161 "--input-template-ids-str", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
162 nargs="*", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
163 help="Space separated list of template IDs", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
164 ) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
165 parser_tem.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
166 "--input-reaction-ids-str", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
167 nargs="*", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
168 help="Space separated list of reaction IDs", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
169 ) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
170 parser_tem.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
171 "--input-datasets-str", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
172 default="any", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
173 choices=["any", "metanetx", "rhea", "uspto"], |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
174 help="Select a specific database", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
175 ) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
176 parser_tem.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
177 "--input-chemical-domain-str", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
178 default="any", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
179 choices=["any", "biochem", "orgchem"], |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
180 ) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
181 parser_tem.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
182 "--input-ec-number-str", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
183 help="EC number to filter templates", |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
184 ) |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
185 parser_tem.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
186 "--input-min-radius-int", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
187 type=int, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
188 help="Single radius of the template", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
189 ) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
190 parser_tem.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
191 "--input-valid-str", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
192 default="true", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
193 choices=["any", "true", "false"], |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
194 help="By default only valid templates are returned", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
195 ) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
196 parser_tem.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
197 "--input-dedup-str", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
198 default="true", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
199 choices=["true", "false"], |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
200 help="By default deduplicated templates are returned", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
201 ) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
202 parser_tem.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
203 "--input-limit-int", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
204 type=int, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
205 help="Limit number of returned templates", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
206 ) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
207 parser_tem.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
208 "--input-offset-int", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
209 type=int, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
210 help="Offset the list of returned templates", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
211 ) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
212 parser_tem.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
213 "--output-data-json", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
214 required=True, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
215 help="Path to output JSON file", |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
216 ) |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
217 |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
218 # Subcommand: templates-summary |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
219 parser_tem_sum = subparsers.add_parser("templates-summary", help="From templates-summary") |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
220 parser_tem_sum.add_argument("--input-template-id-str", required=True, help="Template ID") |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
221 parser_tem_sum.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
222 "--output-data-json", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
223 required=True, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
224 help="Path to output JSON file", |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
225 ) |
|
4
815748762646
planemo upload for repository https://github.com/brsynth/galaxytools commit d7030c1af6fe06a1d45af115756ee775721e39b5
tduigou
parents:
3
diff
changeset
|
226 |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
227 # Subcommand: templates-sources |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
228 parser_tem_sou = subparsers.add_parser("templates-sources", help="From templates-sources") |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
229 parser_tem_sou.add_argument("--input-template-id-str", required=True, help="Template ID") |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
230 parser_tem_sou.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
231 "--output-data-json", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
232 required=True, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
233 help="Path to output JSON file", |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
234 ) |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
235 |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
236 # Subcommand: templates-count |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
237 parser_cou = subparsers.add_parser("templates-count", help="From templates-count") |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
238 parser_cou.add_argument("--input-smarts-str", help="Exact SMARTS") |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
239 parser_cou.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
240 "--input-template-ids-str", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
241 nargs="*", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
242 help="Space separated list of template IDs", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
243 ) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
244 parser_cou.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
245 "--input-reaction-ids-str", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
246 nargs="*", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
247 help="Space separated list of reaction IDs", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
248 ) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
249 parser_cou.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
250 "--input-datasets-str", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
251 default="any", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
252 choices=["any", "metanetx", "rhea", "uspto"], |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
253 help="Select a specific database", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
254 ) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
255 parser_cou.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
256 "--input-chemical-domain-str", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
257 default="any", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
258 choices=["any", "biochem", "orgchem"], |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
259 ) |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
260 parser_cou.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
261 "--input-ec-number-str", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
262 help="EC number to filter templates", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
263 ) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
264 parser_cou.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
265 "--input-min-radius-int", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
266 type=int, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
267 help="Single radius of the template", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
268 ) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
269 parser_cou.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
270 "--input-valid-str", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
271 default="true", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
272 choices=["any", "true", "false"], |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
273 help="By default only valid templates are returned", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
274 ) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
275 parser_cou.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
276 "--input-dedup-str", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
277 default="true", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
278 choices=["true", "false"], |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
279 help="By default deduplicated templates are returned", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
280 ) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
281 parser_cou.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
282 "--output-data-json", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
283 required=True, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
284 help="Path to output JSON file", |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
285 ) |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
286 |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
287 # Subcommand: templates-export |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
288 parser_exp = subparsers.add_parser("templates-export", help="From templates-export") |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
289 parser_exp.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
290 "--input-generation-token-str", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
291 help="Generation token from RetroRules web interface", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
292 ) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
293 parser_exp.add_argument("--input-smarts-str", help="Exact SMARTS") |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
294 parser_exp.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
295 "--input-template-ids-str", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
296 nargs="*", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
297 help="Space separated list of template IDs", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
298 ) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
299 parser_exp.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
300 "--input-reaction-ids-str", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
301 nargs="*", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
302 help="Space separated list of reaction IDs", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
303 ) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
304 parser_exp.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
305 "--input-datasets-str", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
306 default="any", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
307 choices=["any", "metanetx", "rhea", "uspto"], |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
308 help="Select a specific database", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
309 ) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
310 parser_exp.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
311 "--input-chemical-domain-str", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
312 default="any", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
313 choices=["any", "biochem", "orgchem"], |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
314 ) |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
315 parser_exp.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
316 "--input-ec-number-str", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
317 help="EC number to filter templates", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
318 ) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
319 parser_exp.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
320 "--input-min-radius-int", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
321 type=int, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
322 help="Single radius of the template", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
323 ) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
324 parser_exp.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
325 "--input-valid-str", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
326 default="true", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
327 choices=["any", "true", "false"], |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
328 help="By default only valid templates are returned", |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
329 ) |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
330 parser_exp.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
331 "--input-dedup-str", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
332 default="true", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
333 choices=["true", "false"], |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
334 help="By default deduplicated templates are returned", |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
335 ) |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
336 parser_exp.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
337 "--output-data-json", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
338 help="Path to output JSON file", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
339 ) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
340 parser_exp.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
341 "--output-data-csv", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
342 help="Path to output CSV file", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
343 ) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
344 parser_exp.add_argument( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
345 "--output-data-tsv", |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
346 help="Path to output TSV file", |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
347 ) |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
348 |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
349 logging.info("Query RetroRules - start") |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
350 args = parser.parse_args() |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
351 |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
352 try: |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
353 logging.info("Build arguments") |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
354 url, params = "", {} |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
355 if args.command == "templates": |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
356 url, params = from_templates( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
357 smarts_str=args.input_smarts_str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
358 template_ids_str=args.input_template_ids_str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
359 reaction_ids_str=args.input_reaction_ids_str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
360 datasets_str=args.input_datasets_str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
361 chemical_domain_str=args.input_chemical_domain_str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
362 ec_number_str=args.input_ec_number_str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
363 min_radius_int=args.input_min_radius_int, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
364 valid_str=args.input_valid_str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
365 dedup_str=args.input_dedup_str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
366 limit_int=args.input_limit_int, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
367 offset_int=args.input_offset_int, |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
368 ) |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
369 elif args.command == "templates-summary": |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
370 url, _ = from_templates_summary( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
371 template_id_str=args.input_template_id_str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
372 ) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
373 elif args.command == "templates-sources": |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
374 url, _ = from_templates_sources( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
375 template_id_str=args.input_template_id_str, |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
376 ) |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
377 elif args.command == "templates-count": |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
378 url, params = from_templates_count( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
379 smarts_str=args.input_smarts_str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
380 template_ids_str=args.input_template_ids_str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
381 reaction_ids_str=args.input_reaction_ids_str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
382 datasets_str=args.input_datasets_str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
383 chemical_domain_str=args.input_chemical_domain_str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
384 ec_number_str=args.input_ec_number_str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
385 min_radius_int=args.input_min_radius_int, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
386 valid_str=args.input_valid_str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
387 dedup_str=args.input_dedup_str, |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
388 ) |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
389 elif args.command == "templates-export": |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
390 url, params = from_templates_export( |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
391 generation_token_str=args.input_generation_token_str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
392 smarts_str=args.input_smarts_str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
393 template_ids_str=args.input_template_ids_str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
394 reaction_ids_str=args.input_reaction_ids_str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
395 datasets_str=args.input_datasets_str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
396 chemical_domain_str=args.input_chemical_domain_str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
397 ec_number_str=args.input_ec_number_str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
398 min_radius_int=args.input_min_radius_int, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
399 valid_str=args.input_valid_str, |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
400 dedup_str=args.input_dedup_str, |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
401 ) |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
402 else: |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
403 parser.print_help() |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
404 sys.exit(1) |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
405 |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
406 logging.info("Query API") |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
407 response = query(url=url, params=params) |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
408 |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
409 logging.info("Write data") |
|
3
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
410 if "output_data_json" in vars(args) and args.output_data_json: |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
411 write_json(path=args.output_data_json, data=response.json()) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
412 if "output_data_csv" in vars(args) and args.output_data_csv: |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
413 write_tab(path=args.output_data_csv, data=response.text) |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
414 if "output_data_tsv" in vars(args) and args.output_data_tsv: |
|
95b4196b4ded
planemo upload for repository https://github.com/brsynth/galaxytools commit 5e85823d729e9e09adf66ccfb7c47701077dccff-dirty
tduigou
parents:
2
diff
changeset
|
415 write_tab(path=args.output_data_tsv, data=response.text) |
|
0
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
416 except requests.HTTPError as e: |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
417 logging.error(f"HTTP error: {e.response.status_code} - {e.response.text}") |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
418 sys.exit(1) |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
419 except Exception as e: |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
420 logging.error(f"Error: {e}") |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
421 sys.exit(1) |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
422 |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
423 logging.info("Query RetroRules - end") |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
424 |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
425 |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
426 if __name__ == "__main__": |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
427 logging.basicConfig( |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
428 level=logging.INFO, |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
429 format="%(asctime)s - %(levelname)s - %(message)s", |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
430 datefmt="%d-%m-%Y %H:%M", |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
431 ) |
|
6d20407d9a72
planemo upload for repository https://github.com/brsynth/galaxytools commit ccd77691de09b70e3048dca6be832dd93964c635-dirty
tduigou
parents:
diff
changeset
|
432 main() |
