Description Usage Arguments Value Author(s) References See Also Examples
View source: R/OriGen-internal.R
This function plots an allele frequency surface outputted by FitOriGenModel and FitMultinomialModel.
1 2 | PlotAlleleFrequencySurface(AlleleSurfaceOutput,LocusNumber=1,
AlleleNumber=1,MaskWater=TRUE,Scale=FALSE)
|
AlleleSurfaceOutput |
The output of |
LocusNumber |
Integer indicating the Locus number to plot. |
AlleleNumber |
Integer indicating which allele to plot. If using microsatellites and AlleleNumber = 0, then this plots all the allele frequency surfaces in a grid. |
MaskWater |
Logical value that if true removes water from the plotted regions. |
Scale |
Logical value that if TRUE will scale the colors to (0,max(Frequency)) instead of (0,1). |
This outputs a plot (using ggplot) of the allele frequency surface on a map.
John Michael Ranola, John Novembre, and Kenneth Lange
Ranola J, Novembre J, Lange K (2014) Fast Spatial Ancestry via Flexible Allele Frequency Surfaces. Bioinformatics, in press.
ConvertMicrosatData
for converting Microsatellite data files into a format appropriate for analysis,
ConvertPEDData
for converting Plink PED files into a format appropriate for analysis,
FitOriGenModel
for fitting allele surfaces to the converted SNP data,
FitMultinomialModel
for fitting allele surfaces to the converted Microsatellite data,
PlotAlleleFrequencySurface
for a quick way to plot the resulting allele frequency surfaces from FitOriGenModel
or FitMultinomialModel
,;
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 | #this example not run because it takes a little 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
NumberLoci=4
MaxAlleles=4
NumberAllelesAtEachLocus=sample(2:MaxAlleles,NumberLoci,replace=TRUE)
TestData=array(0,dim=c(MaxAlleles,SampleSites,NumberLoci))
for(i in 1:NumberLoci){
for(j in 1:NumberAllelesAtEachLocus[i]){
TestData[j,,i]=sample(1:10,SampleSites,replace=TRUE)
}
}
#Europe is about -9 to 38 and 34 to 60
TestCoordinates=array(0,dim=c(SampleSites,2))
TestCoordinates[,1]=runif(SampleSites,-9,38)
TestCoordinates[,2]=runif(SampleSites,34,60)
#Fitting the model
#MaxGridLength is the maximum number of boxes allowed to span the region in either direction
#RhoParameter is a tuning constant
trials2=FitMultinomialModel(TestData,TestCoordinates,MaxGridLength=20,RhoParameter=10)
str(trials2)
#Plotting the model
PlotAlleleFrequencySurface(trials2)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.