Biostar Beta. Not for public use.
Problems in plotting phylogenetic tree and principal component analysis
1
Entering edit mode
2.6 years ago
Germany

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 )
par(mfrow=c(1,1))


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.5k views
0
Entering edit mode

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

0
Entering edit mode

Here I have attached the link and the image of my phylogenetic tree. Please see and help me to solve it. http://i.imgur.com/7MVpgSL.jpg?1![](http://i.imgur.com/7MVpgSL.jpg?1)

1
Entering edit mode
16 months ago
Ying W ♦ 3.9k
South San Francisco, CA

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

1
Entering edit mode
16 months ago

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