Skip to content

Instantly share code, notes, and snippets.

@johnbowes
Created February 9, 2016 16:00
Show Gist options
  • Save johnbowes/0e5ec5d74ed5313684a3 to your computer and use it in GitHub Desktop.
Save johnbowes/0e5ec5d74ed5313684a3 to your computer and use it in GitHub Desktop.
bash script for imputing a genomic interval. Used with the SGE job array script.
#!/bin/bash
CHR=$1
INTERVAL_START=`printf "%.0f" $2`
INTERVAL_END=`printf "%.0f" $3`
INTERVAL=`printf "%03d" $4`
# directories
NAME="impute_test_data_hg19"
OUTPUT_DIR="/mnt/iusers01/jw01/mdeasjdb/scratch/impute_practice/"
PHASE_DATA_DIR="phasing/output/"
REF_DIR="/mnt/iusers01/jw01/jw01-shared-resources/impute2/ref_panel/ALL_1000G_phase1integrated_v3_impute_macGT1/"
# executable
IMPUTE2_EXEC=/mnt/iusers01/jw01/jw01-shared-resources/impute2/bin/impute2_2.3.0
# parameters
K=80
ITER=30
BURNIN=10
NE=20000
# Genetic map.
MAP_FILE=${REF_DIR}genetic_map_chr${CHR}_combined_b37.txt
# Panel 0 phased reference haplotypes.
REF_HAP_FILE=${REF_DIR}ALL_1000G_phase1integrated_v3_chr${CHR}_impute_macGT1.hap.gz
REF_LEGEND_FILE=${REF_DIR}ALL_1000G_phase1integrated_v3_chr${CHR}_impute_macGT1.legend.gz
# Panel 2 phased inference genotypes.
STUDY_HAP_FILE=${PHASE_DATA_DIR}${NAME}_chr${CHR}.haps.gz
STUDY_SAMPLE_FILE=${PHASE_DATA_DIR}${NAME}_chr${CHR}.sample
# main output file
OUTPUT_FILE=${OUTPUT_DIR}${NAME}_chr${CHR}.int${INTERVAL}.pos${INTERVAL_START}-${INTERVAL_END}.impute2
# Impute interval
$IMPUTE2_EXEC \
-use_prephased_g \
-known_haps_g $STUDY_HAP_FILE \
-h $REF_HAP_FILE \
-l $REF_LEGEND_FILE \
-m $MAP_FILE \
-int $INTERVAL_START $INTERVAL_END \
-Ne $NE \
-k $K \
-iter $ITER \
-burnin $BURNIN \
-filt_rules_l 'eur.maf<0.01' \
-o $OUTPUT_FILE \
-o_gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment