PlotAdmixedSurface: Plots admixture fraction results

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/OriGen-internal.R

Description

This function plots the admixture results from FitAdmixedModelFindUnknowns. These numbers represent the fractional contribution each location has to the individuals genetic data. In other words, an individual with unmixed parents from two different locations should have a fraction of 0.5 from each of those locations with enough data.

Usage

1
PlotAdmixedSurface(AdmixedOutput,UnknownNumber=1,Percent=FALSE,Title=NULL,MaskWater=TRUE)

Arguments

AdmixedOutput

The output of FitAdmixedModelFindUnknowns

UnknownNumber

Integer indicating the unknown individual heat map number to plot.

Percent

A logical value that will display percentages instead of fractions if TRUE.

Title

A string giving the title of the plot. If NULL, a default title is used.

MaskWater

Logical value that if true removes water from the plotted regions.

Value

This outputs a plot of the admixture fractions, the contribution of each location, for a particular unknown individual.

Author(s)

John Michael Ranola, John Novembre, and Kenneth Lange

References

Ranola J, Novembre J, Lange K (2014) Fast Spatial Ancestry via Flexible Allele Frequency Surfaces. Bioinformatics, in press.

See Also

ConvertUnknownPEDData for converting two Plink PED files (known and unknown)into a format appropriate for analysis,

FitOriGenModelFindUnknowns for fitting allele surfaces to the converted data and finding the locations of the given unknown individuals,

PlotUnknownHeatMap for a quick way to plot the resulting unknown heat map surfaces from FitOriGenModelFindUnknowns,

FitAdmixedModelFindUnknowns for fitting allele surfaces to the converted data and finding the locations of the given unknown individuals who may be admixed,

PlotAdmixedSurface for a quick way to plot the resulting admixture surfaces from FitAdmixedFindUnknowns,

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#this example not run because it takes longer than 5 secs
#note - type example(FunctionName, run.dontrun=TRUE) to run the example where FunctionName is
#the name of the function

## Not run: 

##Data generation
SampleSites=10
NumberSNPs=4
TestData=array(sample(2*(1:30),2*SampleSites*NumberSNPs,replace=TRUE),
	dim=c(2,SampleSites,NumberSNPs))
##This data is simulated in Europe which is around Longitude -9 to 38 and Latitude 34 to 60
TestCoordinates=array(0,dim=c(SampleSites,2))
TestCoordinates[,1]=runif(SampleSites,-9,38)
TestCoordinates[,2]=runif(SampleSites,34,60)

##This code simulates the number of major alleles the unknown individuals have.
NumberUnknowns=2
TestUnknowns=array(sample(0:2,NumberUnknowns*NumberSNPs,
	replace=TRUE),dim=c(NumberUnknowns,NumberSNPs))

##MaxGridLength is the maximum number of boxes allowed 
##to span the region in either direction
##Note that this number was reduced to allow the example to run in less than 5 secs
##RhoParameter is a tuning constant
print("MaxGridLength is intentionally set really low for fast examples. 
	Meaningful results will most likely require a higher value.")

##Fitting the admixed model
##Note that MaxGridLength is intentionally set unusably low so that the example
##runs in under 5 seconds.  The default value of 20 is more reasonable in general
AdmixedTrials=FitAdmixedModelFindUnknowns(TestData,TestCoordinates,
	TestUnknowns,MaxGridLength=8,RhoParameter=10)
##Plots the admixed surface disregarding fractions less than 0.01
PlotAdmixedSurface(AdmixedTrials,UnknownNumber=1)


## End(Not run)

OriGen documentation built on May 2, 2019, 6:39 a.m.