Last data update: 2014.03.03

R: A function to infer local ancestry
eilaR Documentation

A function to infer local ancestry

Description

A function to infer local ancestry, using fused quantile regression and k-means classifier.

Usage

eila(admixed, position, anc1, anc2, anc3 = NULL, lambda = 15, rng.seed = 172719943)

Arguments

admixed

A SNP matrix of admixted individuals with SNPs in the rows, samples in the columns. The elements of the matrix are the genotypes being coded as the number of copies of the variant allele present, 0, 1 or 2.

position

A vector for the physical postions of the SNPs

anc1

A SNP matrix of ancestry 1 samples with SNPs in the rows, samples in the columns. The elements of the matrix are the genotypes being coded as the number of copies of the variant allele present, 0, 1 or 2.

anc2

A SNP matrix of ancestry 2 samples with SNPs in the rows, samples in the columns. The elements of the matrix are the genotypes being coded as the number of copies of the variant allele present, 0, 1 or 2.

anc3

An optional SNP matrix of ancestry 3 samples with SNPs in the rows, samples in the columns (default NULL). The elements of the matrix are the genotypes being coded as the number of copies of the variant allele present, 0, 1 or 2.

lambda

A number controlling the smoothness of the fused quantile regression (default 15).

rng.seed

The seed used for the random number generator (default 172719943) for reproducibility of simulated equally admixed individuals.

Details

eila is an function for inferring local ancestry.

The admixed samples are assumed as descended from ancestry 1 ancestry 2, or ancestry 3. The data matrixes of admixed samples and ancestral samples are coded as thee number of copies of the variant allele present (0, 1, or 2). The physical positions of SNPs are in base pairs unit.

The method for efficient inference of local ancestry (EILA) in admixed individuals is based on three steps. The first step assigns a numerical score (with a range of 0 to 1) to genotypes in admixed individuals in order to better quantify the closeness of the SNPs to a certain ancestral population. The second step uses fused quantile regression to identify breakpoints of the ancestral haplotypes. In the third step, the k-means classifier is used to infer ancestry at each locus.

The major strength of EILA is that it relaxes the assumption of linkage equilibrium and uses all genotyped SNPs rather than only unlinked loci to increase the power of inference. Another important strength of this method is its higher accuracy and lower variation.

Value

local.ancestry

The inferred local ancestry matrix with the same dimensions of admixed. The elements of the matrix are local ancestry being coded as alleles identification from ancestries 1, 2, or 3. For example, element 12 means one allele is from ancestry 1 and the other allele is from ancestry 2.

rng.seed

The seed used to call set.seed for reproducibility.

rng.state

Prior to the call to set.seed, rng.state is the value of .Random.seed should .Random.seed exist. Otherwise, NULL is returned.

Author(s)

James J. Yang, Jia Li, Anne Buu, and L. Keoki Williams

References

Yang, J. J., LI, J., Buu, A., and Williams, L. K. (2013) Efficient Inference of Local Ancestry. Bioinformatics. doi: 10.1093/bioinformatics/btt488

See Also

set.seed

Examples

## Two ancestries
data(ceuyri)
res.eila <- eila(admixed  = ceuyri$admixed,
                 position = ceuyri$position,
                 anc1     = ceuyri$anc1,
                 anc2     = ceuyri$anc2)
cat("Overall accuracy:", mean((res.eila$local.ancestry ==
                  ceuyri$true.local.ancestry), na.rm=TRUE),"\n")

## Three ancestries
## Not run: 
data(ceuchdyri)
res.eila <- eila(admixed  = ceuchdyri$admixed,
                 position = ceuchdyri$position,
                 anc1     = ceuchdyri$anc1,
                 anc2     = ceuchdyri$anc2,
                 anc3     = ceuchdyri$anc3)
cat("Overall accuracy:", mean(res.eila$local.ancestry ==
           ceuchdyri$true.local.ancestry),"\n")

## End(Not run)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(EILA)
Loading required package: class
Loading required package: quantreg
Loading required package: SparseM

Attaching package: 'SparseM'

The following object is masked from 'package:base':

    backsolve

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/EILA/eila.Rd_%03d_medium.png", width=480, height=480)
> ### Name: eila
> ### Title: A function to infer local ancestry
> ### Aliases: eila
> ### Keywords: local ancestry quantile regression k-means
> 
> ### ** Examples
> 
> ## Two ancestries
> data(ceuyri)
> res.eila <- eila(admixed  = ceuyri$admixed,
+                  position = ceuyri$position,
+                  anc1     = ceuyri$anc1,
+                  anc2     = ceuyri$anc2)
> cat("Overall accuracy:", mean((res.eila$local.ancestry ==
+                   ceuyri$true.local.ancestry), na.rm=TRUE),"\n")
Overall accuracy: 0.9606667 
> 
> ## Three ancestries
> ## Not run: 
> ##D data(ceuchdyri)
> ##D res.eila <- eila(admixed  = ceuchdyri$admixed,
> ##D                  position = ceuchdyri$position,
> ##D                  anc1     = ceuchdyri$anc1,
> ##D                  anc2     = ceuchdyri$anc2,
> ##D                  anc3     = ceuchdyri$anc3)
> ##D cat("Overall accuracy:", mean(res.eila$local.ancestry ==
> ##D            ceuchdyri$true.local.ancestry),"\n")
> ## End(Not run)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>