Last updated: 2026-03-26

Checks: 6 1

Knit directory: ~/Documents/GitHub/PAINT/

This reproducible R Markdown analysis was created with workflowr (version 1.7.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20251106) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Using absolute paths to the files within your workflowr project makes it difficult for you and others to run your code on a different machine. Change the absolute path(s) below to the suggested relative path(s) to make your code more reproducible.

absolute relative
/Users/lilyheald/Documents/GitHub/PAINT/data/sgdp.wg.pca.eigenvec data/sgdp.wg.pca.eigenvec
/Users/lilyheald/Documents/GitHub/PAINT/data/sgdp.wg.pca.eigenval data/sgdp.wg.pca.eigenval
/Users/lilyheald/Documents/GitHub/PAINT/data/pigmentation_snps_pca.eigenvec data/pigmentation_snps_pca.eigenvec
/Users/lilyheald/Documents/GitHub/PAINT/data/pigmentation_snps_pca.eigenval data/pigmentation_snps_pca.eigenval
/Users/lilyheald/Documents/GitHub/PAINT/data/modern_metadata.csv data/modern_metadata.csv

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 2d31b45. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .RData
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    analysis/.Rhistory
    Ignored:    analysis/.Rproj.user/
    Ignored:    data/modern_metadata.csv
    Ignored:    data/neo_uvi.csv
    Ignored:    data/pigmentation_snps.csv
    Ignored:    data/simons_metadata.csv
    Ignored:    data/simons_whole.csv

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/pca.Rmd) and HTML (docs/pca.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd 05c4750 Lily Heald 2026-03-26 stack snp distribution
html 05c4750 Lily Heald 2026-03-26 stack snp distribution

# whole genome
colnames(eigvec_wg)[1:2] <- c("FID", "IID")

num_pcs_wg <- length(eigval_wg)
pc_names_wg <- paste0("PC", 1:num_pcs_wg)
colnames(eigvec_wg)[3:(2 + num_pcs_wg)] <- pc_names_wg

variance_explained_wg <- eigval_wg / sum(eigval_wg) * 100

pc1_label_wg <- sprintf("PC1 (%.2f%%)", variance_explained_wg[1])
pc2_label_wg <- sprintf("PC2 (%.2f%%)", variance_explained_wg[2])
pc3_label_wg <- sprintf("PC3 (%.2f%%)", variance_explained_wg[3])
pc4_label_wg <- sprintf("PC4 (%.2f%%)", variance_explained_wg[4])

# pigmentation
colnames(eigvec_pig)[1:2] <- c("FID", "IID")

num_pcs_pig <- length(eigval_pig)
pc_names_pig <- paste0("PC", 1:num_pcs_pig)
colnames(eigvec_pig)[3:(2 + num_pcs_pig)] <- pc_names_pig

variance_explained_pig <- eigval_pig / sum(eigval_pig) * 100

pc1_label_pig <- sprintf("PC1 (%.2f%%)", variance_explained_pig[1])
pc2_label_pig <- sprintf("PC2 (%.2f%%)", variance_explained_pig[2])
pc3_label_pig <- sprintf("PC3 (%.2f%%)", variance_explained_pig[3])
pc4_label_pig <- sprintf("PC4 (%.2f%%)", variance_explained_pig[3])
pc_data_wg <- merge(eigvec_wg, metadata, by.x = "FID", by.y = "library_id")

ggplot(pc_data_wg, aes(x = PC1, y = PC2, color = Region)) +
  geom_point(size = 3) +
  geom_text(aes(label = Population_ID), vjust = -0.7, size = 3) +
  labs(
    title = "PCA of whole genome SNPs",
    x = pc1_label_wg,
    y = pc2_label_wg
  ) +
  theme_classic(base_size = 14)

Version Author Date
05c4750 Lily Heald 2026-03-26
pc_data_pig <- merge(eigvec_pig, metadata, by.x = "IID", by.y = "library_id")

ggplot(pc_data_pig, aes(x = PC1, y = PC2, color = Region)) +
  geom_point(size = 3) +
  geom_text(aes(label = Population_ID), vjust = -0.7, size = 3) +
  labs(
    title = "PCA of pigmentation SNPs",
    x = pc1_label_pig,
    y = pc2_label_pig
  ) +
  theme_classic(base_size = 14)

Version Author Date
05c4750 Lily Heald 2026-03-26

sessionInfo()
R version 4.4.2 (2024-10-31)
Platform: aarch64-apple-darwin20
Running under: macOS 26.3.1

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/Detroit
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] lubridate_1.9.4     forcats_1.0.1       dplyr_1.2.0        
 [4] purrr_1.2.1         readr_2.1.6         tidyr_1.3.2        
 [7] tibble_3.3.1        ggplot2_4.0.2       tidyverse_2.0.0    
[10] stringr_1.6.0       data.table_1.18.2.1 workflowr_1.7.2    

loaded via a namespace (and not attached):
 [1] sass_0.4.10        generics_0.1.4     stringi_1.8.7      hms_1.1.4         
 [5] digest_0.6.39      magrittr_2.0.4     timechange_0.4.0   evaluate_1.0.5    
 [9] grid_4.4.2         RColorBrewer_1.1-3 fastmap_1.2.0      rprojroot_2.1.1   
[13] jsonlite_2.0.0     processx_3.8.6     whisker_0.4.1      ps_1.9.1          
[17] promises_1.5.0     httr_1.4.7         scales_1.4.0       jquerylib_0.1.4   
[21] cli_3.6.5          crayon_1.5.3       rlang_1.1.7        bit64_4.6.0-1     
[25] withr_3.0.2        cachem_1.1.0       yaml_2.3.12        otel_0.2.0        
[29] parallel_4.4.2     tools_4.4.2        tzdb_0.5.0         httpuv_1.6.16     
[33] vctrs_0.7.1        R6_2.6.1           lifecycle_1.0.5    git2r_0.36.2      
[37] bit_4.6.0          fs_1.6.6           vroom_1.7.0        pkgconfig_2.0.3   
[41] callr_3.7.6        pillar_1.11.1      bslib_0.10.0       later_1.4.5       
[45] gtable_0.3.6       glue_1.8.0         Rcpp_1.1.1         xfun_0.56         
[49] tidyselect_1.2.1   rstudioapi_0.18.0  knitr_1.51         farver_2.1.2      
[53] htmltools_0.5.9    labeling_0.4.3     rmarkdown_2.30     compiler_4.4.2    
[57] getPass_0.2-4      S7_0.2.1