--- title: "Get Started with 'eggla'" description: | How-to run the 'eggla' workflow from quality-control to genome-wide association study. author: "Mickaël Canouil, *Ph.D.* ()" output: rmarkdown::html_vignette: number_sections: true toc: true toc_depth: 3 vignette: | %\VignetteIndexEntry{Get Started with 'eggla'} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- # Run Using Docker ## Create `run_eggla.R` script Copy and edit the following code to a new file (_e.g._, `/home/mcanouil/eggla/run_eggla.R`) on the server that will run the analysis with the appropriate parameters. ```r library(eggla) library(data.table) working_directory <- tempdir() # To be modified by user res <- try(run_eggla_lmm( data = fread("/home/mcanouil/eggla/bmigrowth.csv"), # to be changed with the path of the file containing the data id_variable = "ID", age_days_variable = NULL, # computed based on "age_years_variable" if not provided. Only used for QC. age_years_variable = "age", weight_kilograms_variable = "weight", height_centimetres_variable = "height", sex_variable = "sex", covariates = NULL, male_coded_zero = FALSE, random_complexity = "auto", use_car1 = FALSE, parallel = FALSE, # to parallelise Daymont QC parallel_n_chunks = 1, # to parallelise Daymont QC working_directory = working_directory )) ``` ## Run the script using a Docker container Donwload the (latest) Docker image or a specific version from the [GitHub Registry](https://github.com/users/mcanouil/packages/container/package/eggla) and run it with the following command: ```bash docker run \ --name eggla-docker-analysis \ --user vscode \ --detach \ --rm \ --volume /home/mcanouil/eggla:/tmp/eggla \ ghcr.io/mcanouil/eggla:latest Rscript /tmp/eggla/run_eggla.R ``` _Note_: the left-hand side (LHS) of `/home/mcanouil/eggla:/tmp/eggla` is the directory on the server, the right-hand side is how LHS directory will appear within the Docker container. ## Retrieve the outputs ``` /home/mcanouil/eggla/ ├── 2021-11-23-female.zip └── 2021-11-23-male.zip ``` ## Create `run_eggla_gwas.R` Script Copy and edit the following code to a new file (_e.g._, `/home/mcanouil/eggla/run_eggla_gwas.R`) on the server that will run the analysis with the appropriate parameters. ```r working_directory <- "/home/mcanouil/eggla" setwd(working_directory) library(eggla) chr_in_parallel <- FALSE # or 11 to run 11 chromosomes in 11 processes/cores if (!isFALSE(chr_in_parallel)) { future::plan("multicore", workers = min(chr_in_parallel, future::availableCores())) } run_eggla_gwas( data = "./bmigrowth.csv", results_zip = list.files(path = ".", pattern = "\\.zip", full.names = TRUE), id_column = "ID", traits = c("slope_.*", "auc_.*", "^AP_.*", "^AR_.*"), covariates = c("sex"), vcfs = list.files(path = file.path(".", "vcf"), pattern = "\\.vcf$|\\.vcf.gz$", full.names = TRUE), vep_file = NULL, working_directory = ".", bin_path = list( bcftools = "/usr/bin/bcftools", plink2 = "/usr/bin/plink2" ), threads = 1 ) ``` ## Run the script using a Docker container Donwload the (latest) Docker image or a specific version from the [GitHub Registry](https://github.com/users/mcanouil/packages/container/package/eggla) and run it with the following command: ```bash docker run \ --name eggla-docker-analysis \ --user vscode \ --detach \ --rm \ --volume /home/mcanouil/eggla:/tmp/eggla \ ghcr.io/mcanouil/eggla:latest Rscript /tmp/eggla/run_eggla_gwas.R ``` _Note_: the left-hand side (LHS) of `/home/mcanouil/eggla:/tmp/eggla` is the directory on the server, the right-hand side is how LHS directory will appear within the Docker container. ## Retrieve the outputs ``` /home/mcanouil/eggla/ ├── gwas_software.txt └── gwas.txt.gz ``` # Run Non-Interactively (In Bash/Shell) ## Create `run_eggla.sh` script Copy and edit the following code to a new file (_e.g._, `run_eggla.sh`) on the server that will run the analysis with the appropriate parameters. ```bash #!/bin/bash home_analysis="/home/mcanouil/eggla" # to be changed to the folder in which "egg_analysis" is to be performed mkdir $home_analysis cd $home_analysis || exit Rscript <