Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: graph
Title: graph: A package to handle graph data structures
Version: 1.89.1
Version: 1.89.2
Authors@R: c(
person("R", "Gentleman", role = "aut"),
person("Elizabeth", "Whalen", role="aut"),
Expand All @@ -25,7 +25,7 @@ Description: A package that implements some simple graph handling
License: Artistic-2.0
Depends: R (>= 2.10), methods, BiocGenerics (>= 0.13.11)
Imports: stats, stats4, utils
Suggests: SparseM (>= 0.36), XML, RBGL, RUnit, cluster, BiocStyle, knitr
Suggests: SparseM (>= 0.36), XML, RBGL, RUnit, cluster, BiocStyle, knitr, qtl, qpgraph
Enhances: Rgraphviz
Collate: AllClasses.R AllGenerics.R bitarray.R buildDepGraph.R
methods-graph.R graphNEL.R clustergraph.R NELhandler.R
Expand Down
35 changes: 35 additions & 0 deletions inst/unitTests/qpgraph_test.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
library(qtl)
library(graph)
library(qpgraph)

## simulate an eQTLnetwork, this code is taken from section 2 of the vignette
## entitled 'Estimate eQTL networks using qpgraph' from the 'qpgraph' package.
## this simulation uses the API of the 'graph' package, concretely calling
## 'subGraph()', 'nodes()', 'edges()', 'degree()', 'edgeData()', 'numEdges()',
## 'graphBAM()', 'nodeDataDefaults()', 'edgeDataDefaults()', 'nodeData()',
## 'edgeData()', 'numNodes()', 'numEdges()', 'edgemode()' and 'addEdge()'
test_eQTLnetwork <- function() {
## Simulate a genetic map using the R/CRAN package qtl, consisting of
## nine chromosomes, being 100 cM long with 10 markers equally spaced along
## each of them, no telomeric markers and no X sexual chromosome.
map <- sim.map(len=rep(100, times=9),
n.mar=rep(10, times=9),
anchor.tel=FALSE,
eq.spacing=TRUE,
include.x=FALSE)

## Simulate an eQTL network consisting of 50 genes, where half of them have
## one cis-acting (local) eQTL, there are 5 eQTL trans-acting (distant) on
## 5 genes each, and each gene is connected to 2 other genes. Each eQTL has
## an additive effect of a=2 and each gene-gene association has a marginal
## correlation rho=0.5.
set.seed(12345)
sim.eqtl <- reQTLcross(eQTLcrossParam(map=map, genes=50, cis=0.5,
trans=rep(5, 5),
networkParam=dRegularGraphParam(d=2)),
a=2, rho=0.5)

## check that all simulated genes are connected to two other genes in the
## network
checkTrue(all(degree(sim.eqtl$model$g, sim.eqtl$model$Y) == 3))
}