Last data update: 2014.03.03

R: Get the smallest pathway
smallest_pathwayR Documentation

Get the smallest pathway

Description

Find the pathway with the fewer number of nodes among a list of pathways. This simple function is an example of how to navigate the genes on a list of pathways.

Usage

smallest_pathway(pathways)

Arguments

pathways

A list of graph::graphNEL objects.

Value

The index of the pathway with fewer number of nodes.

Author(s)

Diana Diaz <dmd at wayne dot edu>

Examples

data(augmented_pathways)
smallest_pathway(augmented_pathways)
smallest_pathway

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(mirIntegrator)

> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/mirIntegrator/smallest_pathway.Rd_%03d_medium.png", width=480, height=480)
> ### Name: smallest_pathway
> ### Title: Get the smallest pathway
> ### Aliases: smallest_pathway
> 
> ### ** Examples
> 
> data(augmented_pathways)
> smallest_pathway(augmented_pathways)
[1] 18
> smallest_pathway
function (pathways) 
{
    min <- Inf
    j <- 0
    for (i in seq_along(pathways)) {
        n_nodes <- length(graph::nodes(pathways[[i]]))
        if (min > n_nodes) {
            min <- n_nodes
            j <- i
        }
    }
    j
}
<environment: namespace:mirIntegrator>
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>