Definition for S4 class Cnetwork

Description

Cnetwork is an S4 class to store a contact network, such as the one from RWR-based contact between samples/terms by dcRWRpipeline. It has 2 slots: nodeInfo and adjMatrix

Value

Class Cnetwork

Slots

nodeInfoAn object of S4 class InfoDataFrame, describing information on nodes/domains.

adjMatrixAn object of S4 class AdjData, containing symmetric adjacency data matrix for an indirect domain network

Creation

An object of this class can be created via: new("Cnetwork", nodeInfo, adjMatrix)

Methods

Class-specific methods:

  • dim(): retrieve the dimension in the object
  • adjMatrix(): retrieve the slot 'adjMatrix' in the object
  • nodeInfo(): retrieve the slot 'nodeInfo' (as class InfoDataFrame) in the object
  • nInfo(): retrieve nodeInfo (as data.frame) in the object
  • nodeNames(): retrieve node/term names (ie, row names of nodeInfo) in the object

Standard generic methods:

  • str(): compact display of the content in the object
  • show(): abbreviated display of the object
  • as(matrix, "Cnetwork"): convert a matrix to an object of class Cnetwork
  • as(dgCMatrix, "Cnetwork"): convert a dgCMatrix (a sparse matrix) to an object of class Cnetwork
  • [i]: get the subset of the same class

Access

Ways to access information on this class:

  • showClass("Cnetwork"): show the class definition
  • showMethods(classes="Cnetwork"): show the method definition upon this class
  • getSlots("Cnetwork"): get the name and class of each slot in this class
  • slotNames("Cnetwork"): get the name of each slot in this class
  • selectMethod(f, signature="Cnetwork"): retrieve the definition code for the method 'f' defined in this class

Examples

# create an object of class Cnetwork, only given a matrix adjM <- matrix(runif(25),nrow=5,ncol=5) as(adjM, "Cnetwork")
An object of S4 class 'Cnetwork' @adjMatrix: a weighted symmetric matrix of 5 samples/terms X 5 samples/terms @nodeInfo (InfoDataFrame) nodeNames: 1 2 3 4 5 nodeAttr: id
# create an object of class Cnetwork, given a matrix plus information on nodes # 1) create nodeI: an object of class InfoDataFrame data <- data.frame(id=paste("Domain", 1:5, sep="_"), level=rep("SCOP",5), description=I(LETTERS[1:5]), row.names=paste("Domain", 1:5, sep="_")) nodeI <- new("InfoDataFrame", data=data) nodeI
An object of S4 class 'InfoDataFrame' rowNames: Domain_1 Domain_2 Domain_3 Domain_4 Domain_5 colNames: id level description
# 2) create an object of class Cnetwork # VERY IMPORTANT: make sure having consistent names between nodeInfo and adjMatrix adjM <- matrix(runif(25),nrow=5,ncol=5) colnames(adjM) <- rownames(adjM) <- rowNames(nodeI) x <- new("Cnetwork", adjMatrix=adjM, nodeInfo=nodeI) x
An object of S4 class 'Cnetwork' @adjMatrix: a weighted symmetric matrix of 5 samples/terms X 5 samples/terms @nodeInfo (InfoDataFrame) nodeNames: Domain_1 Domain_2 Domain_3 Domain_4 Domain_5 nodeAttr: id level description
# 3) look at various methods defined on class Cnetwork dim(x)
[1] 5 5
adjMatrix(x)
Domain_1 Domain_2 Domain_3 Domain_4 Domain_5 Domain_1 0.28674904 0.67940568 0.2612663 0.3498324 0.2858638 Domain_2 0.07508181 0.02144015 0.8738172 0.5003737 0.4241023 Domain_3 0.85388949 0.99335998 0.6187192 0.1840178 0.4115077 Domain_4 0.64491955 0.88064373 0.4329641 0.6983444 0.6659519 Domain_5 0.78162055 0.23141078 0.2724255 0.6361669 0.6488376
nodeInfo(x)
An object of S4 class 'InfoDataFrame' rowNames: Domain_1 Domain_2 Domain_3 Domain_4 Domain_5 colNames: id level description
nInfo(x)
id level description Domain_1 Domain_1 SCOP A Domain_2 Domain_2 SCOP B Domain_3 Domain_3 SCOP C Domain_4 Domain_4 SCOP D Domain_5 Domain_5 SCOP E
nodeNames(x)
[1] "Domain_1" "Domain_2" "Domain_3" "Domain_4" "Domain_5"
# 4) get the subset x[1:2]
An object of S4 class 'Cnetwork' @adjMatrix: a weighted symmetric matrix of 2 samples/terms X 2 samples/terms @nodeInfo (InfoDataFrame) nodeNames: Domain_1 Domain_2 nodeAttr: id level description

See also

Cnetwork-method