Extract relevant columns from info .dosage files that I made for PGC
fo
for study in brya ftca gsdc mrsc nhrv nhs2 nss1 nss2 onga pts1 psy2 psy3
do
#cat "$study"/infoeur/*.dosage | awk '{if(NR == 1 || ($1 != "CHR" && $6 > 0 && $6 < 1)) print $2,$1,$3,$4,$5,$6,$7}' > "$study".mafinfo
cat "$study"/infoeur/*.dosage | awk '{if(NR == 1 || ($1 != "CHR" && $6 > 0 && $6 < 1)) print $2,$4,$5,$6,$7}' | LC_ALL=C sort -k1b,1 > "$study".mafinfo
done
#Note: Assumes that the SNP is the first column of your gwas results file. If it is not, change "sort k1b,1"
to the column number where the SNP is. e.g. if SNP is in column 2, change to sort k2b,2 gwas_results.assoc.txt
LC_ALL=C join <(LC_ALL=C sort k1b,1 "$study"_gwas_results.assoc.linear) "$study".mafinfo > "$study"_results_withmaf.txt