LocalPlot: Plot local ancestry dosages

View source: R/LocalPlot.R

LocalPlotR Documentation

Plot local ancestry dosages

Description

This function generates local admixture plot

Usage

LocalPlot(Ancestry, GeneticMap, DisplayNAs = FALSE)

Arguments

Ancestry

List of local ancestry dosages for an individual of size C (number of chromosomes) with each element being a matrix with ancestry dosages of dimension M (number of markers) x K (number of groups)

GeneticMap

Dataframe with three columns: Chromosome, Marker, and Distance, with M rows. Distance must be in centiMorgan

DisplayNAs

Should missing data be displayed as gaps (FALSE by default)

Details

The function LocalPlot() based on ggplot2::ggplot() performs local admixture plot using local ancestry dosage estimated from the AdmixLocal() function and a genetic map.

The plot displays local ancestry dosages for one individual, with one facet for each of the chromosomes. The x-axis represents the genetic distance and the y-axis represents ancestry dosages, ranging from 0 to the ploidy level of the individual.

When the individual has missing genotypic data as compared to the genetic map, the gaps can be displayed as blanks by setting DisplayNAs=TRUE

Value

A local admixture plot as a ggplot object

See Also

  • SimulatePop() to simulate a polyploid admixed population.

  • AdmixGlobal() to perform global (genome-wide) admixture inference.

  • AdmixLocal() to perform local admixture inference.

Examples

## Simulate Simulate a polyploid admixed population
DataSim <- SimulatePop(K=3L, N=10L, P=6L, M=50L, C=5L, L=10L, Seed=123, NbThreads=1)

## Perform global admixture inference
ResAdmixGlobal <- AdmixGlobal(Geno=DataSim$Geno, K=3, Verbose=FALSE, NbThreads=1)

## Perform local admixture inference for one individual
ResAdmixLocal <- AdmixLocal(Geno=DataSim$Geno, ResAdmixGlobal, "Ind4", 6L,
                            DataSim$GeneticMap, Verbose=FALSE, NbThreads=1)
                            
## Local admixture barplot 
LocalPlot(ResAdmixLocal$Posterior, DataSim$GeneticMap)

AdmixPoly documentation built on June 18, 2026, 1:06 a.m.