Function to convert an object between graph classes

Description

dcConverter is supposed to convert an object between classes 'Onto' and 'igraph', or between 'Dnetwork' and 'igraph', or between 'Cnetwork' and 'igraph'.

Usage

dcConverter(obj, from = c("Onto", "igraph", "Dnetwork", "Cnetwork"), to = c("igraph", 
  "Onto", "Dnetwork", "Cnetwork"), verbose = TRUE)

Arguments

obj
an object of class "Onto", "igraph", "Dnetwork" or "Cnetwork"
from
a character specifying the class converted from. It can be one of "Onto", "igraph", "Dnetwork" and "Dnetwork"
to
a character specifying the class converted to. It can be one of "Onto", "igraph", "Dnetwork" and "Dnetwork"
verbose
logical to indicate whether the messages will be displayed in the screen. By default, it sets to true for display

Value

an object of class "Onto", "igraph", "Dnetwork" or "Cnetwork"

Note

Conversion is also supported between classes 'Onto' and 'igraph', or between 'Dnetwork' and 'igraph', or between 'Cnetwork' and 'igraph'

Examples

# 1) conversion between 'Onto' and 'igraph' # 1a) load onto.GOMF (as 'Onto' object) on <- dcRDataLoader('onto.GOMF')
'onto.GOMF' (from package 'dcGOR' version 1.0.5) has been loaded into the working environment
on
An object of S4 class 'Onto' @adjMatrix: a direct matrix of 9595 terms (parents/from) X 9595 terms (children/to) @nodeInfo (InfoDataFrame) nodeNames: GO:0003674 GO:0000988 GO:0001071 ... GO:0004008 GO:0086037 (9595 total) nodeAttr: term_id term_name term_namespace term_distance
# 1b) convert the object from 'Onto' to 'igraph' class ig <- dcConverter(on, from='Onto', to='igraph')
Your input object 'on' of class 'Onto' has been converted into an object of class 'igraph'.
ig
IGRAPH DN-- 9595 11543 -- + attr: name (v/c), term_id (v/c), term_name (v/c), term_namespace | (v/c), term_distance (v/c) + edges (vertex names): [1] GO:0003674->GO:0000988 GO:0003674->GO:0001071 GO:0003674->GO:0003824 [4] GO:0003674->GO:0004872 GO:0003674->GO:0005198 GO:0003674->GO:0005215 [7] GO:0003674->GO:0005488 GO:0003674->GO:0009055 GO:0003674->GO:0016015 [10] GO:0003674->GO:0016209 GO:0003674->GO:0016247 GO:0003674->GO:0016530 [13] GO:0003674->GO:0030234 GO:0003674->GO:0030545 GO:0003674->GO:0031386 [16] GO:0003674->GO:0036370 GO:0003674->GO:0042056 GO:0003674->GO:0045182 [19] GO:0003674->GO:0045499 GO:0003674->GO:0045735 GO:0003674->GO:0060089 + ... omitted several edges
# 1c) convert the object from 'igraph' to 'Onto' class dcConverter(ig, from='igraph', to='Onto')
Your input object 'ig' of class 'igraph' has been converted into an object of class 'Onto'.
An object of S4 class 'Onto' @adjMatrix: a direct matrix of 9595 terms (parents/from) X 9595 terms (children/to) @nodeInfo (InfoDataFrame) nodeNames: GO:0003674 GO:0000988 GO:0001071 ... GO:0004008 GO:0086037 (9595 total) nodeAttr: term_id term_name term_namespace term_distance
# 2) conversion between 'Dnetwork' and 'igraph' # 2a) computer a domain semantic network (as 'Dnetwork' object) g <- dcRDataLoader('onto.GOMF')
'onto.GOMF' (from package 'dcGOR' version 1.0.5) has been loaded into the working environment
Anno <- dcRDataLoader('SCOP.sf2GOMF')
'SCOP.sf2GOMF' (from package 'dcGOR' version 1.0.5) has been loaded into the working environment
dag <- dcDAGannotate(g, annotations=Anno, path.mode="shortest_paths", verbose=FALSE) alldomains <- unique(unlist(nInfo(dag)$annotations)) domains <- sample(alldomains,5) # randomly sample 5 domains dnetwork <- dcDAGdomainSim(g=dag, domains=domains, method.domain="BM.average", method.term="Resnik", parallel=FALSE, verbose=FALSE)
Runtime in total is: 115 secs
dnetwork
An object of S4 class 'Dnetwork' @adjMatrix: a weighted symmetric matrix of 5 domains X 5 domains @nodeInfo (InfoDataFrame) nodeNames: 48592 53300 75169 53790 51703 nodeAttr: id
# 2b) convert the object from 'Dnetwork' to 'igraph' class ig <- dcConverter(dnetwork, from='Dnetwork', to='igraph')
Your input object 'dnetwork' of class 'Dnetwork' has been converted into an object of class 'igraph'.
ig
IGRAPH UNW- 5 6 -- + attr: name (v/c), id (v/c), weight (e/n) + edges (vertex names): [1] 48592--53300 48592--53790 53300--53790 48592--51703 53300--51703 [6] 53790--51703
# 2c) convert the object from 'igraph' to 'Dnetwork' class dcConverter(ig, from='igraph', to='Dnetwork')
Your input object 'ig' of class 'igraph' has been converted into an object of class 'Dnetwork'.
An object of S4 class 'Dnetwork' @adjMatrix: a weighted symmetric matrix of 5 domains X 5 domains @nodeInfo (InfoDataFrame) nodeNames: 48592 53300 75169 53790 51703 nodeAttr: id