In [2]:
using DataFrames,JWAS
using JWAS: Datasets,misc
In [3]:
phenofile = Datasets.dataset("testMT","phenotype.txt")
genofile = Datasets.dataset("testMT","genotype.txt")
pedfile = Datasets.dataset("testMT","pedigree.txt");
In [4]:
;cat $phenofile
In [5]:
;cat $genofile
In [6]:
;cat $pedfile
In [7]:
data=readtable(phenofile)
Out[7]:
In [15]:
R = [10.0 2.0
2.0 1.0]
G = [20.0 1.0
1.0 2.0];
In [16]:
model_equations = "BW = intercept + age + sex;
CW = intercept + age + sex";
In [17]:
model1 = build_model(model_equations,R);
In [18]:
set_covariate(model1,"age");
In [19]:
add_markers(model1,genofile,G,separator=',',header=true);
In [20]:
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)
out = runMCMC(model1,data,Pi=Pi,chain_length=5000,methods="BayesC",
estimatePi=true,output_samples_frequency=5);
In [21]:
keys(out)
Out[21]:
In [22]:
file1="MCMC_samples_for_marker_effects_BW.txt"
file2="MCMC_samples_for_marker_effects_CW.txt";
In [23]:
get_breeding_values(model1,file1,file2)
Out[23]:
In [24]:
samples4G=get_additive_genetic_variances(model1,file1,file2);
In [25]:
samples4R=out["MCMC samples for residual covariance matrix"];
In [26]:
samples4h2=get_heritability(reformat(samples4G),reformat(samples4R));
In [27]:
samples_genetic_correlation=get_correlations(reformat(samples4G));
In [28]:
#heritability for trait 2
report(samples4h2,index=2)
Out[28]:
In [ ]:
#genetic correlation between trait 1 and trait 2
report2(reformat(samples4G),index=[1,2]);
In [23]:
model_equations = "BW = intercept + age + sex + Animal;
CW = intercept + age + sex + Animal";
model2 = build_model(model_equations,R);
set_covariate(model2,"age");
get pedigree information from a file
In [24]:
ped=get_pedigree(pedfile);
In [25]:
GA = G*0.1
set_random(model2,"Animal",ped,GA)
In [26]:
GM = G*0.9
add_markers(model2,genofile,GM,separator=',',header=true);
In [27]:
Pi=Dict([1.0; 1.0]=>0.25,[1.0;0.0]=>0.25,[0.0,1.0]=>0.25,[0.0; 0.0]=>0.25)
out2=runMCMC(model2,data,Pi=Pi,chain_length=5000,methods="BayesC");
In [28]:
keys(out2)
Out[28]:
In [29]:
out2["Posterior mean of polygenic effects covariance matrix"]
Out[29]: