Cnetwork-class: Definition for S4 class Cnetwork

Cnetwork-classR Documentation

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

nodeInfo

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

adjMatrix

An 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

See Also

Cnetwork-method

Examples

# create an object of class Cnetwork, only given a matrix
adjM <- matrix(runif(25),nrow=5,ncol=5)
as(adjM, "Cnetwork")

# 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
# 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
# 3) look at various methods defined on class Cnetwork
dim(x)
adjMatrix(x)
nodeInfo(x)
nInfo(x)
nodeNames(x)
# 4) get the subset
x[1:2]

hfang-bristol/dcGOR documentation built on July 16, 2022, 6:43 p.m.