-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathseparate_chrs.do
More file actions
30 lines (21 loc) · 805 Bytes
/
Copy pathseparate_chrs.do
File metadata and controls
30 lines (21 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
[ $# -eq 0 ] && { echo "Usage: $0 phenotype include_cohorts.txt METAL_tempfile"; exit 1; }
k=$1 # phenotype
inlist=$2 # text file containing names of all the cohorts - matching the names of the inputfiles that went into METAL
tempFILE=$3 # the verbose output of METAL
mkdir cohort_input_meta_regression
mkdir cohort_input_meta_regression/aligned_${k}
for cohort in `cat $inlist`
do
# creating tempfiles separating out the cohorts
cat $tempFILE | grep $cohort > cohort_input_meta_regression/aligned_${k}/${cohort}_${k}
cd cohort_input_meta_regression/aligned_${k}
mkdir ${cohort}
for j in `seq 1 22` # looping over the chromosomes
do
cat ${cohort}_${k} | grep "# $j:" > ${cohort}/${cohort}_meta_regression_${k}_chr${j}
done
mv ${cohort}_${k} ${cohort}
gzip -f ${cohort}/*
cd -
done