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

1 |

`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. |

`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.

`local.ancestry` |
The inferred local ancestry matrix with the same
dimensions of |

`rng.seed` |
The seed used to call |

`rng.state` |
Prior to the call to |

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

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

set.seed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ```
## 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)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.