Re: [R-sig-phylo] Triploid microsatellites?

2014-06-02 Thread Vojtěch Zeisek
Yes, it was easy, thank You for pointing me in the good direction.

ssrs3n.table - read.table(ssrs3n.txt, header=TRUE, sep=\t, quote= , 
dec=., row.names=1)
ssrs3n.populations - read.table(populations.txt, header=TRUE)
ssrs3n.pops - ssrs3n.populations[,1]
ssrs3n.genind - df2genind(ssrs3n.table, sep=/, ncode=3, pop=ssrs3n.pops, 
missing=NA, ploidy=3, type=“codom“)

That trick with populations is not probably the most elegant one, but it is 
easy and working fine. :-)
Sincerely,
Vojtěch

Dne Pá 30. května 2014 10:13:27 jste napsal(a):
 Hi there,
 
 yes, the formats you mention are not designed for triploid data, but reading
 your data in should be easy. Just use read.table or read.csv to read your
 file in, then use df2genind to convert your data into a genind object, with
 sep=/ and ploidy=3.
 
 Cheers
 Thibaut
 
 From: r-sig-phylo-boun...@r-project.org [r-sig-phylo-boun...@r-project.org]
 on behalf of Vojtěch Zeisek [vo...@trapa.cz] Sent: 30 May 2014 10:17
 To: mailinglist R
 Subject: Re: [R-sig-phylo] Triploid microsatellites?
 
 Hello,
 thank You both. poppr looks interesting, I need to explore it more.
 Adegenet is famous package. I didn't know it can also handle triploid data.
 I found problem when importing data to it. Functions of import2genind group
 (read.genetix, read.structure, read.fstat and read.genepop) are only for
 diploid data. So I used read.loci. The input file was easy: first line with
 names of markers etc, first row with names of samples, second row with
 populations and from third row alleles. I coded alleles in this way
 123/234/345, so that each individual has 3 alleles. Missing alleles are
 just NA.
 ssrs3n.loci - read.loci(ssrs3n.txt, header=TRUE, loci.sep=\t,
 allele.sep=/, col.pop=2, col.loci=3:10, row.names=1)
 ssrs3n.loci
 Allelic data frame: 130 individuals
 8 loci
 1 additional variable
 ssrs3n.genind - loci2genind(ssrs3n.loci)
 ssrs3n.genind
 
#
### Genind object ###
#
 - genotypes of individuals -
 
 S4 class:  genind
 @call: df2genind(X = as.matrix(x[, attr(x, locicol)]), sep = /,
 pop = pop)
 
 @tab:  130 x 115 matrix of genotypes
 
 @ind.names: vector of  130 individual names
 @loc.names: vector of  8 locus names
 @loc.nall: number of alleles per locus
 @loc.fac: locus factor for the  115 columns of @tab
 @all.names: list of  8 components yielding allele names for each locus
 @ploidy:  2
 @type:  codom
 
 Optional contents:
 @pop:  factor giving the population of each individual
 @pop.names:  factor giving the population of each individual
 
 @other: - empty -
 
 As You can see, it was imported as diploid and I haven't found way how
 import it as triploid data. Imported data matrix seems to be wrong. When I
 used input file formatted in the same way for diploids, it works
 perfectly... Any ideas how to fix that?
 Thank You in advance,
 Vojtěch Zeisek
 
 Dne Pá 30. května 2014 03:34:49 jste napsal(a):
  Hi there,
  
  yes, adegenet handles any (constant) ploidy for most purposes. For input
  formats etc. please see the tutorial on basics, section 'documents' on:
  http://adegenet.r-forge.r-project.org/
  
  Please feel free to use the adegenet forum for adegenet-related questions.
  Cheers
  Thibaut
  
  
  From: r-sig-phylo-boun...@r-project.org
  [r-sig-phylo-boun...@r-project.org]
  on behalf of Gilles Benjamin Leduc [g...@hi.is] Sent: 29 May 2014 17:12
  To: Vojtěch Zeisek
  Cc: mailinglist R
  Subject: Re: [R-sig-phylo] Triploid microsatellites?
  
   Hi,
  
  Yes it is possible in R, there is a package created for related purposes:
  poppr or something like that… The dev version on github should be
  preferred. I have seen several R work with polyploids and microsatelites,
  unfortunately… I work with ALFP  :p Benjamin
  
  Le Jeudi 29 Mai 2014 13:40 GMT, Vojtěch Zeisek vo...@trapa.cz a écrit:
   Hello,
   I wonder if it is possible to handle triploid microsatellite (yes, all
   individuals are regular 3n) data in adegenet and another R packages. And
   if so, how to enter the data. Any experiences and/or Ideas are very
   welcomed. :-) Structure and BAPS are working well.
   Yours sincerely,
   Vojtěch Zeisek
