Model parameters
adap is the only variable exported from Analytical module. It is a Mutable structure contaning the variables required to solve the analytical approach. Any value can be easly changed. Remember adap should be change before the execution, in other case, $\alpha_{(x)}$ will be solve with the default values. To change all the values at once, you can use Analytical.parameters
in order to set specific models in a new variable.
Analytical.parameters
— TypeMutable structure containing the variables required to solve the analytical approach. All the functions are solve using the internal values of the structure. You should declare a mutable structure to the perform the analytical estimations.
Parameters
gamNeg::Int64
: Selection coefficient for deleterious allelesgL::Int64
: Selection coefficient for weakly benefical allelesgH::Int64
: Selection coefficient for strongly benefical allelesalLow::Float64
: Proportion of α due to weak selectionalTot::Float64
: αthetaF::Float64
: Mutation rate defining BGS strengththetaMidNeutral::Float64
: Mutation rate on coding regional::Float64
: DFE shape parameterbe::Float64
: DFE scale parameterB::Float64
: BGS strengthB_bins::Array{Float64,1}
: BGS values to simulatepposL::Float64
: Fixation probabily of weakly beneficial allelespposH::Float64
: Fixation probabily of strongly beneficial allelesN::Int64
: Population sizen::Int64
: Sample sizeLf::Int64
: Flanking region lengthrho::Float64
: Recombination rateTE::Float64
Analytical.binomial_dict
— TypeMutable structure containing the downsampled SFS.
Returns
bn::Dict
: SparseMatrixCSC containing the binomial convolution
Analytical.Br
— FunctionBr(Lmax,theta)
Expected reduction in nucleotide diversity. Explored at Charlesworth B., 1994:
Arguments
param::parameters
theta::Float64
Returns
Float64
: expected reduction in diversity given a non-coding length, mutation rate and defined recombination.
Analytical.setThetaF!
— FunctionsetThetaF!(param)
Find the optimum mutation given the expected reduction in nucleotide diversity (B value) in a locus.
Returns
adap.thetaF::Float64
: changes adap.thetaF value.
Analytical.setPpos!
— FunctionsetPpos!(param)
Find the probabilty of positive selected alleles given the model. It solves a equation system taking into account fixations probabilities of weakly and strong beneficial alleles.
Returns
Tuple{Float64,Float64}
: weakly and strong beneficial alleles probabilites.
Analytical.binomOp!
— FunctionbinomOp(param)
Binomial convolution to sample the allele frequencies probabilites depending on background selection values and sample size.
Arguments
param::parameters
convolutedSamples::binomial_dict
Returns
Array{Float64,2}
: convoluted SFS for each B value defined in the model (param.B_bins). The estimations are saved at convolutedBn.bn.
Analytical.phiReduction
— FunctionphiReduction(param,gamma,ppos)
Reduction in fixation probabilty due to background selection and linkage. The formulas used have been subjected to several theoretical works (Charlesworth B., 1994, Hudson et al., 1995, Nordborg et al. 1995, Barton NH., 1995).
The fixation probabilty of selected alleles are reduce by a factor $\phi$:
Multiplying across all deleterious linkes sites, we find:
Arguments
gamma::Int64
: selection coefficient.
Returns
Float64
: expected rate of positive fixations under background selection.
Analytical.analyticalAlpha
— FunctionanalyticalAlpha(param, convolutedSamples)
Analytical α(x) estimation. Solve α(x) generally. We used the expected rates of divergence and polymorphism to approach the asympotic value accouting for background selection, weakly and strong positive selection. α(x) can be estimated taking into account the role of positive selected alleles or not. In this way we explore the role of linkage to deleterious alleles in the coding region.
Arguments
param::parameters
convolutedSamples::binomial_dict
Returns
Array{Float64,1}
α(x).
Analytical estimation
Fixations
Analytical.fixNeut
— Function- fixNeut()
Expected neutral fixations rate reduce by B value.
Returns
Float64
: expected rate of neutral fixations.
Analytical.fixNegB
— FunctionfixNegB(ppos)
Expected fixation rate from negative DFE.
Arguments
ppos::Float64
: positive selected alleles probabilty.
Returns
Float64
: expected rate of fixations from negative DFE.
Analytical.pFix
— FunctionpFix()
Expected positive fixation rate.
Arguments
ppos::Float64
: positive selected alleles probabilty.
Returns
Float64
: expected rate of positive fixation.
Analytical.fixPosSim
— FunctionfixPosSim(gamma,ppos)
Expected positive fixations rate reduced due to the impact of background selection and linkage. The probabilty of fixation of positively selected alleles is reduced by a factor Φ across all deleterious linked sites Analytical.phiReduction
.
Arguments
ppos::Float64
: positive selected alleles probabilty.
Returns
Float64
: expected rate of positive fixations under background selection
Polymorphism
Analytical.DiscSFSNeutDown
— FunctionDiscSFSNeutDown()
Expected rate of neutral allele frequency reduce by backgrou nd selection. The spectrum depends on the number of individual []
Return:
Array{Float64}
: expected rate of neutral alleles frequencies.
Analytical.DiscSFSSelPosDown
— FunctionDiscSFSSelPosDown(gammaValue,ppos)
Expected rate of positive selected allele frequency reduce by background selection. The spectrum depends on the number of individuals.
Arguments
gammaValue::Int64
: selection strength.ppos::Float64
: positive selected alleles probabilty.
Return:
Array{Float64}
: expected positive selected alleles frequencies.
Analytical.DiscSFSSelNegDown
— FunctionDiscSFSSelNegDown(param,ppos)
Expected rate of positive selected allele frequency reduce by background selection. Spectrum drawn on a gamma DFE. It depends on the number of individuals.
Arguments
ppos::Float64
: positive selected alleles probabilty.
Return:
Array{Float64}
: expected negative selected alleles frequencies.
Missing docstring for Analytical.cumulativeSfs
. Check Documenter's build log for details.
Summary statistics
Missing docstring for Analytical.poissonFixation
. Check Documenter's build log for details.
Missing docstring for Analytical.poissonPolymorphism
. Check Documenter's build log for details.
Missing docstring for Analytical.sampledAlpha
. Check Documenter's build log for details.
Analytical.iterRates
— FunctioniterRates(param::parameters,afac::Float64,bfac::Float64,alTot::Float64,alLow::Float64,divergence::Array,sfs::Array)
Estimating rates given a model for all B range.
Arguments
param::parameters
convoluted_samples::binomial_dict
alTot::Float64
alLow::Float64
gH::Int64
gL::Int64
gamNeg::Int64
afac::Float64
ρ::Float64
θ::Float64
Output
Array{Float64,2}
Analytical.gettingRates
— FunctiongettingRates(gammaL,gammaH,pposL,pposH,observedData,nopos)
Estimating analytical rates of fixation and polymorphism to approach α value accouting for background selection, weakly and strong positive selection. Output values will be used to sample from a Poisson distribution the total counts of polymorphism and divergence using observed data.
Arguments
param::parameters
cnvBinom::SparseMatrixCSC{Float64,Int64}
Returns
Array{Float64,2}
containing solved model, fixation and polymorphic rates
Missing docstring for Analytical.summaryStatsFromRates
. Check Documenter's build log for details.
Inference tools
Missing docstring for Analytical.parseSfs
. Check Documenter's build log for details.
Analytical.ABCreg
— FunctionABCreg(analysis_folder, replicas, S, tol, abcreg)
Performing ABC inference using ABCreg. Please, be sure your analysis_folder contain the files alphas.txt and summaries.txt produced by Analytical.summaryStatsFromRates()
Arguments
analysis_folder::String
: Folder containing the observed data and summary estatistics. It will be used to output the posterior distributionsS::Int64
: Number of summary stastitics to perform the inference.tol::Float64
: Tolerance value. It define the number of accepted value at ABC inferenceabcreg::String
: Path to ABCreg binary
Output
Files containing posterior distributions from ABCreg