Install prerequisite R package JuliaCall
and devtools
in R.
bash
install.packages("JuliaCall")
install.packages("devtools")
If the error massage Installation failed: Command failed (50)
is shown, please install the latest version of devtools as devtools::install_github("hadley/devtools")
.
Install R package JWASr
in R
bash
devtools::install_github("zhaotianjing/JWASr")
Please set up every time you start a new session of R. The set up time is about 10 seconds.
* Mac or Linux users
bash
JWASr::jwasr_setup()
Windows users
bash
# please change to your local path of libjulia.dll
path_libjulia = "C:/Users/ztjsw/AppData/Local/Julia-1.0.1/bin/libjulia.dll"
JWASr::jwasr_setup_win(path_libjulia)
If R session aborted, please click "Start New Session" and set up again.
Note that all data can be found in our subfolder named "data".
#### Step 1: Load Package
library("JWASr")
Please make sure you've already set up.
#### Step 2: Read data
phenotypes = phenotypes #build-in data
ped_path = "D:\\JWASr\\data\\pedigree.txt" #please change to your local path
pedigree = get_pedigree(ped_path, separator = ',', header = TRUE)
You can import your own data by read.table().
model_equation = "y1 = intercept + x1*x3 + x2 + x3 + ID + dam";
R = 1.0
model = build_model(model_equation,R)
set_covariate(model, "x1")
G1 = 1.0
set_random(model, "x2", G1)
G2 = diag(2)
set_random_ped(model, "ID dam", pedigree, G2)
G3 = 1.0
geno_path = "D:/JWASr/data/genotypes.txt" #please change to your local path
add_genotypes(model, geno_path, G3, separator=',', header = TRUE)
outputMCMCsamples(model, "x2")
out = runMCMC(model, phenotypes, methods = "BayesC", estimatePi = TRUE,
chain_length = 5000, output_samples_frequency = 100)
If you change any function in subfolder "R", please run devtools::document()
in R to update the package. (under path of JWASr).
In the package, we provide a user friendly Graphical User Interface application, which was build by shiny
.
After complete installation above for JWAS
, please also install shiny
by install.packages("shiny")
in R.
In R, please run:
JWASr::runShiny()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.