-- 
Vojtěch Zeisek
http://trapa.cz/en/

Department of Botany, Faculty of Science
Charles University in Prague
Benátská 2, Prague, 12801, CZ
http://botany.natur.cuni.cz/en/

Institute of Botany, Academy of Science
Zámek 1, Průhonice, 25243, CZ
http://www.ibot.cas.cz/en/

Czech Republic


signature.asc
Description: This is a digitally signed message part.
___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Re: [R-sig-phylo] Early burst branch rescale

2014-06-02 Thread Slater, Graham
Hi Jon,

So there are are a few ways I can imagine doing this. One thing you should 
probably not do though is rescale the branches of the tree directly, at least 
in the case of OU, as this leads to incorrect covariances for pairs of taxa 
where one or either does not survive to the present day (see this in press 
note: http://onlinelibrary.wiley.com/doi/10./2041-210X.12201/abstract), as 
I suspect you have in your tree.

Probably the most appropriate way is therefore to 1) split the VCV into one or 
more matrices describing the variances and covariances over the intervals that 
you’re interested in; 2) transform the matrices according the model and 
associated parameters you want over that interval, 3) stick them back together, 
and 4) draw your data directly from a multivariate normal distribution using 
the transformed covariance matrix. I’ll send you some code off list to do that 
(it’s also in the corrected dryad pack accompanying the note above)

Graham

Graham Slater
Peter Buck Post-Doctoral Fellow
Department of Paleobiology
National Museum of Natural History
The Smithsonian Institution [NHB, MRC 121]
P.O. Box 37012


(202) 633-1316
slat...@si.edumailto:slat...@si.edu
www.fourdimensionalbiology.comhttp://www.fourdimensionalbiology.com





On Jun 2, 2014, at 3:55 PM, Jonathan Mitchell 
mitchel...@uchicago.edumailto:mitchel...@uchicago.edu wrote:

Hello all,

I'm trying to figure out how to rescale certain branches of a tree
according to an early burst model.

First I've generated a tree using TreeSim

N - 100

Nn - N*2 -1

test - sim.bd.taxa(N, 1, 1, 0.8, complete=FALSE)


Then I 'paint' the branches depending on whether or not they occur in the
first or second half of the clade's history:


Root -max(nodeHeights(test2))

Age - 0.5*Root

test2 - make.era.map(test[[1]][[1]], c(0, Age))


