You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
""" If requested, adds the corresponding compound IDs of equivalent glycan and/or drug entries to a mapping (assuming mapping from "compound" to some target database).
129
129
130
130
:param mapping: The mapping to add the IDs of compound-equivalents which cross-reference the target database.
131
131
:param source_database: Logs a warning if not equal to "compound" and if the target database name is also not equal to "compound".
132
132
:param target_database: The database with IDs to which compound IDs are mapped.
133
133
:param add_glycans: Whether to add the corresponding compound IDs of KEGG glycan entries.
134
134
:param add_drugs: Whether to add the corresponding compound IDs of KEGG drug entries.
135
+
:param source_op: The REST operation mapping the compound database to glycan/drug.
136
+
:param target_op: The REST operation mapping the glycan/drug database to the target database.
135
137
:param kegg_rest: The KEGGrest object to perform the "link" operation(s). If None, one is created with the default parameters.
136
138
:return: The dictionary.
137
139
:raises RuntimeError: Raised if the request to the KEGG REST API fails or times out.
""" Converts the output of the KEGG "conv" operation (of the form that maps the entry IDs of one database to the entry IDs of another) into a dictionary.
""" Converts the output of the KEGG "conv" operation (of the form that maps the entry IDs of a kegg database to the entry IDs of an outside database) into a dictionary.
169
172
170
173
:param kegg_database: The name of the KEGG database with entry IDs mapped to the outside database.
171
174
:param outside_database: The name of the outside database with entry IDs mapped from the KEGG database.
172
175
:param reverse: Reverses the mapping with the target becoming the source and the source becoming the target. Equivalent to calling the reverse() function of this module.
176
+
:param add_glycans: Whether to add the corresponding compound IDs of equivalent glycan entries. Logs a warning if neither the source nor the target database are "compound".
177
+
:param add_drugs: Whether to add the corresponding compound IDs of equivalent drug entries. Logs a warning if neither the source nor the target database are "compound".
173
178
:param kegg_rest: The KEGGrest object to perform the "conv" operation. If None, one is created with the default parameters.
174
179
:return: The dictionary.
175
180
:raises RuntimeError: Raised if the request to the KEGG REST API fails or times out.
""" Creates a dictionary that maps the entry IDs of a source database to those of a target database using an intermediate database ("link" operation) e.g. ko-to-compound where the intermediate is reaction (connecting cross-references of ko-to-reaction and reaction-to-compound).
""" Creates a dictionary that maps the entry IDs of a source database to those of a target database using an intermediate database e.g. ko-to-compound where the intermediate is reaction (connecting cross-references of ko-to-reaction and reaction-to-compound). The three databases are connected via a combination of either "link" or "conv" operations.
233
245
234
246
:param source_database: The name of the database with entry IDs to map to the target database.
235
247
:param intermediate_database: The name of the database with which two mappings are made i.e. source-to-intermediate and intermediate-to-target, both of which are merged to create source-to-target.
236
248
:param target_database: The name of the database with entry IDs to which those of the source database are mapped.
237
249
:param deduplicate: Some mappings including "pathway" entry IDs result in half beginning with the normal "path:map" prefix but the other half with a different prefix. If True, removes the IDs corresponding to entries that are identical but with a different prefix.
238
250
:param add_glycans: Whether to add the corresponding compound IDs of equivalent glycan entries. Logs a warning if neither the source nor the target database are "compound".
239
251
:param add_drugs: Whether to add the corresponding compound IDs of equivalent drug entries. Logs a warning if neither the source nor the target database are "compound".
240
-
:param kegg_rest: The KEGGrest object to perform the "link" operations. If None, one is created with the default parameters.
252
+
:param source_op: The REST operation mapping the source database to the intermediate database.
253
+
:param target_op: The REST operation mapping the intermediate database to the target database.
254
+
:param kegg_rest: The KEGGrest object to perform the "link" or "conv" operations. If None, one is created with the default parameters.
241
255
:return: The dictionary.
242
256
:raises RuntimeError: Raised if the request to the KEGG REST API fails or times out.
243
257
:raises ValueError: Raised if deduplicate is True but neither source_database nor target_database is "pathway".
@@ -246,13 +260,25 @@ def indirect_link(
246
260
raiseValueError(
247
261
f'The source, intermediate, and target database must all be unique. Databases specified: {source_database}, '
0 commit comments