Skip to content

Running HASE meta analysis in the example study

CAWarmerdam edited this page Feb 14, 2020 · 2 revisions

This short guide was created with the wiki of the upstream repository as a reference.

For meta-analysis, start by downloading the required reference panel, creating mapper files, encoding genotype and phenotype data, and calculating partial derivatives:

# Download the reference panel from Dropbox
../data $ wget https://www.dropbox.com/s/ffw366q4d8shfkf/1000Gp1v3.ref.gz?dl=1
../data $ wget https://www.dropbox.com/s/ajq6ngv1090splo/1000Gp1v3.ref_info.h5?dl=1

# Rename the reference panel files
../data $ mv 1000Gp1v3.ref.gz?dl=1 1000Gp1v3.ref.gz
../data $ mv 1000Gp1v3.ref_info.h5?dl=1 1000Gp1v3.ref_info.h5

# Create mapper files
$ python ../tools/mapper.py -g ./ExampleStudy/examplestudy/ -study_name example_study -o ./mapper/

# Encode the genotype and phenotype files
$ python ../hase.py -g ./ExampleStudy/examplestudy/ -study_name example_study -o ./encoded/ -mapper ./mapper/ -ph ./ExampleStudy/phenotype/ -mode encoding

# Calculate partial derivatives
$ python ../hase.py -g ./ExampleStudy/examplestudy/ -study_name example_study -ph ./ExampleStudy/phenotype/ -cov ./ExampleStudy/covariates/ -mapper ./mapper/ -o ./pd/ -mode single-meta

To perform meta-analysis the encoded genotype and phenotype data has to be shared, as well as the partial derivatives, the probes folder and the individuals folder. Copy the required data to a new directory:

# Make the required directories
$ mkdir -p ExampleStudy_encoded/examplestudy/genotype
$ mkdir ExampleStudy_encoded/examplestudy/individuals
$ mkdir ExampleStudy_encoded/pd_shared
$ mkdir ExampleStudy_encoded/phenotype

# Copy the required data
$ cp -r ExampleStudy/examplestudy/probes ExampleStudy_encoded/examplestudy/
$ cp -r encoded/encode_individuals/* ExampleStudy_encoded/examplestudy/individuals
$ cp -r encoded/encode_genotype/* ExampleStudy_encoded/examplestudy/genotype/
$ cp -r encoded/encode_phenotype/* ExampleStudy_encoded/phenotype/
$ cp pd/*.npy ExampleStudy_encoded/pd_shared/

# Check the resulting directory structure
./ExampleStudy_encoded $ tree
.
├── examplestudy
│   ├── genotype
│   │   ├── 0_example_study.h5
│   │   └── 1_example_study.h5
│   ├── individuals
│   │   └── example_study.h5
│   └── probes
│       └── example_study.h5
├── pd_shared
│   ├── example_study_a_cov.npy
│   ├── example_study_a_test.npy
│   ├── example_study_b_cov.npy
│   ├── example_study_C.npy
│   └── example_study_metadata.npy
└── phenotype
    └── 0_example_study.csv

6 directories, 10 files

Now perform meta-analysis.

# Perform meta-analysis
$ python ../hase.py -g ./ExampleStudy_encoded/examplestudy/ -study_name example_study -ph ./ExampleStudy_encoded/phenotype/ -derivatives ./ExampleStudy_encoded/pd_shared/ -mapper ./mapper/ -o ./results_encoded/ -mode meta-stage

# Generate the output file
$ mkdir out_encoded
$ python ../tools/analyzer.py -r ./results_encoded/ -o ./out_encoded/ -df 996
Clone this wiki locally