An R package to infer full-sibling relationships from genetic data. Geared toward datasets with many individuals and about 100 SNPs which are treated as if they are unlinked. (While that is clearly false, it might be reasonable). The method is based on computing the posterior predictive distribution of genotypes conditional on currently-inferred sibling groups. I will eventually generalize that to more general pedigree inference, but for now just want to implement the easy full-sibling case as a prototypical exercise.
On a Mac you need to have the developer command line tools, and on a PC you will
want the RTools to build this package. You need to have the Rcpp
package as
well, and also the devtools
package. You can get both of those from CRAN.
Here is what you would do:
# download, build and install the package
devtools::install_github(repo="fullsniplings", username="eriqande")
Take a look at the first few lines of a SNP data set that has 1157 Chinook typed at 95 SNPs:
head(fs_dev_test_data$chinook_full_sibs_genos)
It is simple two column format (each locus gets two alleles) with the rownames being the IDs of the fish. Missing data are denote by NA, as is typical in R.
The main function for running the MCMC is run_mcmc
. It is not fully documented, yet, but
you can do:
?run_mcmc
to learn about it. The example shows how to do a short run.
If you want to do a longer run (about 5 minutes) you can do
quick_run <- run_mcmc(fs_dev_test_data$chinook_full_sibs_genos, burn_in = 50, num_sweeps = 200)
To do this, you will need V2 of the rmarkdown
package. You can get that either
by using the latest preview version of Rstudio: http://www.rstudio.com/products/rstudio/download/preview/
or by installing rmarkdown from github like this:
devtools::install_github("eriqande/fullsniplings")
Then, once you have done that you should be able to do
rmarkdown::render(system.file("dev_vignettes/full-sibling-chinook-mcmc.Rmd", package="fullsniplings"), output_format = "html_document", output_file = "~/full-sibling-chinook-mcmc.html")
That will put the output in your home directory in the file full-sibling-chinook-mcmc.html
as long as your system
recognizes the ~
. If not, just put an absolute path of your choice in for the output_file
parameter in the
render
function.
Note that this doesn't run the MCMC, it just grabs some stored results. But you can go into the code of
system.file("dev_vignettes/full-sibling-chinook-mcmc.Rmd", package="fullsniplings")
and uncomment the appropriate lines to run it all.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.