Last updated: 2019-04-03
Checks: 5 1
Knit directory: Comparative_eQTL/analysis/
This reproducible R Markdown analysis was created with workflowr (version 1.2.0). The Report tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
The R Markdown is untracked by Git. To know which version of the R Markdown file created these results, you’ll want to first commit it to the Git repo. If you’re still working on the analysis, you can ignore this warning. When you’re finished, you can run wflow_publish
to commit the R Markdown file and build the HTML.
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(20190319)
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.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility. The version displayed above was the version of the Git repository at the time these results were generated.
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: .DS_Store
Ignored: .Rhistory
Ignored: .Rproj.user/
Untracked files:
Untracked: analysis/20190321_Check-Kinship-And-PopulationStructure.Rmd
Untracked: analysis/20190325_MergingRNASeqLanes.Rmd
Untracked: analysis/20190326_Admixture.Rmd
Untracked: analysis/20190326_PCA.Rmd
Untracked: analysis/20190327_MakeFamAndCovariateFiles.Rmd
Untracked: analysis/20190327_MakeFamPhenotypeFile.Rmd
Untracked: docs/figure/20190321_Check-Kinship-And-PopulationStructure.Rmd/
Untracked: docs/figure/20190325_MergingRNASeqLanes.Rmd/
Untracked: docs/figure/20190326_Admixture.Rmd/
Untracked: docs/figure/20190326_PCA.Rmd/
Unstaged changes:
Deleted: ._workflowr.yml.swp
Modified: analysis/20190320_Check-RNAseq-PCs.Rmd
Modified: analysis/index.Rmd
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.
There are no past versions. Publish this analysis with wflow_publish()
to start tracking its development.
genotype data from this study (as vcf-files) was merged with that from deManuel et al 2016 (after LiftOver to PanTro5) which contains 65 chimp whole-genome genotype data spanning all of 4 recognized sub-species. Snps were pruned to get variants in approximate equilibrium. Genotype matrix was PCA transformed and plotted below. See Admixture results for a different analysis from the same pruned genotype matrix.
library(plyr)
library(tidyverse)
library(knitr)
library(reshape2)
library(ggrepel)
PCs <- read.table("../output/PopulationStructure/pca.eigenvec", header=T)
kable(head(PCs))
FID | IID | PC1 | PC2 | PC3 | PC4 | PC5 | PC6 | PC7 | PC8 | PC9 | PC10 | PC11 | PC12 | PC13 | PC14 | PC15 | PC16 | PC17 | PC18 | PC19 | PC20 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Pan_troglodytes_ThisStudy | 549 | -0.1086080 | -0.0185367 | 0.0047385 | -0.0162971 | -0.0311260 | 0.0000395 | 0.0580742 | 0.0030003 | 0.0049427 | -0.0146798 | 0.0007913 | 0.0000136 | 0.0018131 | 0.0443707 | 0.0005986 | -0.0045199 | 0.0042858 | -0.0054122 | 0.0049457 | 0.0040508 |
Pan_troglodytes_ThisStudy | 570 | -0.0945861 | -0.0228424 | -0.0139375 | 0.1784300 | 0.0561001 | -0.0123242 | -0.1530910 | 0.0069772 | -0.0475961 | 0.2593960 | -0.0499002 | 0.0451386 | 0.0244429 | -0.0397052 | -0.0247859 | 0.1374960 | -0.0456096 | 0.3216140 | -0.1129810 | -0.1112110 |
Pan_troglodytes_ThisStudy | 389 | -0.1102000 | -0.0206677 | 0.0032202 | 0.0154353 | -0.1000540 | 0.0067056 | -0.3743740 | -0.0264212 | 0.0008181 | 0.0115340 | 0.0012632 | -0.0003830 | -0.0065716 | -0.0203393 | 0.0044067 | -0.0078456 | 0.0226097 | -0.0235458 | 0.0019568 | 0.0015674 |
Pan_troglodytes_ThisStudy | 456 | -0.1080520 | -0.0178848 | 0.0044265 | -0.0109278 | -0.0180761 | -0.0001380 | 0.0346550 | 0.0027620 | 0.0022740 | -0.0061954 | 0.0012627 | -0.0010709 | 0.0001944 | -0.0083610 | -0.0012457 | 0.0000329 | -0.0084463 | 0.0036722 | 0.0055043 | 0.0061112 |
Pan_troglodytes_ThisStudy | 623 | -0.1098180 | -0.0207351 | 0.0041487 | -0.0187801 | -0.0988228 | 0.0098866 | -0.2848930 | -0.0250151 | 0.0174731 | -0.0801156 | 0.0183987 | -0.0171209 | -0.0141164 | 0.0079797 | 0.0116067 | -0.0583678 | 0.0340296 | -0.1413580 | 0.0494442 | 0.0492784 |
Pan_troglodytes_ThisStudy | 438 | -0.1081380 | -0.0178263 | 0.0044915 | -0.0116550 | -0.0195512 | -0.0007298 | 0.0396553 | 0.0037245 | 0.0014656 | -0.0086023 | 0.0023694 | -0.0018639 | -0.0017371 | 0.0041872 | -0.0013800 | -0.0000295 | -0.0043911 | -0.0012766 | 0.0051678 | 0.0062231 |
PCs$Subspecies <- mapvalues(PCs$FID, from=c("Pan_troglodytes_schweinfurthii", "Pan_troglodytes_ellioti", "Pan_troglodytes_ThisStudy", "Pan_troglodytes", "Pan_troglodytes_troglodytes", "Pan_troglodytes_verus"), to=c("Eastern", "Nigeria\nCameroon", "This Study", "Eastern", "Central", "Western"))
kable(head(PCs))
FID | IID | PC1 | PC2 | PC3 | PC4 | PC5 | PC6 | PC7 | PC8 | PC9 | PC10 | PC11 | PC12 | PC13 | PC14 | PC15 | PC16 | PC17 | PC18 | PC19 | PC20 | Subspecies |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Pan_troglodytes_ThisStudy | 549 | -0.1086080 | -0.0185367 | 0.0047385 | -0.0162971 | -0.0311260 | 0.0000395 | 0.0580742 | 0.0030003 | 0.0049427 | -0.0146798 | 0.0007913 | 0.0000136 | 0.0018131 | 0.0443707 | 0.0005986 | -0.0045199 | 0.0042858 | -0.0054122 | 0.0049457 | 0.0040508 | This Study |
Pan_troglodytes_ThisStudy | 570 | -0.0945861 | -0.0228424 | -0.0139375 | 0.1784300 | 0.0561001 | -0.0123242 | -0.1530910 | 0.0069772 | -0.0475961 | 0.2593960 | -0.0499002 | 0.0451386 | 0.0244429 | -0.0397052 | -0.0247859 | 0.1374960 | -0.0456096 | 0.3216140 | -0.1129810 | -0.1112110 | This Study |
Pan_troglodytes_ThisStudy | 389 | -0.1102000 | -0.0206677 | 0.0032202 | 0.0154353 | -0.1000540 | 0.0067056 | -0.3743740 | -0.0264212 | 0.0008181 | 0.0115340 | 0.0012632 | -0.0003830 | -0.0065716 | -0.0203393 | 0.0044067 | -0.0078456 | 0.0226097 | -0.0235458 | 0.0019568 | 0.0015674 | This Study |
Pan_troglodytes_ThisStudy | 456 | -0.1080520 | -0.0178848 | 0.0044265 | -0.0109278 | -0.0180761 | -0.0001380 | 0.0346550 | 0.0027620 | 0.0022740 | -0.0061954 | 0.0012627 | -0.0010709 | 0.0001944 | -0.0083610 | -0.0012457 | 0.0000329 | -0.0084463 | 0.0036722 | 0.0055043 | 0.0061112 | This Study |
Pan_troglodytes_ThisStudy | 623 | -0.1098180 | -0.0207351 | 0.0041487 | -0.0187801 | -0.0988228 | 0.0098866 | -0.2848930 | -0.0250151 | 0.0174731 | -0.0801156 | 0.0183987 | -0.0171209 | -0.0141164 | 0.0079797 | 0.0116067 | -0.0583678 | 0.0340296 | -0.1413580 | 0.0494442 | 0.0492784 | This Study |
Pan_troglodytes_ThisStudy | 438 | -0.1081380 | -0.0178263 | 0.0044915 | -0.0116550 | -0.0195512 | -0.0007298 | 0.0396553 | 0.0037245 | 0.0014656 | -0.0086023 | 0.0023694 | -0.0018639 | -0.0017371 | 0.0041872 | -0.0013800 | -0.0000295 | -0.0043911 | -0.0012766 | 0.0051678 | 0.0062231 | This Study |
eigenvals <- read.table("../output/PopulationStructure/pca.eigenval", header=F)
kable(head(eigenvals))
V1 |
---|
26.37000 |
7.61469 |
5.18840 |
1.83704 |
1.78864 |
1.56717 |
#Get rid of clutter by only labeling individuals in this study
PCs$Label <- PCs$IID
PCs$Label[PCs$FID != "Pan_troglodytes_ThisStudy"] <- ""
Warning in `[<-.factor`(`*tmp*`, PCs$FID != "Pan_troglodytes_ThisStudy", :
invalid factor level, NA generated
ggplot(PCs, aes(x=PC1, y=PC2, label=Label, color=Subspecies)) +
geom_point() +
geom_text_repel(size=2)
Warning: Removed 59 rows containing missing values (geom_text_repel).
ggplot(PCs, aes(x=PC2, y=PC3, label=Label, color=Subspecies)) +
geom_point() +
geom_text_repel(size=2)
Warning: Removed 59 rows containing missing values (geom_text_repel).
ggplot(PCs, aes(x=PC4, y=PC5, label=Label, color=Subspecies)) +
geom_point() +
geom_text_repel(size=2)
Warning: Removed 59 rows containing missing values (geom_text_repel).
ggplot(PCs, aes(x=PC6, y=PC7, label=Label, color=Subspecies)) +
geom_point() +
geom_text_repel(size=2)
Warning: Removed 59 rows containing missing values (geom_text_repel).
Conclusion from this (and admixture analysis) is that most individuals in this cohort are Western chimps, and a fair number have recent admixture with Central chimp. Will include this population structure information in modeling.
Subspecies admixture seems to be captured in the first 3 PCs. Looking at the smaller PCs, samples are not seperated by subspecies, but I notice a few samples still cluster tightly together, which seem to correspond to closely related samples as plotted in kinship analysis.
sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS 10.14
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggrepel_0.8.0 reshape2_1.4.3 knitr_1.22 forcats_0.4.0
[5] stringr_1.4.0 dplyr_0.8.0.1 purrr_0.3.2 readr_1.3.1
[9] tidyr_0.8.2 tibble_2.1.1 ggplot2_3.1.0 tidyverse_1.2.1
[13] plyr_1.8.4
loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 highr_0.8 cellranger_1.1.0 pillar_1.3.1
[5] compiler_3.5.1 git2r_0.24.0 workflowr_1.2.0 tools_3.5.1
[9] digest_0.6.18 lubridate_1.7.4 jsonlite_1.6 evaluate_0.13
[13] nlme_3.1-137 gtable_0.3.0 lattice_0.20-38 pkgconfig_2.0.2
[17] rlang_0.3.3 cli_1.1.0 rstudioapi_0.10 yaml_2.2.0
[21] haven_2.1.0 xfun_0.6 withr_2.1.2 xml2_1.2.0
[25] httr_1.4.0 hms_0.4.2 generics_0.0.2 fs_1.2.6
[29] rprojroot_1.3-2 grid_3.5.1 tidyselect_0.2.5 glue_1.3.1
[33] R6_2.4.0 readxl_1.1.0 rmarkdown_1.11 modelr_0.1.4
[37] magrittr_1.5 backports_1.1.3 scales_1.0.0 htmltools_0.3.6
[41] rvest_0.3.2 assertthat_0.2.1 colorspace_1.4-1 labeling_0.3
[45] stringi_1.4.3 lazyeval_0.2.2 munsell_0.5.0 broom_0.5.1
[49] crayon_1.3.4