3
3
"""Converter for Rhea."""
4
4
5
5
import logging
6
- from typing import Dict , Iterable , Optional
6
+ from typing import TYPE_CHECKING , Dict , Iterable , Optional
7
7
8
8
import bioversions
9
9
import pystow
21
21
)
22
22
from pyobo .utils .path import ensure_df
23
23
24
+ if TYPE_CHECKING :
25
+ import rdflib
26
+
24
27
__all__ = [
25
28
"RheaGetter" ,
26
29
]
@@ -124,8 +127,7 @@ def iter_terms(version: str, force: bool = False) -> Iterable[Term]:
124
127
?compound rh:chebi|rh:underlyingChebi|(rh:reactivePart/rh:chebi) ?chebi .
125
128
}
126
129
"""
127
- results = graph .query (sparql )
128
- for master_rhea_id , side_uri , chebi_uri in results :
130
+ for master_rhea_id , side_uri , chebi_uri in graph .query (sparql ):
129
131
master_rhea_id = str (master_rhea_id )
130
132
chebi_reference = Reference (
131
133
prefix = "chebi" , identifier = chebi_uri [len ("http://purl.obolibrary.org/obo/CHEBI_" ) :]
@@ -161,7 +163,7 @@ def iter_terms(version: str, force: bool = False) -> Iterable[Term]:
161
163
("macie" , "rhea2macie" , None ),
162
164
("metacyc" , "rhea2metacyc" , None ),
163
165
("go" , "rhea2go" , None ), # TODO what is the relationship?
164
- ("go " , "rhea2uniprot" , enabled_by ),
166
+ ("uniprot " , "rhea2uniprot" , enabled_by ),
165
167
]:
166
168
xref_df = ensure_df (
167
169
PREFIX ,
@@ -188,7 +190,7 @@ def iter_terms(version: str, force: bool = False) -> Iterable[Term]:
188
190
189
191
ec_df = ensure_df (
190
192
PREFIX ,
191
- url = f "ftp://ftp.expasy.org/databases/rhea/tsv/rhea-ec-iubmb.tsv" ,
193
+ url = "ftp://ftp.expasy.org/databases/rhea/tsv/rhea-ec-iubmb.tsv" ,
192
194
version = version ,
193
195
force = force ,
194
196
)
0 commit comments