Using rescale() from geiger, I can reformat the whole tree, and using
sim.rates() from phytools, it's easy to simulate different sigmas. But what
I'd like to do is also simulate different evolutionary modes (OU and EB) in
the different regimes (like Graham's MEE paper). Is there a way to rescale
the branches in one portion of the tree according to the OU alpha or EB r
parameters?

Thanks!
-- Jon

_

Jonathan S. Mitchell
http://home.uchicago.edu/~mitchelljs/

PhD Student
Committee on Evolutionary Biology
The University of Chicago
1025 57th Str, Culver Hall 402
Chicago, IL 60637

Geology Department
The Field Museum of Natural History
1400 S. Lake Shore Dr.
Chicago, IL 60605

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/


[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Re: [R-sig-phylo] Early burst branch rescale

2014-06-02 Thread Julien Clavel
Hi Jon,

Take a look at the mvSHIFT function in mvMORPH. This is typically what you 
are looking for and you can use it with non-ultrametric trees (it's maybe 
faster than classic functions).

Best,

Julien

 Date: Mon, 2 Jun 2014 14:55:06 -0500
 From: mitchel...@uchicago.edu
 To: r-sig-phylo@r-project.org
 Subject: [R-sig-phylo] Early burst branch rescale
 
 Hello all,
 
 I'm trying to figure out how to rescale certain branches of a tree
 according to an early burst model.
 
 First I've generated a tree using TreeSim
 
 N - 100
 
 Nn - N*2 -1
 
 test - sim.bd.taxa(N, 1, 1, 0.8, complete=FALSE)
 
 
 Then I 'paint' the branches depending on whether or not they occur in the
 first or second half of the clade's history:
 
 
 Root -max(nodeHeights(test2))
 
 Age - 0.5*Root
 
 test2 - make.era.map(test[[1]][[1]], c(0, Age))
 
 
 Using rescale() from geiger, I can reformat the whole tree, and using
 sim.rates() from phytools, it's easy to simulate different sigmas. But what
 I'd like to do is also simulate different evolutionary modes (OU and EB) in
 the different regimes (like Graham's MEE paper). Is there a way to rescale
 the branches in one portion of the tree according to the OU alpha or EB r
 parameters?
 
 Thanks!
 -- Jon
 
 _
 
 Jonathan S. Mitchell
 http://home.uchicago.edu/~mitchelljs/
 
 PhD Student
 Committee on Evolutionary Biology
 The University of Chicago
 1025 57th Str, Culver Hall 402
 Chicago, IL 60637
 
 Geology Department
 The Field Museum of Natural History
 1400 S. Lake Shore Dr.
 Chicago, IL 60605
 
   [[alternative HTML version deleted]]
 
 ___
 R-sig-phylo mailing list - R-sig-phylo@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
 Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/
  
[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/


Re: [R-sig-phylo] Early burst branch rescale

2014-06-02 Thread David Bapst
Julien-

Does mvSHIFT account for the OU rescaling issue on non-ultrametric
trees that Graham mentions? If so, how?

Cheers,
-Dave

On Mon, Jun 2, 2014 at 5:26 PM, Julien Clavel julien.cla...@hotmail.fr wrote:
 Hi Jon,

 Take a look at the mvSHIFT function in mvMORPH. This is typically what you 
 are looking for and you can use it with non-ultrametric trees (it's maybe 
 faster than classic functions).

 Best,

 Julien

 Date: Mon, 2 Jun 2014 14:55:06 -0500
 From: mitchel...@uchicago.edu
 To: r-sig-phylo@r-project.org
 Subject: [R-sig-phylo] Early burst branch rescale

 Hello all,

 I'm trying to figure out how to rescale certain branches of a tree
 according to an early burst model.

 First I've generated a tree using TreeSim

 N - 100

 Nn - N*2 -1

 test - sim.bd.taxa(N, 1, 1, 0.8, complete=FALSE)


 Then I 'paint' the branches depending on whether or not they occur in the
 first or second half of the clade's history:


 Root -max(nodeHeights(test2))

 Age - 0.5*Root

 test2 - make.era.map(test[[1]][[1]], c(0, Age))


 Using rescale() from geiger, I can reformat the whole tree, and using
 sim.rates() from phytools, it's easy to simulate different sigmas. But what
 I'd like to do is also simulate different evolutionary modes (OU and EB) in
 the different regimes (like Graham's MEE paper). Is there a way to rescale
 the branches in one portion of the tree according to the OU alpha or EB r
 parameters?

 Thanks!
 -- Jon

 _

 Jonathan S. Mitchell
 http://home.uchicago.edu/~mitchelljs/

 PhD Student
 Committee on Evolutionary Biology
 The University of Chicago
 1025 57th Str, Culver Hall 402
 Chicago, IL 60637

 Geology Department
 The Field Museum of Natural History
 1400 S. Lake Shore Dr.
 Chicago, IL 60605

   [[alternative HTML version deleted]]

 ___
 R-sig-phylo mailing list - R-sig-phylo@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
 Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

 [[alternative HTML version deleted]]

 ___
 R-sig-phylo mailing list - R-sig-phylo@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
 Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/



-- 
David W. Bapst, PhD
Adjunct Asst. Professor, Geology and Geol. Eng.
South Dakota School of Mines and Technology
501 E. St. Joseph
Rapid City, SD 57701

http://webpages.sdsmt.edu/~dbapst/
http://cran.r-project.org/web/packages/paleotree/index.html

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/