Thanks for your quick reply. :)<br>I'm still a little lost. I have used the Monmonier function with 1 dist matrix. But my I'm not sure if I can use a file with several matrices, instead of one single matrix (they are bootstraps). Is it possible? <br>
<br>And if I understand you well, then I cannot export the matrices in triangular format, can I?<br><br>Thanks!!<br><br>Consuelo<br clear="all">-------------<br>Consuelo Hermosilla<br>PhD student<br>Departamento de Ecología y Biología Animal<br>
Departamento de Bioquímica, Genética e Inmunología, Área de Genética<br>Facultad de Ciencias del Mar<br>
Campus de As Lagoas-Marcosende<br>Universidad de Vigo<br>36310 Vigo<br>SPAIN<br>Mobile: +34 692 633 298<br><br>oooO<br>( ) Oooo<br> ( ( )<br> _) ) /<br> (_/<br><br>Stop Gaza Massacre<br>
<br><br><div class="gmail_quote">On Wed, Apr 21, 2010 at 1:45 PM, Jombart, Thibaut <span dir="ltr"><<a href="mailto:t.jombart@imperial.ac.uk" target="_blank">t.jombart@imperial.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hello,<br>
<br>
you can read your square matrices using read.table with adequate arguments. Use lapply to read all your matrices at once. You may also use 'dir', which will be useful to retrieve all the names of your files if they're stored in a single directory.<br>
<br>
To export the matrices, make them square (as.matrix) and then used write.table. If you import a distance matrix in R, then you can convert it to a dist (as.dist) and use it in Monmonier.<br>
<br>
Best<br>
<br>
Thibaut<br>
<br>
________________________________________<br>
From: Consuelo Hermosilla [<a href="mailto:cheluna@gmail.com" target="_blank">cheluna@gmail.com</a>]<br>
Sent: 21 April 2010 12:36<br>
To: Jombart, Thibaut; <a href="mailto:adegenet-forum@lists.r-forge.r-project.org" target="_blank">adegenet-forum@lists.r-forge.r-project.org</a><br>
Subject: Re: [adegenet-forum] distribution<br>
<div><br>
Hi Thibaut!<br>
I'm remembering what you say "you can read anything into R, with more or less pain"... I'm experiencing some pain with dists again... Here is the thing. I have a bootstraped file with 1000 dist matrices from AFLPsurv... but they are square matrices... grrr.... I cannot use the as.dist function directly to transform them to triangular matrices. How can I do it? Do I need a loop? And then, if I manage it, how can I export them? I tried to export a single triangle matrix (using write.table) and it says "cannot coerce class "dist" into a data.frame"... Tricky...<br>
My last question (hopefully) is related to this an to my previous monmonier question. Can I use this bootstraped file (if I manage to convert it) as the dist object for the monmonier function?<br>
Thank you very much!!!<br>
<br>
Consuelo<br>
<br>
-------------<br>
Consuelo Hermosilla<br>
PhD student<br>
Departamento de Ecología y Biología Animal<br>
Departamento de Bioquímica, Genética e Inmunología, Área de Genética<br>
Facultad de Ciencias del Mar<br>
Campus de As Lagoas-Marcosende<br>
Universidad de Vigo<br>
36310 Vigo<br>
SPAIN<br>
Mobile: +34 692 633 298<br>
<br>
oooO<br>
( ) Oooo<br>
( ( )<br>
_) ) /<br>
(_/<br>
<br>
Stop Gaza Massacre<br>
<br>
<br>
</div><div>On Thu, Apr 15, 2010 at 5:21 PM, Jombart, Thibaut <<a href="mailto:t.jombart@imperial.ac.uk" target="_blank">t.jombart@imperial.ac.uk</a><mailto:<a href="mailto:t.jombart@imperial.ac.uk" target="_blank">t.jombart@imperial.ac.uk</a>>> wrote:<br>
Dear Consuelo,<br>
<br>
good question about searching in the archives... I don't know (shame on me). My best guess for now is googling a question preceeded by 'adegenet-forum'. For instance, if you google:<br>
"adegenet-forum seppop"<br>
then you find an appropriate discussion in the archives as first answer. Lucky enough, 'adegenet-forum horse riding' does not point to anything in the archives...<br>
Thanks for pointing this out, I will mention that on the website.<br>
<br>
As for your other question: you could read a triangular matrix into R (you can read anything into R, with more or less pain), but a more straightforward way is using 'as.dist' on your rectangular matrix.<br>
<br>
M <- matrix(1:9, ncol=3)<br>
M <- M + t(M)<br>
diag(M) <- 0<br>
M # M is a symmetric matrix<br>
[,1] [,2] [,3]<br>
[1,] 0 6 10<br>
[2,] 6 0 14<br>
[3,] 10 14 0<br>
<br>
<br>
foo=as.dist(M)<br>
foo # lower triangular matrix<br>
1 2<br>
2 6<br>
3 10 14<br>
<br>
<br>
Best regards<br>
<br>
Thibaut<br>
<br>
________________________________________<br>
</div>From: <a href="mailto:adegenet-forum-bounces@lists.r-forge.r-project.org" target="_blank">adegenet-forum-bounces@lists.r-forge.r-project.org</a><mailto:<a href="mailto:adegenet-forum-bounces@lists.r-forge.r-project.org" target="_blank">adegenet-forum-bounces@lists.r-forge.r-project.org</a>> [<a href="mailto:adegenet-forum-bounces@lists.r-forge.r-project.org" target="_blank">adegenet-forum-bounces@lists.r-forge.r-project.org</a><mailto:<a href="mailto:adegenet-forum-bounces@lists.r-forge.r-project.org" target="_blank">adegenet-forum-bounces@lists.r-forge.r-project.org</a>>] On Behalf Of Consuelo Hermosilla [<a href="mailto:cheluna@gmail.com" target="_blank">cheluna@gmail.com</a><mailto:<a href="mailto:cheluna@gmail.com" target="_blank">cheluna@gmail.com</a>>]<br>
<div>Sent: 15 April 2010 14:48<br>
</div>To: <a href="mailto:adegenet-forum@lists.r-forge.r-project.org" target="_blank">adegenet-forum@lists.r-forge.r-project.org</a><mailto:<a href="mailto:adegenet-forum@lists.r-forge.r-project.org" target="_blank">adegenet-forum@lists.r-forge.r-project.org</a>><br>
<div><div></div><div>Subject: [adegenet-forum] distribution<br>
<br>
Hello Thibaut,<br>
<br>
I'd like to know, how can I import a triangular matrix into R? For example, for amova analysis in pegas, the input distance matrix must be triangular. The thing is I have calculated the Fsts in Structure and I wanted to import them to run the Amova in pegas. But I don't know how to convert my square Fst matrix into a triangular one. I could save it as a triangular matrix, but R does not read triangular matrix, does it? Do you know how can I do it?<br>
<br>
The other thing, is there a way to search in the past threads of the forum? I mean, instead of search in each month manually?<br>
<br>
Thanks!!<br>
<br>
Consuelo<br>
<br>
-------------<br>
Consuelo Hermosilla<br>
PhD student<br>
Departamento de Ecología y Biología Animal<br>
Departamento de Bioquímica, Genética e Inmunología, Área de Genética<br>
Facultad de Ciencias del Mar<br>
Campus de As Lagoas-Marcosende<br>
Universidad de Vigo<br>
36310 Vigo<br>
SPAIN<br>
Mobile: +34 692 633 298<br>
<br>
oooO<br>
( ) Oooo<br>
( ( )<br>
_) ) /<br>
(_/<br>
<br>
Stop Gaza Massacre<br>
<br>
</div></div></blockquote></div><br>