Science Score: 23.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
✓DOI references
Found 12 DOI reference(s) in README -
○Academic publication links
-
✓Committers with academic emails
1 of 3 committers (33.3%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.5%) to scientific vocabulary
Repository
R package to estimate kinship and FST from SNP data
Statistics
- Stars: 21
- Watchers: 5
- Forks: 0
- Open Issues: 2
- Releases: 11
Metadata Files
README.md
popkin 
The popkin ("population kinship") R package estimates the kinship matrix of individuals and FST from their biallelic genotypes.
Our estimation framework is the first to be practically unbiased under arbitrary population structures.
Installation
The stable version of the package is now on CRAN and can be installed using
R
install.packages("popkin")
The current development version can be installed from the GitHub repository using devtools:
R
install.packages("devtools") # if needed
library(devtools)
install_github('StoreyLab/popkin', build_vignettes = TRUE)
You can see the package vignette, which has more detailed documentation, by typing this into your R session:
R
vignette('popkin')
Examples
Input data
The examples below assume the following R data variables are present for n individuals and m loci:
- The
m-by-ngenotype matrixX, containing only unphased biallelic variants encoded as 0,1,2 counting a given reference allele per locus. - The length-
nvectorsubpopsthat assigns each individual to a subpopulation.
The subpops vector is not required, but its use is recommended to improve estimation of the baseline kinship value treated as zero.
If your data is in BED format, popkin will process it efficiently using BEDMatrix.
If file is the path to the BED file (excluding .bed extension):
R
library(BEDMatrix)
X <- BEDMatrix(file) # load genotype matrix object
popkin functions
This is a quick overview of every popkin function, covering estimation and visualization of kinship and FST from a genotype matrix.
First estimate the kinship matrix from the genotypes X.
All downstream analysis require kinship, none use X after this
R
library(popkin)
kinship <- popkin(X, subpops) # calculate kinship from X and optional subpop labels
Plot the kinship matrix, marking the subpopulations.
Note inbr_diag replaces the diagonal of kinship with inbreeding coefficients
R
plot_popkin( inbr_diag(kinship), labs = subpops )
Extract inbreeding coefficients from kinship
R
inbreeding <- inbr(kinship)
Estimate FST
R
weights <- weights_subpops(subpops) # weigh individuals so subpopulations are balanced
Fst <- fst(kinship, weights) # use kinship matrix and weights to calculate fst
Fst <- fst(inbreeding, weights) # estimate more directly from inbreeding vector (same result)
Estimate and visualize the pairwise FST matrix
R
pairwise_fst <- pwfst(kinship) # estimated matrix
leg_title <- expression(paste('Pairwise ', F[ST])) # fancy legend label
plot_popkin(pairwise_fst, labs = subpops, leg_title = leg_title) # NOTE no need for inbr_diag() here!
Rescale the kinship matrix using different subpopulations (implicitly changes the most recent common ancestor population used as reference)
R
kinship2 <- rescale_popkin(kinship, subpops2)
Estimate the coancestry matrix from a matrix of allele frequencies P (useful when P comes from an admixture inference model)
R
coancestry <- popkin_af( P )
Please see the popkin R vignette for a description of the key parameters and more detailed examples, including complex plots with multiple kinship matrices and multi-level subpopulation labeling.
Citations
Alejandro Ochoa, John D Storey. 2021. "Estimating FST and kinship for arbitrary population structures." PLoS Genet 17(1): e1009241. PubMed ID 33465078. doi:10.1371/journal.pgen.1009241. bioRxiv doi:10.1101/083923 2016-10-27.
Alejandro Ochoa, John D Storey. 2019. "New kinship and FST estimates reveal higher levels of differentiation in the global human population." bioRxiv doi:10.1101/653279.
Alejandro Ochoa, John D Storey. 2016. "FST And Kinship for Arbitrary Population Structures I: Generalized Definitions." bioRxiv doi:10.1101/083915.
Owner
- Name: Storey Lab
- Login: StoreyLab
- Kind: organization
- Location: Princeton, NJ USA
- Website: http://genomics.princeton.edu/storeylab/
- Repositories: 27
- Profile: https://github.com/StoreyLab
Storey Lab at Princeton University
GitHub Events
Total
- Watch event: 1
- Issue comment event: 1
Last Year
- Watch event: 1
- Issue comment event: 1
Committers
Last synced: over 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| Alejandro Ochoa Garcia | a****g@g****m | 95 |
| Alejandro Ochoa Garcia | o****a@p****u | 74 |
| Alejandro Ochoa | v****a@v****e | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 7
- Total pull requests: 0
- Average time to close issues: 3 months
- Average time to close pull requests: N/A
- Total issue authors: 6
- Total pull request authors: 0
- Average comments per issue: 2.86
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- mkelcb (1)
- pidita (1)
- privefl (1)
- wangzhx36 (1)
- miguel-correa92 (1)
- melop (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 446 last-month
- Total dependent packages: 4
- Total dependent repositories: 5
- Total versions: 10
- Total maintainers: 1
cran.r-project.org: popkin
Estimate Kinship and FST under Arbitrary Population Structure
- Homepage: https://github.com/StoreyLab/popkin/
- Documentation: http://cran.r-project.org/web/packages/popkin/popkin.pdf
- License: GPL-3
-
Latest release: 1.3.23
published over 3 years ago
Rankings
Maintainers (1)
Dependencies
- R >= 3.5.0 depends
- RColorBrewer * imports
- ape * imports
- grDevices * imports
- graphics * imports
- BEDMatrix * suggests
- bnpsd * suggests
- knitr * suggests
- lfa * suggests
- rmarkdown * suggests
- testthat * suggests