Problems in plotting phylogenetic tree and principal component analysis
2
1
Entering edit mode
9.5 years ago

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 • 3.1k views
ADD COMMENT
0
Entering edit mode

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

ADD REPLY
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

ADD REPLY
1
Entering edit mode
9.5 years ago
Ying W ★ 4.3k

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 COMMENT
1
Entering edit mode
9.5 years 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

ADD COMMENT
0
Entering edit mode

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 REPLY

Login before adding your answer.

Traffic: 1686 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6