# create an object of class Anno, only given a matrix
annoData <- matrix(runif(50),nrow=10,ncol=5)
as(annoData, "Anno")
# create an object of class Anno, given a matrix plus information on its columns/rows
# 1) create termData: an object of class InfoDataFrame
data <- data.frame(x=1:5, y=I(LETTERS[1:5]), row.names=paste("Term",
1:5, sep="_"))
termData <- new("InfoDataFrame", data=data)
termData
# 2) create domainData: an object of class InfoDataFrame
data <- data.frame(x=1:10, y=I(LETTERS[1:10]),
row.names=paste("Domain", 1:10, sep="_"))
domainData <- new("InfoDataFrame", data=data)
domainData
# 3) create an object of class Anno
# VERY IMPORTANT: make sure having consistent names between annoData and domainData (and termData)
annoData <- matrix(runif(50),nrow=10,ncol=5)
rownames(annoData) <- rowNames(domainData)
colnames(annoData) <- rowNames(termData)
x <- new("Anno", annoData=annoData, domainData=domainData,
termData=termData)
x
# 4) look at various methods defined on class Anno
dim(x)
annoData(x)
termData(x)
tData(x)
domainData(x)
dData(x)
termNames(x)
domainNames(x)
# 5) get the subset
x[1:3,1:2]
Run the code above in your browser using DataLab