Part-1: html rendered from .Rmd files

This example was created from a .Rmd file using Quarto.

Population structure

Calculate principal components using chromosome 22. Plot PC1 vs PC2 using different color for each population. Keep only CEU, YRI, ASW, and CHB before plotting.

system(glue::glue("/bin/plink/plink --bfile ./hapmap3_ch22 --pca --out ./pca"))
pcplink = read.table(glue::glue("./pca.eigenvec"),header=F, as.is=T)
names(pcplink) = c("FID","IID",paste0("PC", c(1:(ncol(pcplink)-2))))
pcplink = popinfo %>% inner_join(pcplink, by=c("FID"="FID", "IID"="IID"))
pcplink %>% 
  filter(population =="CEU"|population=="YRI"|population=="ASW"|population=="CHB") %>%
  ggplot(aes(PC1,PC2,col=population)) + 
  geom_point(size=3,alpha=.7) + 
  theme_bw(base_size = 15)