a small update to
plotTree.singletons to address a small issue posted
The update assigns the environmental variable
"last_plot.phylo" which basically makes the
function compatible with ape functions such as
to add features to a plotted tree.
Here is how it works.
First, our tree with singleton (i.e., non-furcating) nodes:
## ## Phylogenetic tree with 26 tips and 38 internal nodes. ## ## Tip labels: ## A, B, C, D, E, F, ... ## ## Rooted; includes branch lengths.
Now let's try to add node labels & tip labels:
plotTree.singletons(obj) nodelabels(cex=0.5) tiplabels(cex=0.5)
The tree was obtained by using
map.to.singleton to convert a
to a tree with non-furcating nodes, as follows:
tree<-pbtree(n=26,scale=1,tip.label=LETTERS) Q<-matrix(c(-1,1,0,1,-2,1,0,1,-1),3,3, dimnames=list(letters[1:3],letters[1:3])) tree<-sim.history(tree,Q,anc="a") obj<-map.to.singleton(tree) names(obj$edge.length)<-NULL
I hope you are doing good. I was trying to use phylogenetic independent contrast (pic) using ape package. I can do this for individual variable. Is there any way to do all together using a for loop or other alternatives?
> g1=setNames(f1[,1],row.names(f1)) #(f1 is the dataframe)
> pic.gene<-pic(g1,t1) # t1 is the phylogentic tree (it works good)
> g_all=setNames(f1[,1:196],row.names(f1)) #all variable, woking good
> pic.g<-pic(g_all,t1) #doesn't work, Error in pic(g_all, t1) :
length of phenotypic and of phylogenetic data do not match
Looking forward to here from you.
University of Puerto Rico, Rio-Peadras