This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Plotting file eigenvec

Good morning,

I'm doing a research on GWAS and I've obtained some file .eigenvec and .eigenval after executing the command --pca on PLINK 1.9.

How can I plot those files? What software can i use for this purpose?

Thank you in advance

plink pca gwas

1 answer

This is straightforward in R.

  1. Load the .eigenvec file. E.g. eigenvec_table <- read.table('plink.eigenvec')

  2. Use plot() on the columns you're interested in. Top eigenvector will be in column 3, second eigenvector will be in column 4, etc., so if you want a set of pairwise plots covering the top 4 eigenvectors, use e.g. plot(eigenvec_table[3:6])

Hi Chris, Why there is a "#" in the header of plink2.eigenvec? when R read "plink2.eigenvec", "#" line will be ignored

That depends on how you read the file with R.

For consistency with VCF, practically all plink2-output header lines start with ‘#’.

how to specify the colors to the different samples before plot pca?

Log in to answer this question.