thibautjombart / outbreaker

Disease outbreak reconstruction from epidemiological and genetic data
2 stars 1 forks source link

errors using layout options in transGraph and plot.igraph #2

Closed pcdjohnson closed 9 years ago

pcdjohnson commented 9 years ago

Layout options in transGraph and plot.igraph are generating errors. From the introduction to outbreaker: https://sites.google.com/site/therepiproject/outbreaker-intro.pdf?attredirects=0

> plot(g, layout=layout.circle, edge.curved=FALSE, vertex.color=funky(30))
Error in i.parse.plot.params(graph, list(...)) : 
  object 'layout.circle' not found

Adapted from the introduction:

> x <- runif(length(collecDates))
> y <- runif(length(collecDates))
> g <- transGraph(res, thres=0.5, plot.layout = data.frame(x = x, y = y))
Error in i.parse.plot.params(graph, list(...)) : 
  Unknown plot parameters: plot.layout

I think this is because the current version of igraph has deprecated some layout functions:

?layout.fruchterman.reingold
?layout.circle

I'm not sure whether these are issues for transGraph, or whether I just need to learn how to use the new layout options in igraph. Simply replacing layout=layout.circle with layout=layout_in_circle doesn't work.

I'm running outbreaker 1.1-6 and igraph 1.0.1 on R 3.2.2. Full session info:

> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] adegenet_2.0.0   ade4_1.7-2       outbreaker_1.1-6

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.1      spdep_0.5-88     plyr_1.8.3       LearnBayes_2.15  tools_3.2.2      boot_1.3-17      digest_0.6.8     gtable_0.1.2     nlme_3.1-122    
[10] lattice_0.20-33  Matrix_1.2-2     igraph_1.0.1     shiny_0.12.2     DBI_0.3.1        proto_0.3-10     coda_0.17-1      dplyr_0.4.3      stringr_1.0.0   
[19] grid_3.2.2       R6_2.1.1         sp_1.2-0         ggplot2_1.0.1    reshape2_1.4.1   seqinr_3.1-3     deldir_0.1-9     magrittr_1.5     scales_0.3.0    
[28] htmltools_0.2.6  MASS_7.3-44      splines_3.2.2    assertthat_0.1   mime_0.4         ape_3.3          colorspace_1.2-6 xtable_1.7-4     httpuv_1.3.3    
[37] stringi_0.5-5    munsell_0.4.2  
pcdjohnson commented 9 years ago

It looks like the igraph layout problems I was having were due to having not loaded igraph separately (which I would have done had I followed the tutorial more closely). It can be seen from the session info output above that igraph is not attached. All the igraph functions appear still to be available, presumably via one of the loaded packages, but the deprecated layout functions (layout.circle, etc) only work if igraph is loaded directly.

The other problem mentioned above, trying to supply layout coordinates... transGraph(res, thres=0.5, plot.layout = data.frame(x = x, y = y)) ...still gives an error, even when igraph is loaded separately, but the following does work: plot(g, layout = cbind(x = x, y = y)) (where g is an igraph object created by transGraph) regardless of whether or not igraph was loaded separately. This behaviour is as described at ?igraph.plotting.

In summary, as far as I'm concerned there is no longer a problem. Sorry for any confusion.

thibautjombart commented 9 years ago

Cool, thanks for the correction. Sorry for not being more reactive - teaching times.

outbreaker's development is back on the agenda though; new things coming for early 2016

On Tue, Sep 22, 2015 at 12:54 PM, pcdjohnson notifications@github.com wrote:

It looks like the igraph layout problems I was having were due to having not loaded igraph separately (which I would have done had I followed the tutorial more closely). It can be seen from the session info output above that igraph is not attached. All the igraph functions appear still to be available, presumably via one of the loaded packages, but the deprecated layout functions (layout.circle, etc) only work if igraph is loaded directly.

The other problem mentioned above, trying to supply layout coordinates... transGraph(res, thres=0.5, plot.layout = data.frame(x = x, y = y)) ...still gives an error, even when igraph is loaded separately, but the following does work: plot(g, layout = cbind(x = x, y = y)) (where g is an igraph object created by transGraph) regardless of whether or not igraph was loaded separately. This behaviour is as described at ?igraph.plotting.

In summary, as far as I'm concerned there is no longer a problem. Sorry for any confusion.

— Reply to this email directly or view it on GitHub https://github.com/thibautjombart/outbreaker/issues/2#issuecomment-142264810 .