Internal functions
Documentation for JWAS.jl's internal (private) interface, which are not available to general users. These internal functions are small blocks that public function build on.
<!–-
Index
JWAS.add_genotypes
JWAS.add_markers
JWAS.build_model
JWAS.getMME
JWAS.get_pedigree
JWAS.outputMCMCsamples
JWAS.runMCMC
JWAS.set_covariate
JWAS.set_random
JWAS.set_random
JWAS.showMME
JWAS.solve
Internal interface
JWAS.add_genotypes
— Method.add_genotypes(mme::MME,file,G;separator=' ',header=true,center=true,G_is_marker_variance=false,df=4.0)
Get marker informtion from a genotype file (same order as the phenotype file).
G defaults to the genetic variance with degree of freedom df=4.0.
File format:
Animal,marker1,marker2,marker3,marker4,marker5
S1,1,0,1,1,1
D1,2,0,2,2,1
O1,1,2,0,1,0
O3,0,0,2,1,1
JWAS.add_markers
— Method.same to add_genotypes
JWAS.build_model
— Method.build_model(model_equations::AbstractString,R;df::Float64=4.0)
Build models from model equations with residual varainces R and degree of freedom for residual variance df defaulting to 4.0.
By default, all variabels in model_equations are fixed and factors. Set variables to be covariates or random using functions
set_covariate()
orset_random()
.
#single-trait
model_equations = "BW = intercept + age + sex"
R = 6.72
models = build_model(model_equations,R);
#multi-trait
model_equations = "BW = intercept + age + sex
CW = intercept + litter";
R = [6.72 24.84
24.84 708.41]
models = build_model(model_equations,R);
JWAS.get_pedigree
— Method.get_pedigree(pedfile::AbstractString;header=false,separator=' ')
Get pedigree informtion from a pedigree file.
File format:
a 0 0
b 0 0
c a b
d a c
JWAS.outputMCMCsamples
— Method.outputMCMCsamples(mme::MME,trmStr::AbstractString...)
Get MCMC samples for specific location parameters.
JWAS.runMCMC
— Method.runMCMC(mme,df;Pi=0.0,estimatePi=false,chain_length=1000,burnin = 0,starting_value=false,printout_frequency=100,missing_phenotypes=false,constraint=false,methods="conventional (no markers)",output_samples_frequency::Int64 = 0)
Run MCMC (marker information included or not) with sampling of variance components.
available methods include "conventional (no markers)", "RR-BLUP", "BayesB", "BayesC".
save MCMC samples every output_samples_frequency iterations to files output_file defaulting to
MCMC_samples
.the first burnin iterations are discarded at the beginning of an MCMC run
Pi for single-trait analyses is a number; Pi for multi-trait analyses is a dictionary such as
Pi=Dict([1.0; 1.0]=>0.7,[1.0; 0.0]=>0.1,[0.0; 1.0]=>0.1,[0.0; 0.0]=>0.1)
,if Pi (Π) is not provided in multi-trait analysis, it will be generated assuming all markers have effects on all traits.
starting_value can be provided as a vector for all location parameteres except marker effects.
print out the monte carlo mean in REPL with printout_frequency
constraint=true if constrain residual covariances between traits to be zeros.
JWAS.set_covariate
— Method.set_covariate(mme::MME,variables::AbstractString...)
set variables as covariates; mme is the output of function
build_model()
.
#After running build_model, variabels age and year can be set to be covariates as
set_covariate(models,"age","year")
#or
set_covariate(models,"age year")
JWAS.set_random
— Method.set_random(mme::MME,randomStr::AbstractString,G;df=4)
set variables as i.i.d random effects with variances G whose degree of freedom df defaults to 4.0.
#single-trait (example 1)
model_equation = "y = intercept + litter + sex"
model = build_model(model_equation,R)
G = 0.6
set_random(model,"litter",G)
#multi-trait
model_equations = "BW = intercept + litter + sex
CW = intercept + litter + sex"
model = build_model(model_equations,R);
G = [3.72 1.84
1.84 3.41]
set_random(model,"litter",G)
JWAS.set_random
— Method.set_random(mme::MME,randomStr::AbstractString,ped::Pedigree, G;df=4)
set variables as random polygenic effects with pedigree information ped, variances G whose degree of freedom df defaults to 4.0.
#single-trait (example 1)
model_equation = "y = intercept + Age + Animal"
model = build_model(model_equation,R)
ped = get_pedigree(pedfile)
G = 1.6
set_random(model,"Animal Animal*Age", ped,G)
#single-trait (example 2)
model_equation = "y = intercept + Age + Animal + Animal*Age"
model = build_model(model_equation,R)
ped = get_pedigree(pedfile)
G = [1.6 0.2
0.2 1.0]
set_random(model,"Animal Animal*Age", ped,G)
#multi-trait
model_equations = "BW = intercept + age + sex + Animal
CW = intercept + age + sex + Animal"
model = build_model(model_equations,R);
ped = get_pedigree(pedfile);
G = [6.72 2.84
2.84 8.41]
set_random(model,"Animal", ped,G)
JWAS.showMME
— Method.showMME(mme::MME,df::DataFrame)
Show left-hand side and right-hand side of mixed model equations (no markers).
JWAS.solve
— Method.solve(mme::MME,df::DataFrame;solver="default",printout_frequency=100,tolerance = 0.000001,maxiter = 5000)
Solve the mixed model equations (no marker information) without estimating variance components.
Available solvers includes default
,Jacobi
,GaussSeidel
,Gibbs sampler
.
JWAS.getMME
— Method.Construct mixed model equations with
incidence matrix: X ; response : ySparse; left-hand side : mmeLhs ; right-hand side : mmeLhs ;
–>