diff --git a/DESCRIPTION b/DESCRIPTION index 353241d..d22f1bc 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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"), @@ -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 diff --git a/inst/unitTests/qpgraph_test.R b/inst/unitTests/qpgraph_test.R new file mode 100644 index 0000000..bc6e4d7 --- /dev/null +++ b/inst/unitTests/qpgraph_test.R @@ -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)) +}