phylogeny

Node labels on circular phylogenetic tree

我与影子孤独终老i 提交于 2019-12-04 09:59:47
I am trying to create circular phylogenetic tree. I have this part of code: fit<- hclust(dist(Data[,-4]), method = "complete", members = NULL) nclus= 3 color=c('red','blue','green') color_list=rep(color,nclus/length(color)) clus=cutree(fit,nclus) plot(as.phylo(fit),type='fan',tip.color=color_list[clus],label.offset=0.2,no.margin=TRUE, cex=0.70, show.node.label = TRUE) And this is result: Also I am trying to show label for each node and to color branches. Any suggestion how to do that? Thanks! When you say "color branches" I assume you mean color the edges. This seems to work, but I have to

Label and color leaf dendrogram (phylogeny) in R using ape package

自作多情 提交于 2019-12-03 09:55:51
Following a previous post ( Label and color leaf dendrogram in r ) I have a follow-up question. My questions are similar to the post mentioned but I wonder can it be done using ape (e.g., plot(as.phylo(fit), type="fan", labelCol) as it has more type of phylogeny. The mentioned post questions were: How can I show the group codes in leaf label (instead of the sample number)? I wish to assign a color to each code group and colored the leaf label according to it (it might happen that they will not be in the same clade and by that I can find more information)? And the code sample is: sample = data

cluster presentation dendrogram alternative in r

寵の児 提交于 2019-12-03 05:19:49
问题 I know dendrograms are quite popular. However if there are quite large number of observations and classes it hard to follow. However sometime I feel that there should be better way to present the same thing. I got an idea but do not know how to implement it. Consider the following dendrogram. > data(mtcars) > plot(hclust(dist(mtcars))) Can plot it like a scatter plot. In which the distance between two points is plotted with line, while sperate clusters (assumed threshold) are colored and

R phylo object: how to connect node label and node number

喜夏-厌秋 提交于 2019-12-02 22:00:10
问题 A phylo object in R can have internal node labels ( phylo_obj$node.label ), but many R functions use node numbers instead of the node labels. Even the phylo object itself uses node numbers to describe the edges ( phylo_obj$edge ) and does not seem to have a direct mapping of internal node labels to these node numbers used for phylo_obj$edge . How do I map node labels (eg., "NodeA" or "Artiodactyla") to the node number (eg., 250 or 212)? I can't find any R functions or generally any docs on

cluster presentation dendrogram alternative in r

浪尽此生 提交于 2019-12-02 18:36:54
I know dendrograms are quite popular. However if there are quite large number of observations and classes it hard to follow. However sometime I feel that there should be better way to present the same thing. I got an idea but do not know how to implement it. Consider the following dendrogram. > data(mtcars) > plot(hclust(dist(mtcars))) Can plot it like a scatter plot. In which the distance between two points is plotted with line, while sperate clusters (assumed threshold) are colored and circle size is determined by value of some variable. You are describing a fairly typical way of going about

Apply ifelse function to colour tips of phylogenetic fan

ぐ巨炮叔叔 提交于 2019-12-02 13:59:14
问题 In a phylogenetic fan, I would like to colour code the tips (resembling 62 species in this example) by applying an if-statement. I am currently using the following code, in an attempt to colour all species associated with "O" darkgreen: ColourIf = ifelse(LU != "O", "blue", "darkgreen") tiff("PhyloFan.tif", height=10, width=10, units="in", res=300, compression="lzw"); plot.phylo(phyloFan,type="fan",show.tip.label=T,cex=0.9,show.node.label=F, edge.color="black", adj=0, label.offset=0.75, lwd=2,

Apply ifelse function to colour tips of phylogenetic fan

泄露秘密 提交于 2019-12-02 04:38:51
In a phylogenetic fan, I would like to colour code the tips (resembling 62 species in this example) by applying an if-statement. I am currently using the following code, in an attempt to colour all species associated with "O" darkgreen: ColourIf = ifelse(LU != "O", "blue", "darkgreen") tiff("PhyloFan.tif", height=10, width=10, units="in", res=300, compression="lzw"); plot.phylo(phyloFan,type="fan",show.tip.label=T,cex=0.9,show.node.label=F, edge.color="black", adj=0, label.offset=0.75, lwd=2, edge.width=1, tip.color=ColourIf) par(oma=c(0,0,0,0)) dev.off() At the moment, seven species are

R- How to plot correct pie charts in haploNet haplotyp Networks {pegas} {ape} {adegenet}

不想你离开。 提交于 2019-12-01 11:28:22
When using the haploNet package to make some plots on a haplotype network, I used a script available on the internet to do so. However I think there is something wrong. The script is available in form of the woodmouse example. The code I used is: x <- read.dna(file="Masto.fasta",format="fasta") h <- haplotype(x) net <- haploNet(h) plot(net) plot(net, size = attr(net, "freq"), fast = TRUE) plot(net, size = attr(net, "freq")) plot(net, size=attr(net, "freq"), scale.ratio = 2, cex = 0.8 table(rownames(x)) ind.hap<-with( stack(setNames(attr(h, "index"), rownames(h))), table(hap=ind, pop=rownames(x

R- How to plot correct pie charts in haploNet haplotyp Networks {pegas} {ape} {adegenet}

做~自己de王妃 提交于 2019-12-01 07:36:28
问题 When using the haploNet package to make some plots on a haplotype network, I used a script available on the internet to do so. However I think there is something wrong. The script is available in form of the woodmouse example. The code I used is: x <- read.dna(file="Masto.fasta",format="fasta") h <- haplotype(x) net <- haploNet(h) plot(net) plot(net, size = attr(net, "freq"), fast = TRUE) plot(net, size = attr(net, "freq")) plot(net, size=attr(net, "freq"), scale.ratio = 2, cex = 0.8 table

How to get correct order of tip labels in APE after calling ladderize function

孤街浪徒 提交于 2019-11-30 16:57:01
问题 I'm trying to order the rows of a dataframe based on the tip labels found in a phylogenetic tree. The way I was going to do this was to use the match function similar to the answer from this question, however I'm stuck cause the tip.label property of the ape phylo object doesn't change if you reorder the nodes using the ladderize function. library(ape) tree <- read.tree(text = "(((A,B),(C,D)),E);") tree2 <- ladderize(tree, right = FALSE) tree$tip.label #> [1] "A" "B" "C" "D" "E" tree2$tip