download code
## Chunk 1
library("BiocCaseStudies")
## Chunk 2
library("Biobase")
library("graph")
library("Rgraphviz")
library("RColorBrewer")
library("RBGL")
library("yeastExpData")
library(RpsiXML)
## Chunk 3
data("ccyclered")
data("litG")
  (solution chunk)
  (solution chunk)
## Chunk 6
cc = connectedComp(litG)
length(cc)
cclens = sapply(cc, length)
table(cclens)
  (solution chunk)
## Chunk 8
ord = order(cclens, decreasing=TRUE)
sg1 = subGraph(cc[[ord[1]]], litG)
sg2 = subGraph(cc[[ord[2]]], litG)
## Chunk 9
lsg1 = layoutGraph(sg1, layoutType="neato")
lsg2 = layoutGraph(sg2, layoutType="neato")
## Chunk 10
renderGraph(lsg1)
## Chunk 11
renderGraph(lsg2)
  (solution chunk)
## Chunk 13
sps = sp.between(sg1, "YHR129C", "YOL039W")
pth = sps[[1]]$path_detail
pth
  (solution chunk)
  (solution chunk)
## Chunk 16
allp = johnson.all.pairs.sp(sg1)
  (solution chunk)
  (solution chunk)
  (solution chunk)
## Chunk 20
cg = new("clusterGraph", clusters = clusts)
  (solution chunk)
## Chunk 22
commonG = intersection(cg, litG)
  (solution chunk)
## Chunk 24
nodePerm = function (g1, g2, B=1000) {
    n1 = nodes(g1)
    sapply(1:B, function(i) {
        nodes(g1) = sample(n1)
        numEdges(intersection(g1, g2))
    })
}
## Chunk 25
data("nPdist")
summary(nPdist)
  (solution chunk)
## Chunk 27
library("RpsiXML")
library("ppiStats")
library("apComplex")
library("xtable")
## Chunk 28
fold <- system.file("/extdata/psi25files", package="RpsiXML")
fn <- file.path(fold, "intact_2008_test.xml")
eg <- parsePsimi25Interaction(psimi25file=fn, 
                              psimi25source=INTACT.PSIMI25,
                              verbose=FALSE)
## Chunk 29
slotNames(eg)
## Chunk 30
organismName(eg)
taxId(eg)
releaseDate(eg)
## Chunk 31
length(interactions(eg))
class(interactions(eg)[[1]])
interactions(eg)[[1]]
slotNames(interactions(eg)[[1]])
## Chunk 32
egbait = sapply(interactions(eg), bait)
egprey = sapply(interactions(eg), prey)
## Chunk 33
egbait
egprey
## Chunk 34
interactors(eg)[1:2]
bt <- egbait[4]
annBt <- interactors(eg)[[bt]]
annBt
xref(annBt)
## Chunk 35
fn2 = file.path(fold, "intact_complexSample.xml")
comps = parsePsimi25Complex(fn2, INTACT.PSIMI25)
slotNames(comps)
## Chunk 36
length(complexes(comps))
class(complexes(comps)[[1]])
slotNames(complexes(comps)[[1]])
## Chunk 37
complexes(comps)[[1]]
## Chunk 38
s1 = file.path(fold, "human_stelzl-2005-1_01.xml")
s2 = file.path(fold, "human_stelzl-2005-1_02.xml")
stelzl = separateXMLDataByExpt(xmlFiles=c(s1,s2), 
                               psimi25source=INTACT.PSIMI25, 
                               type="direct", directed=TRUE,
                               abstract=TRUE, verbose=FALSE)
class(stelzl[[1]])
stelzl1 = removeSelfLoops(stelzl[[1]])
## Chunk 39
abstract(stelzl1)
## Chunk 40
compXML <- file.path(fold, "intact_complexSample.xml")
pcHg <- buildPCHypergraph(compXML, INTACT.PSIMI25, 
                          split.by = "organismName") 
pcHg[[1]]
## Chunk 41
complexes(pcHg[[1]])
## Chunk 42
deg = degree(stelzl1)
activeBait = names(which(deg$outDegree > 10 & 
    deg$outDegree<15))
proteins = union(activeBait, unlist(adj(stelzl1, 
    activeBait)))
stelzlSG = subGraph(proteins, stelzl1)
## Chunk 43
graph.par(list(nodes=list(fill="steelblue", label="")))
baitCol = rep("yellow", length(activeBait))
names(baitCol) = activeBait
nodeRenderInfo(stelzlSG) <- list(fill=baitCol)
## Chunk 44
stelzlSG <- layoutGraph(stelzlSG, layoutType="neato")
renderGraph(stelzlSG)
## Chunk 45
stelzlSG <- layoutGraph(stelzlSG, layoutType="twopi")
renderGraph(stelzlSG)