Adding external annotation to the phylogeny tree I was looking to overlay annotation on my phylogeny made,which was solved here question asked where i was looking to compare two different phylogeny which i could do.

Now i want to label the tips into various groups such as if its human or canine etc.One of the possible solution i found is this one not sure how to implement it.

alignment  file
annotation file

library(dendextend)
library(seqinr)
library(phytools)
library(phangorn)

a&lt;-read.alignment("clean_dup_align_fast.fas", format="fasta") 
a.phydat&lt;-as.phyDat(a)
dist.a.phydat&lt;-dist.dna(as.DNAbin(a.phydat))
upgma.a&lt;-upgma(dist.a.phydat)
parsimony(upgma.a,a.phydat)
pars.a &lt;- optim.parsimony(upgma.a, a.phydat)
pars.a&lt;-acctran(pars.a, a.phydat)
pars.a.rooted&lt;-root(pars.a, outgroup="AAA64460", resolve.root=T)
pars.a.rooted.dd&lt;-as.dendrogram(force.ultrametric(pars.a.rooted))


i want to label according to the start column which is my source in my annotation file 
Any suggestion or help would be really appreciated 

My working solution using this , this works as I did the alignment of sequences using full header name which kind of help to look for the pattern and grep it.
The data file

I would still like to see the ggtree way instead of putting lots of label in the plot I would only like to see if I can annotate all the tips which have one organism source as one color rather putting all the labels 

pars.a
# "Phylogenetic tree with 516 tips and 514 internal nodes"

# by using the class() function
class(pars.a)
# "phylo"

# or by using the str() structure function
str(tree) 
str(pars.a)
# "List of 4"
# this list includes $edge, $Nnode, $ tip.label and $edge.length
# the tree$tip.label includes family designation
#tree$tip.label  # 516 of these
pars.a$tip.label
# from the Science paper, we have seven kinase families:
# kinase categories... TK, TKL, STE, CK1, AGC, CAMK, CMGC
# with the following colours
# "red", "green", "paleblue", "orange", "yellow", "purple", "pink", "green" 


# by using the grep()function on the tree$tip.label part of the object
# we can find the tip labels that include "TK/" - i.e. tyrosine kinases
#grep("TK/", tree$tip.label)  # gives a list of numbers with "TK/" in tip label
#length(grep("TK/", tree$tip.label))

grep("Human",pars.a$tip.label)
length(grep("Human",ml.a.rooted$tip.label)
)
# thus there are 94 tip labels with that are designated TK (not TKL tyrosine kinase like)

# make a vector for each tip.label called tipcol with black on all of these...
#tipcol &lt;- rep('black', length(tree$tip.label))
tipcol &lt;- rep('black',length(pars.a$tip.label))

# make a vector with our list of kinase categories
#kinaseCats &lt;- c("TK/", "TKL", "STE", "CK1", "AGC", "CAMK", "CMGC", "RGC")
kinaseCats &lt;- c("Human","Rat","Murine","Bovine","Canine","Feline","Porcine","Gallus","Bat","Infectious","Transmissible")

# make a vector of color we want:
colorsList &lt;-c("red", "darkolivegreen3", "blue", "orange", "blueviolet", "purple", "pink", "green","brown","navyblue","purple4")

# replace colours where grep gives "TK" as red, etc in a loop
#for(i in 1:length(kinaseCats)){
 # tipcol[grep(kinaseCats[i], tree$tip.label)] &lt;- colorsList[i]
#}


for(i in 1:length(kinaseCats)){
  tipcol[grep(kinaseCats[i], pars.a$tip.label)] &lt;- colorsList[i]
}



# plot with edge length false to see nodes better
#plot(tree, 
 #    use.edge.length = FALSE,
  #   tip.color=tipcol, 
   #  cex = 0.25)


plot(pars.a, 
     use.edge.length = FALSE,
     tip.color=tipcol, 
     cex = 0.5)
# slow to draw due to text - a bit annoying!
nodelabels(cex=0.4)


figure
there are nice features in R ggtree package. You may use the geom_cladelabel() function for your purposes. But I haven't find yet a way to automatize clade annotation. To do it, you have to be sure of the clade homogeneity before removing tiplabs. here are some commands to do clade label annotation:

annot&lt;-read.delim("annota.txt", header = T)

ggtr&lt;-as.treedata(pars.a)
g&lt;-ggtree(ggtr)
#find the node number corresponding to the common ancestor of the top clade in you tree
MRCA(ggtr, "AAL40400", "AAF25519")
#here, check that all accessions belong to the same organism/group
subset(annot, label=="AAL40400" | label=="AAF25519")
#in this case, sequences are related to bovine.
g&lt;-g + geom_cladelabel(node=89, label="Bovine", align=F, fontsize=4)
plot(g)

#another example
MRCA(ggtr, "AAA46456", "AAF97738")
subset(annot, label=="AAA46456" | label=="AAF97738")
g&lt;-g+ geom_cladelabel(node=73, label="Rodent", align=F, fontsize=4)
plot(g)