gpml-cycles | R Documentation |

Tools to find and interpret cycles in graphs derived from pathways in WikiPathways.

```
findCycles(graph)
interpretCycle(v, graph)
cycleSubgraph(graph, cycles)
```

`graph` |
An |

`v` |
One of the cycles produced by the |

`cycles` |
The list of cycles produced by the |

The implementation of the `findCycles`

function, while provably
correct, makes no concessions to efficiency. It is likely to be
adequate for the vast majority of biological pathways present in
WikiPathways, but may prove incapable of handling large complex graphs
in general. The algorithm is a sraightforward double loop. It first
iterates over all nodes, and uses the `neighbors`

function from
`igraph`

to find all nodes that are directly connected to the
start node. It then iterates over those neighbors and uses the
`all_simple_paths`

function from `igraph`

to find all
paths that lead back to the starting node. One aspect of its lack of
efficiency is that each cycle with N nodes is found N times, once for
each place you could start traversing the cycle. Before returning the
value to the user, it chooses a unique representative for each such
cycle by finding the "earliest" node, based on its index, to start
from.

The `findCycles`

function returns a list. Each element of the
list is a cycle, repreented by a named character vector specifying the
nodes in the order that they can be traversed.

The `interpretCycle`

function returns a matrix with two columns,
`genes`

and `arrows`

. Each row contains the gene name (or
label) of a node and the form of the interaction arrow relating it
to the next node in the cycle. Likely to be most often used inside an
`lapply`

function in order to interpret all cycles at once.

The `cycleSubgraph`

function returns an `igraph`

object. This value repesents the subgraph of the full graph defined by
all nodes that are part of at least one cycle.

Kevin R. Coombes krc@silicovore.com, Polina Bombina pbombina@augusta.edu

```
xmlfile <- system.file("pathways/WP3850.gpml", package = "WayFindR")
graf <- GPMLtoIgraph(xmlfile)
cyc <- findCycles(graf)
cyc
CS <- cycleSubgraph(graf, cyc)
plot(CS)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.