This package contains tools for running an HWAS interactively (e.g. interactive R console or Jupyter notebook) or semi- automatically by a programmatic pipeline. The data are read from the bcf file format with htslib [1-2] and the statistics by code from Karl Broman's QTL2 [3-4].
Contents
Pipeline Instructions Compiling and Installation Features Outstanding AI Disclosure Copyright References
Either way memory
requirements should be relatively modest and on the order of
To run the HWAS pipeline many pieces of data and instructions need to come together. Below, I described the requirements and configuration by an example.
To start, we need to initialize the directory structure using
the hwas::init function in an interactive R command line
session, i.e. the R REPL.
library(hwas)
dir.create("analysis_dir")
setwd("analysis_dir")
hwas::init(< geno root directory that contains all dirs with bcf files>,
< geno root directory that contains all sample lists>)
The name of the directory where we will work, analysis_dir, is
arbitrary. If successful, the following directories and files
will be created in directory analysis_dir:
|--- config.yaml
|--- scripts/
| |--- compute_grm.R
| |--- compute_herit.R
| |--- process_pos.R
| |--- process_traits.R
| |--- unique_samples.R
|
|--- preprocess_data/
| |--- samples/
| |--- pos/
|
|--- postprocess_data/
| |--- pos/
|
|--- results/
|--- grms/
|--- lod/
|--- blup/
Next, we need to add the trait specific information to the config.yaml
file.
As the package depends on the systems htslib you need to tell R where to find the header and library files. To do this set the following environment variables
export HTSLIB_LIBS=-L<PATH_TO_LIB>
export HTSLIB_CFLAGS=-isystem<PATH_TO_HEADER_DIR>
Note here the use of isystem instead of -I to
specify the path of the header files. The reason
for this is that we want the header files in R
packages to be discovered before packages locally
installed on our system.
- initialization functionality
- heritability script
- lod script
- blup script
- test against qtl2
The AI Claude 4.7 Opus by Anthropic was used to review code, architectural recommendations / discussions, and in very few cases contributed code. Any code contributed by Claude will be made known in the code comments or in the git logs.
Portions from the linear mixed model fitting code are:
- Copyright (C) 2020 Karl Browman
- Copyright (C) 1995, 1996 Robert Gentleman and Ross Ihaka,
- Copyright (C) 1998-2014 The R Core Team
[1] HTSLIB citation [2] https://github.com/samtools/htslib [3] QTL2 citation [4] https://github.com/rqtl/qtl2
|- analysis_dir/
|--- config.yaml
|--- .scripts/
| |--- compute_grm.R
| |--- compute_herit.R
| |--- process_pos.R
| |--- process_traits.R
| |--- unique_samples.R
|
|--- preprocess_data/
| |--- *traits.tsv*
| |--- *samples*
|
|--- postprocess_data/
| |--- **covariates.tsv**
| |--- **phenotype.tsv**
| |--- **samples**
| |--- pos/
| |--- **chr01.tsv**
| |--- **chr02.tsv**
| |--- ...
| |--- **chr20.tsv**
|
|--- results/
|--- **heritability**
|--- grms/
| |--- **chr01.RData**
| |--- **chr02.RData**
| |--- ...
| |--- **chr20.RData**
|
|--- lod/
| |--- **chr01.bed**
| |--- ...
| |--- **chr20.bed**
|
|--- blup/
|--- **chr01.tsv**
|--- ...
|--- **chr20.tsv**
NOTE ON DIR STRUCTURE
- traits.tsv a file with the sample id, covariates, and trait measurements. The user is responsible for making this file, and it is considered raw data.
- covariates.tsv, and any other name between ** are produced by pipeline.