dDAGannotate: Function to generate a subgraph of a direct acyclic graph...

Description Usage Arguments Value Note See Also Examples

Description

dDAGannotate is supposed to produce a subgraph induced by the input annotation data, given a direct acyclic graph (DAG; an ontology). The input is a graph of "igraph" or "graphNET" object, a list of the vertices containing annotation data, and the mode defining the paths to the root of DAG. The induced subgraph contains vertices (with annotation data) and their ancestors along with the defined paths to the root of DAG. The annotations at these vertices (including their ancestors) are also updated according to the true-path rule: a gene annotated to a term should also be annotated by its all ancestor terms.

Usage

1
2
3
4
5
6
dDAGannotate(
g,
annotations,
path.mode = c("all_paths", "shortest_paths", "all_shortest_paths"),
verbose = TRUE
)

Arguments

g

an object of class "igraph" or "graphNEL"

annotations

the vertices/nodes for which annotation data are provided

path.mode

the mode of paths induced by vertices/nodes with input annotation data. It can be "all_paths" for all possible paths to the root, "shortest_paths" for only one path to the root (for each node in query), "all_shortest_paths" for all shortest paths to the root (i.e. for each node, find all shortest paths with the equal lengths)

verbose

logical to indicate whether the messages will be displayed in the screen. By default, it sets to true for display

Value

Note

For the mode "shortest_paths", the induced subgraph is the most concise, and thus informative for visualisation when there are many nodes in query, while the mode "all_paths" results in the complete subgraph.

See Also

dDAGinduce, dDAGlevel

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## Not run: 
# 1) load HPPA as igraph object
ig.HPPA <-dRDataLoader(RData='ig.HPPA')
g <- ig.HPPA

# 2) load human genes annotated by HPPA
org.Hs.egHPPA <- dRDataLoader(RData='org.Hs.egHPPA')
GS <- org.Hs.egHPPA # as 'GS' object

# 3) prepare for annotation data
# randomly select vertices with annotation data
annotations <- GS$gs[sample(1:length(GS$gs),5)]

# 4) obtain the induced subgraph
# 4a) based on all possible paths (i.e. the complete subgraph induced)
dDAGannotate(g, annotations, path.mode="all_paths", verbose=TRUE)
# 4b) based on shortest paths (i.e. the most concise subgraph induced)
dag <- dDAGannotate(g, annotations, path.mode="shortest_paths",
verbose=TRUE)

# 5) color-code nodes/terms according to the number of annotations
data <- sapply(V(dag)$annotations, length)
names(data) <- V(dag)$name
visDAG(g=dag, data=data, node.info="both")

## End(Not run)

Example output

Loading required package: igraph

Attaching package: 'igraph'

The following objects are masked from 'package:stats':

    decompose, spectrum

The following object is masked from 'package:base':

    union

Loading required package: supraHex
Loading required package: hexbin
'ig.HPPA' (from package 'dnet' version 1.1.4) has been loaded into the working environment (at 2020-10-21 03:33:19)
'org.Hs.egHPPA' (from package 'dnet' version 1.1.4) has been loaded into the working environment (at 2020-10-21 03:33:20)
	At level 8, there are 1 nodes, and 1 incoming neighbors.
	At level 7, there are 2 nodes, and 2 incoming neighbors.
	At level 6, there are 3 nodes, and 3 incoming neighbors.
	At level 5, there are 3 nodes, and 3 incoming neighbors.
	At level 4, there are 5 nodes, and 5 incoming neighbors.
	At level 3, there are 5 nodes, and 5 incoming neighbors.
	At level 2, there are 5 nodes, and 1 incoming neighbors.
	At level 1, there are 1 nodes, and 0 incoming neighbors.
IGRAPH cd90264 DN-- 25 24 -- 
+ attr: name (v/c), term_id (v/c), term_name (v/c), term_distance
| (v/n), annotations (v/x), IC (v/n), relation (e/c)
+ edges from cd90264 (vertex names):
 [1] HP:0000118->HP:0000152 HP:0000118->HP:0000478 HP:0000118->HP:0000598
 [4] HP:0000118->HP:0000924 HP:0000118->HP:0002715 HP:0000152->HP:0000234
 [7] HP:0000478->HP:0012372 HP:0000598->HP:0000356 HP:0000924->HP:0011842
[10] HP:0002715->HP:0010978 HP:0012372->HP:0012374 HP:0000234->HP:0000271
[13] HP:0000356->HP:0000377 HP:0010978->HP:0002960 HP:0011842->HP:0003330
[16] HP:0000271->HP:0000366 HP:0002960->HP:0030057 HP:0012374->HP:0004328
[19] HP:0030057->HP:0003493 HP:0000366->HP:0010938 HP:0004328->HP:0000481
+ ... omitted several edges
	At level 8, there are 1 nodes, and 1 incoming neighbors.
	At level 7, there are 2 nodes, and 2 incoming neighbors.
	At level 6, there are 3 nodes, and 3 incoming neighbors.
	At level 5, there are 3 nodes, and 3 incoming neighbors.
	At level 4, there are 5 nodes, and 5 incoming neighbors.
	At level 3, there are 5 nodes, and 5 incoming neighbors.
	At level 2, there are 5 nodes, and 1 incoming neighbors.
	At level 1, there are 1 nodes, and 0 incoming neighbors.

dnet documentation built on Feb. 20, 2020, 5:08 p.m.

Related to dDAGannotate in dnet...