Question: Problems in plotting phylogenetic tree and principal component analysis
gravatar for anikduttapotol
5.6 years ago by
anikduttapotol10 wrote:

Hello, I am facing problem in plotting an unrooted neighbor joining tree based on hamming distance. I have got a figure of my tree. But the labels are overlapped with each other. I used cex=0.5 but it only reduced the font size of my labels but still the problem persist. I used the following codes:

hamdist<- dist.dna(snpdata, model="N")

tree_nj <- nj(hamdist)
plot.phylo(tree_nj, type="unrooted", lab4ut=c("horizontal"),no.margin=T, cex=0.5 )

I could not attach the figure.

Another problem is with the principal component analysis in R. My data contains 250 locus of 100 individuals. And the SNP data is simulated so I do not have any population name or class or information. I am trying to use "s.class" for plotting the figure of PCA. But every time there is this error message "

Error in s.class(PGRtp_ID8_pca$li, seq2$pop, lab = seq2$pop.names) : 
  factor expected for fac".

Now please tell me is there any other method to other than s.class for plotting PCA and get a good figure? Or how can i plot the figure with s.class?

Please also tell me how can I solve the problem with my phylogenetic tree.

Thank you



R • 1.9k views
ADD COMMENTlink modified 5.6 years ago by Antonio R. Franco4.5k • written 5.6 years ago by anikduttapotol10

to show figures upload them at some site (like imgur) and copy the link on your post.

ADD REPLYlink written 5.6 years ago by h.mon32k

Here I have attached the link and the image of my phylogenetic tree. Please see and help me to solve it.

ADD REPLYlink written 5.6 years ago by anikduttapotol10
gravatar for Ying W
5.6 years ago by
Ying W4.0k
South San Francisco, CA
Ying W4.0k wrote:

Unfortunately, quickest way to fix the labels that I know of is to export the image as svg and fix it in illustrator (or any other SVG editor).

For PCA, you can use the prcomp function within R to calculate the principal components that you would then plot on. You could also use other tools like plink to calculate PCA and plot within R

ADD COMMENTlink written 5.6 years ago by Ying W4.0k
gravatar for Antonio R. Franco
5.6 years ago by
Spain. Universidad de Córdoba
Antonio R. Franco4.5k wrote:

There is a terrific program that with some luck you can use. It is named FigTree.

It is a JAVA program you can use in every OS.

You can represent many different type of trees with it using freely colors, size of everything, etc, etc...

Try to write as a table the distance data and check if FigTree can use it. If so, this is your solution for sure

ADD COMMENTlink written 5.6 years ago by Antonio R. Franco4.5k

Well I tried but in my tree there is no node label and that is also not present in my data so it is not opening in FigTree.

ADD REPLYlink written 5.6 years ago by anikduttapotol10
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1752 users visited in the last hour