[adegenet-forum] Seqtrack coercion into graphNEL

Jombart, Thibaut t.jombart at imperial.ac.uk
Mon Oct 17 10:57:37 CEST 2011


Hello Joseph, 

thanks for re-posting on the forum.

This conversion is no longer implemented in adegenet 1.3-1. This is because it required a dependency with the graph package (on Bioconductor) which turned out to be problematic on most platform. While there is a claim that a default R installation enables Bioconductor repository, I realized it was not the general case at least on the Windows computers of my colleagues.

The conversion function is still there, hidden in the documentation of ?seqTrack; it is in \dontrun, so you actually need to copy and paste the code (i.e. "example(seqTrack)"  won't do). The code is right after the ## PLOT ## section:
------------
## quick convertion method to graphNEL ##
setOldClass("seqTrack")
setAs("seqTrack", "graphNEL", def=function(from){
    ##    if(!require(ape)) stop("package ape is required")
    if(!require(graph)) stop("package graph is required")

    ori.labels <- rownames(from)
    from <- from[!is.na(from$ances),,drop=FALSE]


     ## CONVERT TO GRAPH
    res <- ftM2graphNEL(ft=cbind(ori.labels[from$ances], ori.labels[from$id]), W=from$weight, edgemode = "directed", V=ori.labels)
    return(res)
})
## end conversion function ##
-----------

Then you can use the classical :
as(yourSeqtrackResult,"graphNEL")

I'm thinking this could easily be put in a patch; while add that on the website soon.

Cheers

Thibaut


________________________________________
From: adegenet-forum-bounces at r-forge.wu-wien.ac.at [adegenet-forum-bounces at r-forge.wu-wien.ac.at] on behalf of Joseph Hughes [hughes.joseph at gmail.com]
Sent: 15 October 2011 21:25
To: adegenet-forum at r-forge.wu-wien.ac.at
Subject: [adegenet-forum] Seqtrack coercion into graphNEL

Hi,

I have been using SeqTrack from the adegenet R package and it has been
working fine but I have recently installed the package as well as
graph, ape and Rgraphviz on a new computer and I am now getting the
following error message:
________________________________________________
res.g <- as(res, "graphNEL")
Error in as(res, "graphNEL") :
 no method or default for coercing "seqTrack" to "graphNEL"
________________________________________________

This is the sessionInfo for the versions of the packages that are installed:
________________________________________________
R version 2.13.1 (2011-07-08)
Platform: i386-apple-darwin9.8.0/i386 (32-bit)

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

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

other attached packages:
[1] Rgraphviz_1.30.1 graph_1.30.0     adegenet_1.3-1   ade4_1.4-17
 MASS_7.3-13      ape_2.7-3

loaded via a namespace (and not attached):
[1] gee_4.13-17     igraph_0.5.5-2  lattice_0.19-30 nlme_3.1-101    tools_2.13.1
________________________________________________

I would very much appreciate any advice that you can give me.

Kind regards,
Joseph
_______________________________________________
adegenet-forum mailing list
adegenet-forum at lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum


More information about the adegenet-forum mailing list