[R-sig-phylo] Meaning of output from phytools findMRCA ?

2014-01-28 Thread Gabriel Yedid
Hi all,

I'm trying to use picante and phytools in combination to analyze particular
aspects of communities of digital organisms.  I use picante to read in the
data for community, trait, and phylogeny data, and make sure everything is
matched up properly.  My interest in using phytools (at least right now) is
using the findMRCA function to find the MRCA of groups of organisms with
particular phenotypic traits.

The data look like this:

 TRAIT1 TRAIT2 TRAIT3 TRAIT4 TRAIT5 TRAIT6 TRAIT7 TRAIT8 TRAIT9
F3666295  0167  0 83  0 81  0  0  0
F3664184  0165  0 83  0 82  0  0  0
F3665912121 42  0 41  0  0  0  0  0
F3665920  0165  0 83  0 81  0  0  0
F3654948  0  0  0 82  0 80  0  0  0
F3663933 81 82  0 82  0 80  0  0  0
 TRAIT10 PHENO
F3666295 15.376584
F3664184 15.186084
F3665912 14.709322
F3665920 15.209384
F3654948 15.023380
F3663933 14.872186


The row names are the unique IDs of the genotypes in the population.
Traits 1 through 10 are traits reflecting various aspects of the phenotype;
the trait called PHENO is a numerical summary of traits 1-9.  It's this
that I want to use as the index for finding MRCAs (e.g. find the MRCA of
all organisms with PHENO = 84)

After having read in and cleaned up everything with picante, I

  attach(TRAITS.EDITED.MATCHED.WORK$data)  #this is the object of
matched-up tree + data produced by picante
  #names(TRAITS.EDITED.MATCHED.WORK$data)

   SUBJECT = TRAITS.EDITED.MATCHED.WORK$data[PHENO==84,] #just for example,
this extracts the vector of tip labels needed by findMRCA

  findMRCA(TRAITS.EDITED.MATCHED.WORK$phy,tips=
row.names(SUBJECT),type=node)
  findMRCA(TRAITS.EDITED.MATCHED.WORK$phy,tips=
row.names(SUBJECT),type=height)

This produces output like:

   findMRCA(TRAITS.EDITED.MATCHED.WORK$phy,tips= 
 row.names(SUBJECT),type=node)[1] 1322   
 findMRCA(TRAITS.EDITED.MATCHED.WORK$phy,tips= 
 row.names(SUBJECT),type=height)[1] 73681


What exactly is the meaning of these numbers?  The vector of node labels
for the associated tree doesn't have that many elements, so what does node
= 1322 mean?  Is it actually meaningful, or is this some kind of error?
What I really want, in this case, is the name of the node, which has a
unique genotype ID like those shown above.

And is the node height measured relative to the root, or to the tips?

Any help is much appreciated!

cheers,

Gabe

[[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] Meaning of output from phytools findMRCA ?

2014-01-28 Thread Liam J. Revell

Hi Gabriel.

findMRCA in phytools should (if working properly) return the node number 
(index from the matrix edge in your object of class phylo) that is the 
MRCA of the set of tips you provide in the argument tips. To plot your 
tree with the node numbers, you can use:


plotTree(tree,node.numbers=TRUE)

in phytools. Nodes are numbered 1:tree$Nnode+length(tree$tip.label). 
I.e., for N tips and m internal nodes, the node numbers are N+1 (the 
root), N+2, N+3, , N+m.


(For type=height the height above the root of the MRCA is returned 
instead.)


For me to troubleshoot a specific problem, you'll need to send me your 
data  code.


All the best, Liam

Liam J. Revell, Assistant Professor of Biology
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
email: liam.rev...@umb.edu
blog: http://blog.phytools.org

On 1/28/2014 5:46 AM, Gabriel Yedid wrote:

Hi all,

I'm trying to use picante and phytools in combination to analyze particular
aspects of communities of digital organisms.  I use picante to read in the
data for community, trait, and phylogeny data, and make sure everything is
matched up properly.  My interest in using phytools (at least right now) is
using the findMRCA function to find the MRCA of groups of organisms with
particular phenotypic traits.

The data look like this:

  TRAIT1 TRAIT2 TRAIT3 TRAIT4 TRAIT5 TRAIT6 TRAIT7 TRAIT8 TRAIT9
F3666295  0167  0 83  0 81  0  0  0
F3664184  0165  0 83  0 82  0  0  0
F3665912121 42  0 41  0  0  0  0  0
F3665920  0165  0 83  0 81  0  0  0
F3654948  0  0  0 82  0 80  0  0  0
F3663933 81 82  0 82  0 80  0  0  0
  TRAIT10 PHENO
F3666295 15.376584
F3664184 15.186084
F3665912 14.709322
F3665920 15.209384
F3654948 15.023380
F3663933 14.872186


The row names are the unique IDs of the genotypes in the population.
Traits 1 through 10 are traits reflecting various aspects of the phenotype;
the trait called PHENO is a numerical summary of traits 1-9.  It's this
that I want to use as the index for finding MRCAs (e.g. find the MRCA of
all organisms with PHENO = 84)

After having read in and cleaned up everything with picante, I

   attach(TRAITS.EDITED.MATCHED.WORK$data)  #this is the object of
matched-up tree + data produced by picante
   #names(TRAITS.EDITED.MATCHED.WORK$data)

SUBJECT = TRAITS.EDITED.MATCHED.WORK$data[PHENO==84,] #just for example,
this extracts the vector of tip labels needed by findMRCA

   findMRCA(TRAITS.EDITED.MATCHED.WORK$phy,tips=
row.names(SUBJECT),type=node)
   findMRCA(TRAITS.EDITED.MATCHED.WORK$phy,tips=
row.names(SUBJECT),type=height)

This produces output like:


   findMRCA(TRAITS.EDITED.MATCHED.WORK$phy,tips= row.names(SUBJECT),type=node)[1] 1322 
  findMRCA(TRAITS.EDITED.MATCHED.WORK$phy,tips= row.names(SUBJECT),type=height)[1] 73681



What exactly is the meaning of these numbers?  The vector of node labels
for the associated tree doesn't have that many elements, so what does node
= 1322 mean?  Is it actually meaningful, or is this some kind of error?
What I really want, in this case, is the name of the node, which has a
unique genotype ID like those shown above.

And is the node height measured relative to the root, or to the tips?

Any help is much appreciated!

cheers,

Gabe

[[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/



___
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/