[R-sig-phylo] ace in ape how to derive ancestral states (which.max)

2013-03-20 Thread Andrés Parada
Sorry if this was addressed before.

I reconstructed a binary discrete character with* ace* (coded as 0-1).
As suggested in APER 2nd edition with the* Sylvia *case I can obtain the
lik.anc values but I wanted to derive the ancestral states from this
matrix.

*First*

*ANC - ace (data$character, tree, type=d, method=ML, model=ARD)*

ANC$lik.anc look like this:

 01
  [1,] 9.999185e-01 8.147752e-05

*So I applied the same strategy as in the example mentioned above:*

*anc - apply(ANC$lik.anc, 1, which.max)*


This returned a matrix of with values of 1 or 2.

Is there a way to modify the formula and sort this so it returns only 0 or
1 depending on which state has higher probability?

Thank you very much for your help.

[[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] read.dna warnings and pitfalls

2012-07-12 Thread Andrés Parada
 automatically assumes it is reading DNA sequences when
 it encounters a string of 10 continuous DNA-like characters. This
 includes all characters in the set (ACGTUMRWSYKVHDBN-). This function,
 unlike the phylip original, does not have limits on taxon name lengths.
 Hence, I had - in the middle of a large alignment - a species whose name
 included the string MADAGASCAR, which caused a failure.  To be fair, the
 documentation warns of this, but I think this is extremely easy to
 overlook, and - moreover - it seems unfortunate to have to parse all your
 taxon names for a potential IUPAC match before trying to use the function.
 Presumably, most users who specify sequential spacing will be using
 whitespace to separate taxon names from DNA sequences, and perhaps it is
 better to exploit this rather than IUPAC matching.

 2) The function is whitespace-sensitive. if you tab-separate the numbers
 on the first line (numbers of taxa, numbers of sites), you'll receive an
 errror with the message: the first line of the file must contain the
 dimensions of the data. It appears that spaces are OK, however.

 Hopefully this post will be useful to somewhere in the future with a
 similar issue. Perhaps these can be addressed in a future update to ape?

 -Dan Rabosky

 __**_
 R-sig-phylo mailing list
 R-sig-phylo@r-project.org
 https://stat.ethz.ch/mailman/**listinfo/r-sig-phylohttps://stat.ethz.ch/mailman/listinfo/r-sig-phylo
 __**_
 R-sig-phylo mailing list
 R-sig-phylo@r-project.org
 https://stat.ethz.ch/mailman/**listinfo/r-sig-phylohttps://stat.ethz.ch/mailman/listinfo/r-sig-phylo









 --
 Emmanuel Paradis
 IRD, Jakarta, Indonesia
 http://ape.mpl.ird.fr/

 __**_
 R-sig-phylo mailing list
 R-sig-phylo@r-project.org
 https://stat.ethz.ch/mailman/**listinfo/r-sig-phylohttps://stat.ethz.ch/mailman/listinfo/r-sig-phylo




-- 

Andrés Parada
Estudiante de Doctorado
Departamento de Ecología
Pontificia Universidad Católica de Chile

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo