[R-sig-phylo] Fwd: Alter the branch lengths of a Tree

2012-08-28 Thread Leandro Jones
Neither do I imagine what is Fernando going to do with this, but I think
this is what he wants to do:

 F - rtree(10) # suppose this is Fernando's tree
 F$edge.length
 [1] 0.26509875 0.87023285 0.99953710 0.22727375 0.72152984 0.66757869
 [7] 0.19363565 0.79213697 0.58417425 0.90608903 0.09822511 0.62101620
[13] 0.96507543 0.75824378 0.04740603 0.90538387 0.59199804 0.24499763
 F$edge.length - x$edge.length/min(x$edge.lengt)
 F$edge.length
 [1]  5.592089 18.357006 21.084596  4.794195 15.220211 14.082146  4.084620
 [8] 16.709623 12.322783 19.113369  2.071996 13.099940 20.357650 15.994668
[15]  1.00 19.098494 12.487820  5.168069


Hope it helps!
Leandro Jones


2012/8/28 Liam J. Revell liam.rev...@umb.edu

Hi Fernando.

 I'm not entirely sure what you're going for, but let me try to be of some
 help.

 The tree is stored in memory as what is called a list - basically, a set
 of objects that can be of different types. The branch lengths of the tree
 are stored in the list element edge.length. So, for a phylo object with
 the variable name tree, you can access the branch lengths of the tree using
 tree$edge.length. (If your tree does not have branch lengths, this will be
 NULL.)

 Consequently, you can assign any arbitrary values to the branch lengths of
 the tree by assigning values to tree$edge.length. For instance, to set all
 branch lengths to 1.0, you would just do:

 tree$edge.length-rep(1,nrow(**tree$edge))

 The order of tree$edge.length corresponds to the row order of tree$edge,
 so if you want to see which branches in tree$edge.length correspond to
 which branches on the tree, you can do something like the following (here,
 I use a simple random tree for illustration):

 set.seed(1)
 tree-rtree(10); tree$edge.length-rep(1,nrow(**tree$edge))
 X-tree$edge
 X[X[,2]%in%1:length(tree$tip),**2]-
tree$tip[X[X[,2]%in%1:length(**tree$tip),2]]
 names(tree$edge.length)-**paste(X[,1],X[,2],sep=,)
 plot(tree); nodelabels()
 tree$edge.length

 Now if, for instance, I want to make the branch length leading from node
 13 to tip taxon t6 to (for instance) 3.0, I could just do:

 tree$edge.length[13,t6]-3
 plot(tree); nodelabels()

 Of course, if we have some simple criterion on which we want to change our
 branch lengths, we can do that to. For instance, if we wanted to set all
 branch lengths with length 1 to 1.0 and all branch lengths with length 1
 to 2.0, we could do it as follows:

 tree$edge.length-runif(n=**nrow(tree$edge),min=0,max=2)
 tree$edge.length
 tree$edge.length[tree$edge.**length1]-1
 tree$edge.length[tree$edge.**length1]-2
 tree$edge.length
 plot(tree)

 I hope this is of some help.

 All the best, Liam

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

 On 8/28/2012 4:15 PM, Fernando Sobral wrote:

 Hi,

 I am trying to alter the branch lengths of a phylogeny so that the smaller
 branch has size igual 1 and the larger branch is the proportional sum of
 the smaller branchs. For example, if the larger branch is equivalent to
 ten
 smaller branchs, it should have size igual to 10. I already tryed use some
 functions like compute.brlen(), compute.brtime() and rescaleTree(), but
 did
 not work.

 Any help would be greatly appreciated.

 Thanks,

 Fernando L. Sobral

 [[alternative HTML version deleted]]

 __**_
 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




-- 
Dr. Leandro R. Jones, Ph.D.
Director General de Coordinación Institucional
Secretaría de Ciencia, Tecnología e Innovación Productiva
Gobierno de la Provincia del Chubut




-- 
Dr. Leandro R. Jones, Ph.D.
Director General de Coordinación Institucional
Secretaría de Ciencia, Tecnología e Innovación Productiva
Gobierno de la Provincia del Chubut

[[alternative HTML version deleted]]

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


[R-sig-phylo] Show Informative Sites?

2011-09-19 Thread Leandro Jones
Nick´s rules won´t allways work in a Parsimony context. For example, a
position like this one:
1 A
2 A
3 T
4 C
would be informative under rules (a) and (b), but it is in reality
uninformative, as any of the possible trees have a length of 2. Thus,
this character tells us nothing about _phylogeny_.

I don´t know of any R function capable of solving Jimmy´s problem, but
I would suggest using TNT. TNT implements a function (isinfo) that
tells you if a given character is or is not informative.

Hope this helps.
Leandro

2011/9/17 Nick Matzke mat...@berkeley.edu:
 All sites are informative under likelihood, but I assume you mean
 parsimony-informative, in which case all you have to do is count which sites
 are either (a) uniform or (b) uniform except for differences found only in a
 single species.

 Probably easiest if you convert the read.nexus.data output to a dataframe
 with as.data.frame, then use unique and == to count the number of states in
 each site...


 On 9/17/11 11:21 AM, Jimmy O'Donnell wrote:

 Hi all,

 A simple question to which I can't seem to find an answer: is there a way
 to show only the informative sites of a DNA sequence dataset in R?

 Thanks,

 Jimmy
 --
 Jimmy O'Donnell
 PhD Candidate
 Ecology and Evolutionary Biology
 University of California
 Santa Cruz, CA 95060
 jodonn...@biology.ucsc.edu
 (407)744-3377

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


 --
 
 Nicholas J. Matzke
 Ph.D. Candidate, Graduate Student Researcher

 Huelsenbeck Lab
 Center for Theoretical Evolutionary Genomics
 4151 VLSB (Valley Life Sciences Building)
 Department of Integrative Biology
 University of California, Berkeley

 Graduate Student Instructor, IB200B
 Principles of Phylogenetics: Ecology and Evolution
 http://ib.berkeley.edu/courses/ib200b/
 http://phylo.wikidot.com/


 Lab websites:
 http://ib.berkeley.edu/people/lab_detail.php?lab=54
 http://fisher.berkeley.edu/cteg/hlab.html
 Dept. personal page:
 http://ib.berkeley.edu/people/students/person_detail.php?person=370
 Lab personal page: http://fisher.berkeley.edu/cteg/members/matzke.html
 Lab phone: 510-643-6299
 Dept. fax: 510-643-6264

 Cell phone: 510-301-0179
 Email: mat...@berkeley.edu

 Mailing address:
 Department of Integrative Biology
 3060 VLSB #3140
 Berkeley, CA 94720-3140

 -
 [W]hen people thought the earth was flat, they were wrong. When people
 thought the earth was spherical, they were wrong. But if you think that
 thinking the earth is spherical is just as wrong as thinking the earth is
 flat, then your view is wronger than both of them put together.

 Isaac Asimov (1989). The Relativity of Wrong. The Skeptical Inquirer,
 14(1), 35-44. Fall 1989.
 http://chem.tufts.edu/AnswersInScience/RelativityofWrong.htm

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




--
Leandro R. Jones, Ph.D.



-- 
Leandro R. Jones, Ph.D.

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