Skip to content

21. GWAS

George Pacheco edited this page Aug 4, 2021 · 1 revision

Based on Dataset III, and through the use of gemma--v0.96 we performed _GWAS_s.

Creates a .dosage file:
python ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/PBGP.dosage.py
Gets the relatedness matrixes:
gemma -g ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra.dosage -gk 1 -p ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_HeadCrest.pheno -o PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_HeadCrest -maf 0.01
gemma -g ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra.dosage -gk 1 -p ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_FootFeathering.pheno -o PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_FootFeathering -maf 0.01
Runs Association Tests with Univariate Linear Mixed Models:
gemma -lmm 4 -g ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra.dosage -p ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_HeadCrest.pheno -a ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra.SNPAnnotation -k ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/output/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_HeadCrest.cXX.txt -n 1 -o PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_HeadCrest
gemma -lmm 4 -g ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra.dosage -p ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_FootFeathering.pheno -a ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra.SNPAnnotation -k ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/output/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_FootFeathering.cXX.txt -n 1 -o PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_FootFeatheting
Slightly twicks the output:
cut -f 1,2,3,13 ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/output/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_HeadCrest.assoc.txt | awk '{print $2"\t"$1"\t"$3"\t"$4}' | tail -n +2 | sort -k 4,4 > ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/output/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_HeadCrest.Edited.assoc.txt
cut -f 1,2,3,13 ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/output/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_FootFeatheting.assoc.txt | awk '{print $2"\t"$1"\t"$3"\t"$4}' | tail -n +2 | sort -k 4,4 > ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/output/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_FootFeatheting.Edited.assoc.txt
Permutates with original Gemma (permutation using one Gemma run including all chromosomes and scaffolds):
for B in `seq -w 1 100`
do

gemma -g ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra.dosage -k ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/output/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_HeadCrest.cXX.txt -a ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra.SNPAnnotation -o PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_HeadCrest-BS_${B} -p ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_HeadCrest.Permuted.pheno -n ${B} -lmm 4 -maf 0.01

done
for B in `seq -w 1 100`
do

gemma -g ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra.dosage -k ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/output/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_FootFeathering.cXX.txt -a ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra.SNPAnnotation -o PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_FootFeathering-BS_${B} -p ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_FootFeathering.Permuted.pheno -n ${B} -lmm 4 -maf 0.01

done
Concatenates all the p-values:
for i in PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_HeadCrest-BS_???.assoc.txt
do
    cut -f 1,2,3,13 $i > cut${i%-.assoc.}
done
for i in PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_FootFeathering-BS_???.assoc.txt
do
    cut -f 1,2,3,13 $i > cut${i%-.assoc.}
done
Concatenates (cont.):
cp cutPBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_HeadCrest-BS_001.assoc.txt cutPBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_HeadCrest-BS_ALL.assoc.txt
cat cutPBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_HeadCrest-BS_0{02..09}.assoc.txt | grep -v rs >> cutPBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_HeadCrest-BS_ALL.assoc.txt
cat cutPBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_HeadCrest-BS_0{10..99}.assoc.txt | grep -v rs >> cutPBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_HeadCrest-BS_ALL.assoc.txt
cat cutPBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_HeadCrest-BS_100.assoc.txt | grep -v rs >> cutPBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_HeadCrest-BS_ALL.assoc.txt
cp cutPBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_FootFeathering-BS_001.assoc.txt cutPBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_FootFeathering-BS_ALL.assoc.txt
cat cutPBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_FootFeathering-BS_0{02..09}.assoc.txt | grep -v rs >> cutPBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_FootFeathering-BS_ALL.assoc.txt
cat cutPBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_FootFeathering-BS_0{10..99}.assoc.txt | grep -v rs >> cutPBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_FootFeathering-BS_ALL.assoc.txt
cat cutPBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_FootFeathering-BS_100.assoc.txt | grep -v rs >> cutPBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_FootFeathering-BS_ALL.assoc.txt
Gets scaffolds' names:
cut -f 2 ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/output/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra_HeadCrest.Edited.assoc.txt | uniq -c | awk '{print "\"" $2 "\""}' | echo $(cat -) > PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra.ChrLabels.txt
Create SNPAnnotation File:
cat ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra.beagle | tail -n +2 | awk '{split($1,a,"_"); print $1 "\t" a[3] "\t" a[1] "_" a[2]}' > ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--GWAS/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra.SNPAnnotation
These GWAS results were plotted using the Rscript below:

Clone this wiki locally