Cut the input igraph object by the distances from the root.

filterGraph(
  g,
  leaveTerms,
  cutoff = 4,
  filterNodesByEdgeNumber = 0,
  mustkeep = c(),
  onlyKeep = c()
)

Arguments

g

A igraph object

leaveTerms

Leaves must contained GO terms.

cutoff

The cutoff distance from the root

filterNodesByEdgeNumber

Filter the graphs by the edge number.

mustkeep

The GO terms must be kept.

onlyKeep

Only keep branches with give GO terms.

Value

A igraph object after filtering

Examples

library(igraph)
#> 
#> Attaching package: ‘igraph’
#> The following objects are masked from ‘package:stats’:
#> 
#>     decompose, spectrum
#> The following object is masked from ‘package:base’:
#> 
#>     union
g_gnp <- sample_gnp(n = 25, p = 0.05)
filterGraph(g_gnp, leaveTerms = V(g_gnp), cutoff = 2)
#>    ancestor offspring
#> 1         1        22
#> 2         1        25
#> 3         5        25
#> 4                    
#> 5         2         3
#> 6                    
#> 7         8        19
#> 8                    
#> 9        13        16
#> 10       16        18
#> 11