routes
find_compound_outflux_routes(db, compound_id, reaction_gene_expression, expressed_genes=None, drop_nodes=None, max_level=10, max_num_routes=1000, expression_coef=1.0, structure_similarity_coef=10.0, route_length_coef=0.0)
Find how a compound is consumed. Genes are either expressed or unexpressed, so this is a rather binary view of the metabolic network.
When searching for routes, we start from the compound of interest, and expand to other compounds via reactions that are:
- TODO: reversible, or
- (physiol_)left_to_right, with the compound of interest on the left.
Whenever we encounter a reaction that's catalyzed by an unexpressed enzyme, we stop the path search. Reactions that are not catalyzed by enzymes are always included in the search.
For details on how the optional parameters are used, see: https://neo4j.com/labs/apoc/4.4/overview/apoc.path/apoc.path.expandConfig/
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
db |
Neo4jClient
|
A Neo4j client connected to the graph database. |
required |
compound_id |
str
|
The metaId of the compound of interest. |
required |
reaction_gene_expression |
ReactionGeneMap
|
Expression levels of the reactions. |
required |
expressed_genes |
Iterable[str]
|
A list of genes that are considered expressed. If not given, all genes are considered expressed. |
None
|
drop_nodes |
list[str]
|
The metaId or name of blacklisted Reaction/Compound nodes. |
None
|
max_level |
int
|
The maximum number of hops in the traversal. |
10
|
max_num_routes |
int
|
The maximum number of routes to return. |
1000
|
expression_coef |
float
|
Score coefficient for route expression level. |
1.0
|
structure_similarity_coef |
float
|
Score coefficient for metabolite similarity score. |
10.0
|
route_length_coef |
float
|
Score coefficient for length of route. |
0.0
|
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
Paths to sinks of the given metabolite. |
Source code in algo/routes.py
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | |
get_cpd_view_of_pathway(db, pathway_id, ignore_cpds=COMMON_COMPOUNDS)
Get the view of a pathway with primary compounds linked by reactions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pathway_id |
str
|
The pathway metaId or name. |
required |
ignore_cpds |
list[str]
|
A list of common compound names to ignore. |
COMMON_COMPOUNDS
|
Source code in algo/routes.py
get_fba_info_of_pathways(db, pathway_ids)
Retrieve the information of a pathway relevant to flux balance analysis.
Source code in algo/routes.py
get_genes_of_reaction(db, reaction_id)
Given a reaction metaId, return the gene products associated with it in the form of a list
of (source, target) nodes. This is because certain reactions are associated with
GeneProductSet or GeneProductComplex nodes, which represent OR and AND
relationships, respectively.
Note that GeneProductSet could contain nested GeneProductComplex nodes.
Source code in algo/routes.py
get_high_degree_compound_nodes(db, degree=45)
Get all compound nodes with a high degree, i.e. with a lot of edges to Reaction nodes.
Including these nodes in many cases would pollute the graph with too many outgoing
relationships.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
degree |
int
|
The degree threshold. |
45
|
Returns:
| Type | Description |
|---|---|
list[str]
|
A list of mcID of compound nodes. |
Source code in algo/routes.py
get_reaction_route_between_compounds(db, c1, c2, only_pathway_reactions=True, ignore_node_metaids=[], num_routes=2, max_hops=10)
The function has two modes: one for following pre-defined pathways, and one for following any chain of reactions between two compounds.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
c1 |
str
|
The first compound metaId. |
required |
c2 |
str
|
The second compound metaId. |
required |
only_pathway_reactions |
bool
|
If True, only follow reactions in pathways. |
True
|
ignore_node_metaids |
list[str]
|
A list of metaIds to ignore. |
[]
|
num_routes |
int
|
The number of routes to return. |
2
|
max_hops |
int
|
The maximum number of hops to follow. When argument
|
10
|
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
A list of possible routes. |
Source code in algo/routes.py
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | |
get_view_of_pathway(db, pathway_id)
Get the view of a pathway.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pathway_id |
str
|
The pathway ID. |
required |
Returns:
| Type | Description |
|---|---|
tuple[list[dict[str, Any]], list[dict, str, Any]]
|
The view of the pathway. |