SNPRelate; Plot looking blank
1
0
Entering edit mode
10.3 years ago
kumar.vinod81 ▴ 340

I am doing PCA analysis through SNPRelate. Its Generating the PCA plot but completely blank without any error. What to do?

Other question is that how can I add population information in my .gds file as I am working on a plant species. SNPRelate tutorial example file is working very smoothly but I its not user friendly for others.

SNPRelate • 3.0k views
ADD COMMENT
0
Entering edit mode

Can you post the piece of code that you are using ?

ADD REPLY
0
Entering edit mode
> # make a data.frame
> tab <- data.frame(sample.id = pca$sample.id,
+ EV1 = pca$eigenvect[,1], # the first eigenvector
+ EV2 = pca$eigenvect[,2], # the second eigenvector
+ stringsAsFactors = FALSE)
> head(tab)
  sample.id         EV1         EV2
1   NA19152  0.08411287  0.01226860
2   NA19139  0.08360644  0.01085849
3   NA18912  0.08110808  0.01184524
4   NA19160  0.08680864  0.01447106
5   NA07034 -0.03109761 -0.07709255
6   NA07055 -0.03228450 -0.08155730
> # draw
> plot(tab$EV2, tab$EV1, col=as.integer(tab$pop),
+ xlab="eigenvector 2", ylab="eigenvector 1")

Note: Results are generated from .gds file

ADD REPLY
0
Entering edit mode

One possibility could be the eigenvectors EV1 or EV2 contains NaN as values. You can check the actual value by just typing pca$eigenvect[,1] or pca$eigenvect[,2]

ADD REPLY
0
Entering edit mode

but values are there in file as you look at my previous comment

ADD REPLY
1
Entering edit mode

Then the problem is with the col=as.integer(tab$pop) as I could not see any column pop in the tab data structure.

ADD REPLY
0
Entering edit mode

How can I add this column in my data, because in SNPRelate documentation, it is not written.

ADD REPLY
0
Entering edit mode

SNPrelate is an R package. To add the column you just have to add a column to a data.frame. There are several websites explaining this, e.g. this one might help you: https://stackoverflow.com/questions/10150579/adding-a-column-to-a-data-frame

ADD REPLY
0
Entering edit mode
4.6 years ago

Hi, Although this is an older post but if someone is looking for the answer, here I found one on add column to dataframe r- https://www.hdfstutorial.com/blog/add-column-to-dataframe-r/ Using this you will be able to add a new column at the place you want.

ADD COMMENT

Login before adding your answer.

Traffic: 1776 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