I try to plot three values of a VCF file (QUAL, DP, and rate of phasing) for all the SNPs in the file.

I thought that a PCA plot would be a good way to reduce dimensions of the plot, and to compare values although they were not on the same scale.

I have tried to build the PCA with different R packages as ggbiplot and pca3d, but its seems that the distribution of the dots cloud is always skewed as a dimension is missing. Find below the code used for generating the ggbiplot.

Would anyone have some advises to reduce three values with different scales to two-dimensional PCA?


# Create the dataframe
df <- df[c("quality", "phasing", "depth")]  

# Create the PCA dataset
pop.pca   <- prcomp(df, center = TRUE,scale. = TRUE)

# Create the plot
ggbiplot(pop.pca) +     
scale_y_continuous(trans='log10') +

enter image description here


1 Answer 1


There isn't a dimension missing because PC1 and PC2 are "summaries" of all your variable. Infact, PC1 is a linear combination of your feature, calculate like: PC1 = v1*feature1 + v2*feature2 + v3*feature3 + ... where v1,v2 and v3 are scalar number calculated directly by PCA model.

PCA calculed n PC, where n is equal to your number of feature and are selected the first and the second PC because are those that explain the greatest variability in the system.

For a complete example in R follow this link


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.