Biowulf High Performance Computing at the NIH
xwas on Biowulf

XWAS is used in the analysis of the X chromosome in association studies. From the XWAS home page:

The X chromosome plays an important role in complex human traits and diseases, especially those with sexually dimorphic characteristics. Special attention needs to be given to analysis of X due to its unique inheritance pattern and X-inactivation. These lead to several analytical complications that have resulted in the majority of genome-wide association studies (GWAS) to date having excluded the X chromosome or otherwise mishandled it by applying the same tools designed for non-sex chromosomes. With XWAS, we hope to provide the tools and incentive to incorporate the X chromosome into GWAS, hence enabling discoveries of novel loci implicated in many diseases and in their sexual dimorphism.

References:

For a detailed list of references for different aspects of XWAS please see the Home page

Documentation
Important Notes

Interactive job
Interactive jobs should be used for debugging, graphics, or applications that cannot be run as batch jobs.

Allocate an interactive session and run the program. Sample session:

[user@biowulf]$ sinteractive
salloc.exe: Pending job allocation 46116226
salloc.exe: job 46116226 queued and waiting for resources
salloc.exe: job 46116226 has been allocated resources
salloc.exe: Granted job allocation 46116226
salloc.exe: Waiting for resource configuration
salloc.exe: Nodes cn3144 are ready for job

[user@cn3144]$ module load xwas
[+] Loading xwas 3.0
[user@cn3144]$ # copy the input data
[user@cn3144]$ cp -r ${XWAS_TEST_DATA_IMPUTE} .
[user@cn3144]$ # create required directories
[user@cn3144]$ mkdir -p example_X_final example_X_step1 example_X_step2
[user@cn3144]$ # create a parameter file; note that trailing slashes are required
[user@cn3144]$ cat > example.par <<END_OF_CONFIG
FILE: hapmap3_euro_all
OUTPUT: hapmap3_chr23_imputed
NJOBS: 31
BUILD: 18
FILELOC: example_X_loc/
REFLOC: ${XWAS_DB}/impute_ref/
TOOLSLOC: ${XWAS_IMPUTE_BIN}/
RESLOC1: example_X_step1/
RESLOC2: example_X_step2/
FINALRESLOC: example_X_final/
MAFRULE: EUR.MAF<=0.005
END_OF_CONFIG

[user@cn3144]$ # create all the scripts
[user@cn3144]$ make_imputation_files example.par
[user@cn3144]$ # run first step; output will be in RESLOC1
[user@cn3144]$ ./hapmap3_euro_all_preimpute.sh
[user@cn3144]$ # run step 2 - run in parallel using swarm
[user@cn3144]$ swarm -t1 -p2 -g2 --time=60 -f hapmap3_euro_all_impute2_run_all.sh
[user@cn3144]$ # wait for swarm to finish
[user@cn3144]$ # run step 3
[user@cn3144]$ ./hapmap3_euro_all_impute2_cat.sh

Then run the post-impute QC pipeline. Note that build is now 19.

[user@cn3144]$ cd example_X_final
[user@cn3144]$ cat > qc.par <<END_OF_CONFIG
filename hapmap3_chr23_imputed
xwasloc ${XWAS_BIN}/
eigstratloc ${XWAS_BIN}/
excludexchrPCA	YES
build 19
alpha 0.05
plinkformat bed
exclind 0
maf 0.005
missindiv 0.1
missgeno 0.1
numpc 10
related 0.125
quant 0
END_OF_CONFIG
[user@cn3144]$ xwas_qc.post_imputation.sh qc.par

Next, an example of how to do some association tests

[user@cn3144]$ cp -r ${XWAS_TEST_DATA} .
[user@cn3144]$ cd example/gene_test
[user@cn3144]$ cat > example_params_gene_test.txt <<END_OF_CONFIG
filename	example_gene_test
xwasloc	${XWAS_BIN}/
genescriptloc	${XWAS_BIN}/
genelistname	example_gene_test_list.txt
assocfile	example_gene_test_snp_pval.txt
numindiv 50
buffer	15000
output	example_gene_test_result.txt
END_OF_CONFIG

[user@cn3144]$ gene_based_test.sh example_params_gene_test.txt
[user@cn3144]$ exit
salloc.exe: Relinquishing job allocation 46116226
[user@biowulf]$

xwas allows many different analyses. Please see the manual for more documentation.

Batch job
Most jobs should be run as batch jobs.

Create a batch input file (e.g. xwas.sh), which uses the input file 'xwas.in'. For example:

#! /bin/bash
# this file is impute.sh

# create required directories
mkdir -p example_X_final example_X_step1 example_X_step2

# create a parameter file
cat > example.par <<END_OF_CONFIG
FILE: hapmap3_euro_all
OUTPUT: hapmap3_chr23_imputed
NJOBS: 31
BUILD: 18
FILELOC: example_X_loc/
REFLOC: ${XWAS_DB}/impute_ref/
TOOLSLOC: ${XWAS_IMPUTE_BIN}/
RESLOC1: example_X_step1/
RESLOC2: example_X_step2/
FINALRESLOC: example_X_final/
MAFRULE: EUR.MAF<=0.005
END_OF_CONFIG

# create all the scripts
make_imputation_files example.par

par="--time=60 --partition=quick"
# run step 1
jid1=$(sbatch --mem=2g ${par} hapmap3_euro_all_preimpute.sh)
[[ $? -eq 0 ]] || exit 1
echo "Submitted step 1: ${jid1}"

# run step 2
jid2=$(swarm -t1 -p2 -g2 ${par} --dependency=afterany:${jid1} -f hapmap3_euro_all_impute2_run_all.sh)
[[ $? -eq 0 ]] || exit 1
echo "Submitted step 2: ${jid2}"

# run step 3
jid3=$(sbatch --dependency=afterany:${jid2} ${par} --mail-type=ALL --mem=6g hapmap3_euro_all_impute2_cat.sh)
[[ $? -eq 0 ]] || exit 1
echo "Submitted step 3: ${jid3}"

sleep 5s
squeue -j ${jid1},${jid2},${jid3}

Submit this job using the Slurm sbatch command.

sbatch xwas.sh