an R package for ancestry analysis
This is an introduction to radmixture which could help you with estimating individual ancestries from large SNP genotype data.
This document introduces you how to use this package.
devtools::install_github("wegene-llc/radmixture")
install.packages("radmixture")
First, you must prepare your raw data file as follow:
and read it into R with read.table
or read.csv
.
library(radmixture)
genotype <- read.table(file = '/path/to/file')
# genotype <- read.csv(file = 'path/to/file')
Pay attention:
Since the public datasets are not on CRAN, if you download this package from CRAN, you should download the datasets that you need from GitHub by yourself. For example:download.file(url = 'https://github.com/wegene-llc/radmixture/raw/master/data/globe4.alleles.RData', destfile = '/path/to/globe4.alleles.RData')
download.file(url = 'https://github.com/wegene-llc/radmixture/raw/master/data/globe4.4.F.RData', destfile = '/path/to/globe4.4.F.RData')
And then, load them into R.
load('/path/to/globe4.alleles.RData')
load('/path/to/globe4.4.F.RData')
Six public datasets could be used in this package.
tfrdpub()
to transfer your raw data to a format understood by radmixture# Use K4
res <- tfrdpub(genotype, 4, globe4.alleles, globe4.4.F)
# Use K7b
res <- tfrdpub(genotype, 7, K7b.alleles, K7b.7.F)
# Use world9
res <- tfrdpub(genotype, 9, world9.alleles, world9.9.F)
# Use E11
res <- tfrdpub(genotype, 11, e11.alleles, e11.11.F)
# Use K12b
res <- tfrdpub(genotype, 12, K12b.alleles, K12b.12.F)
# Use K13
res <- tfrdpub(genotype, 13, globe13.alleles, globe13.13.F)
fFixQN()
to calculate your result# Use K4
ances <- fFixQN(res$g, res$q, res$f, tol = 1e-4, method = "BR", pubdata = "K4")
# Use K7b
ances <- fFixQN(res$g, res$q, res$f, tol = 1e-4, method = "BR", pubdata = "K7b")
# Use world9
ances <- fFixQN(res$g, res$q, res$f, tol = 1e-4, method = "BR", pubdata = "World9")
# Use E11
ances <- fFixQN(res$g, res$q, res$f, tol = 1e-4, method = "BR", pubdata = "E11")
# Use K12b
ances <- fFixQN(res$g, res$q, res$f, tol = 1e-4, method = "BR", pubdata = "K12b")
# Use K13
ances <- fFixQN(res$g, res$q, res$f, tol = 1e-4, method = "BR", pubdata = "K13")
ances$q
is your result.
We welcome contributions on radmixture. You can fork this repo and make your changes and submit a pull request. Report bug issues on issue page.
MIT + LICENSE