forked from opain/GenoPred
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Genotype-based_scoring_in_target_samples.Rmd
1317 lines (1073 loc) · 67.6 KB
/
Genotype-based_scoring_in_target_samples.Rmd
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: "Genotype-based scoring in target samples"
output:
html_document:
toc: true
theme: united
toc_depth: 3
number_sections: true
toc_float: true
fig_caption: yes
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
<style>
p.caption {
font-size: 1.5em;
}
</style>
```{css, echo=F}
pre code, pre, code {
white-space: pre !important;
overflow-x: scroll !important;
word-break: keep-all !important;
word-wrap: initial !important;
}
```
***
This page describes calculating reference-standardised genotype-based scores in a target sample. This process requires a number of reference files, which can be made using instructions found [here](https://opain.github.io/GenoPred/Pipeline_prep.html). Here, we will calculate ancestry scores, polygenic scores, and functionally informed polygenic scores. Each of these scores can be used for a number of tasks, such as inferrence of ancestry, estimation of risk, test for genetic covariance between two outcomes, and stratification.
<br/>
***
# Harmonisation with the reference
Before these scores can be calculated, the target samples genetic data must be harmonised with the reference. This process varies depending on the source of the data. Here, I show how the UK biobank and Twins Early Development Study (TEDS) genetic data were harmonised with the reference. Note, both of these samples had been imputed prior to receiving the data.
In all scenarios, I extract SNPs in the HapMap3 SNP-list, convert the data to hard-call PLINK binaries (.bed/.bim/.fam), check whether any SNPs need to be strand flipped, and insert HapMap3 SNPs that are not present into the target data as missing.
I use HapMap3 SNPs only as these are typically available after imputation, enabling comparison of scores from diverse sources. I convert SNPs to hard call with a hard-call threshold of 0, meaning it will take the most likely genotype regardless of the certainty, which speeds subsequent stages of the genotype-based scoring and is unlikely to introduce many errors as these SNPs are typically reliable. I insert HapMap3 SNPs as missing to enable allele frequency imputation while scoring, which ensures scores are comparable between samples with different SNPs available.
## UK Biobank
The code below applies a script called 'Harmonisation_of_UKBB.R' to each chromosome of the UK-Biobank data. See [here](https://github.com/opain/GenoPred/tree/master/Scripts/Harmonisation_of_UKBB) for more information on this script.
<details><summary>See code</summary>
```{bash, echo=T, eval=F}
# Set required variables
. /users/k1806347/brc_scratch/Software/MyGit/GenoPred/config_used/Target_scoring.config
# Process each chromosome of the UK-Biobank data using the Harmonisation_of_UKBB.R script
for chr in $(seq 1 22); do
qsub -l h_vmem=10G /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/Harmonisation_of_UKBB/Harmonisation_of_UKBB.R \
--chr $chr \
--input_dir ${UKBB_original} \
--target_fam ${UKBB_fam} \
--output_dir ${UKBB_output}/Genotype/Harmonised \
--reference_dir ${Geno_1KG_dir} \
--qctool2 ${qctool2} \
--plink ${plink1_9}
done
```
</details>
<br/>
## TEDS
The TEDS data has already undergone pre-imputation QC, HRC imputation, and post-imputation QC. Genotyping was performed using two chips, Affy and OEE. Each Chip was QC'd and imputed seperatly, and then merged retaining the non-overlapping SNPs to maximise the SNP data available for analysis. The data is in plink format. Here we will harmonise the data with the HapMap3 reference.
<details><summary>See code</summary>
```{bash, echo=T, eval=F}
qsub -l h_vmem=20G /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/Harmonisation_of_TEDS/Harmonisation_of_TEDS.R
```
</details>
<br/>
## 23andMe
### Format and impute
Here we will prepare genotype data for Oliver_Pain (Me), using the script 23andMe_imputer.R. This code is very similar to that used by the Impute.Me website created by Lasse Folkersen.
```{bash, eval=F, echo=T}
# Set required variables
. /users/k1806347/brc_scratch/Software/MyGit/GenoPred/config_used/Target_scoring.config
for individual in $(echo Esther_Anon); do
geno_file=$(ls ${geno_23andMe}/${individual})
# Run for one user
qsub -l h_vmem=15G -pe smp 6 /users/k1806347/brc_scratch/Software/Rscript.sh /mnt/lustre/users/k1806347/Software/MyGit/GenoPred/Scripts/23andMe_imputer/23andMe_imputer.R \
--FID ${individual} \
--IID ${individual} \
--geno ${geno_23andMe}/${individual}/${geno_file} \
--plink ${plink1_9} \
--out ${geno_23andMe}/${individual}/${individual} \
--ref ${Impute2_1KG_dir} \
--shapeit ${ShapeIt} \
--impute2 ${Impute2} \
--n_core 6 \
--qctool ${qctool2}
done
#######
# Extract HapMap3 SNPs and insert missing genotypes for subsequent MAF imputation.
#######
. /users/k1806347/brc_scratch/Software/MyGit/GenoPred/config_used/Target_scoring.config
for individual in $(echo Kathy_Pain Esther_Anon James_Pain Sophie_vonStumm); do
qsub -l h_vmem=15G /users/k1806347/brc_scratch/Software/Rscript.sh /mnt/lustre/users/k1806347/Software/MyGit/GenoPred/Scripts/hm3_harmoniser/hm3_harmoniser.R \
--target ${geno_23andMe}/${individual}/${individual}.1KGphase3.chr \
--ref ${Geno_1KG_dir}/1KGPhase3.w_hm3.chr \
--plink ${plink1_9} \
--out ${geno_23andMe}/${individual}/${individual}.1KGphase3.hm3.chr
done
```
***
# Ancestry scoring
In genetic analyses it is important to consider an individual's ancestry as the frequency of alleles vary between populations making comparison across ancestries often invalid. Differences in ancestry can lead to population stratification in genome-wide assocaition studies because the frequency of an outcome may vary between individuals of different ancestries, which will then lead to an association between the outcome and all genetic variants that differ in frequency between ancestral groups. Furthermore, differences in LD between ancestries lead to different patterns of association which influences the predictive utility of polygenic scores across diverse populations.
In this genotype-based scoring pipeline, we estimate factor scores for each individual on the first 100 European specific and 100 all-ancestry principal components (PCs) of populations structure by projecting previously identified PCs in the 1000 Genomes reference (see [here](https://opain.github.io/GenoPred/Pipeline_prep.html#3_ancestry_scoring)). Using the 100 all-ancestry PCs, we estimate which super population individuals belong to. This allows subsquent genotype-based scores to be scaled based on the mean and SD of scores within their ancestral group, improving their interpretability. We also use their inferred ancestry to stratify individuals when building predictive models, to provide population specific models of risk. Furthermore, given that the frequency of outcomes do often vary between ancestral groups, we also derive these estimates of ancestry to be used as predictors of risk.
Given that these PCs are projected and we want them to comparable across target samples, the PCs are derived using a pre-specified subset of LD-independant HapMap3 SNPs. Given that not all SNPs are available in target samples, to avoid bias due to missing data we impute missing SNPs using the MAF from an ancestry match reference population. However, to ensure appriorate ancestry matching, we must first perform PCA using only SNPs that are available in the target sample. Therefore the projected PCs are calculated in two stages:
* Ancestry idenitfication - PCs specific to the target sample are calcualted using available data, and compared to a reference to idenitfy the population each individual fits in. This section uses a script called 'Ancestry_identifier.R'. See more information on the utility of this script [here](https://github.com/opain/GenoPred/tree/master/Scripts/Ancestry_identifier) for more information on this script.
* Project ancestry - PCs are projected from a reference population and are comparable across target samples. Missing genotypes are imputed using the ancestry matched reference MAF. This section uses a script called 'scaled_ancestry_scorer.R'. See more information on the utility of this script [here](https://github.com/opain/GenoPred/tree/master/Scripts/scaled_ancestry_scorer) for more information on this script.
## UK Biobank
<details><summary>See code</summary>
```{bash, echo=T, eval=F}
# Set required variables
. /users/k1806347/brc_scratch/Software/MyGit/GenoPred/config_used/Target_scoring.config
#################
# Idenitfy ancestry of UKBB participants
#################
qsub -l h_vmem=15G /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/Ancestry_identifier/Ancestry_identifier.R \
--target_plink_chr ${UKBB_output}/Genotype/Harmonised/UKBB.w_hm3.QCd.AllSNP.chr \
--ref_plink_chr ${Geno_1KG_dir}/1KGPhase3.w_hm3.chr \
--n_pcs 100 \
--plink ${plink1_9} \
--plink2 ${plink2} \
--output ${UKBB_output}/Projected_PCs/Ancestry_idenitfier/UKBB.w_hm3.AllAncestry \
--ref_pop_scale ${Geno_1KG_dir}/super_pop_keep.list \
--pop_data ${Geno_1KG_dir}/integrated_call_samples_v3.20130502.ALL.panel_small
#################
# Calculate all ancestry PCs of population structure
#################
qsub -l h_vmem=15G /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/scaled_ancestry_scorer/scaled_ancestry_scorer.R \
--target_plink_chr ${UKBB_output}/Genotype/Harmonised/UKBB.w_hm3.QCd.AllSNP.chr \
--target_keep ${UKBB_output}/Projected_PCs/Ancestry_idenitfier/UKBB.w_hm3.AllAncestry.EUR.keep \
--ref_freq_chr ${Geno_1KG_dir}/freq_files/EUR/1KGPhase3.w_hm3.EUR.chr \
--ref_score ${Geno_1KG_dir}/Score_files_for_ancestry/AllAncestry/1KGPhase3.w_hm3.AllAncestry.eigenvec.var \
--ref_eigenvec ${Geno_1KG_dir}/Score_files_for_ancestry/AllAncestry/1KGPhase3.w_hm3.AllAncestry.eigenvec \
--plink2 ${plink2} \
--output ${UKBB_output}/Projected_PCs/EUR/AllAncestry/UKBB.w_hm3.AllAncestry \
--ref_scale ${Geno_1KG_dir}/Score_files_for_ancestry/AllAncestry/1KGPhase3.w_hm3.AllAncestry.EUR.scale \
--pop_data ${Geno_1KG_dir}/integrated_call_samples_v3.20130502.ALL.panel_small
# Old code: Use all ancestry MAF to impute missing genotypes
qsub -l h_vmem=15G /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/scaled_ancestry_scorer/scaled_ancestry_scorer.R \
--target_plink_chr ${UKBB_output}/Genotype/Harmonised/UKBB.w_hm3.QCd.AllSNP.chr \
--ref_freq_chr ${Geno_1KG_dir}/freq_files/AllAncestry/1KGPhase3.w_hm3.AllAncestry.chr \
--ref_score ${Geno_1KG_dir}/Score_files_for_ancestry/AllAncestry/1KGPhase3.w_hm3.AllAncestry.eigenvec.var \
--ref_eigenvec ${Geno_1KG_dir}/Score_files_for_ancestry/AllAncestry/1KGPhase3.w_hm3.AllAncestry.eigenvec \
--plink2 ${plink2} \
--output ${UKBB_output}/Projected_PCs/AllAncestry/UKBB.w_hm3.AllAncestry \
--pop_data ${Geno_1KG_dir}/integrated_call_samples_v3.20130502.ALL.panel_small \
--pop_model ${Geno_1KG_dir}/Score_files_for_ancestry/AllAncestry/1KGPhase3.w_hm3.AllAncestry.pop_enet_model.rds \
--pop_model_scale ${Geno_1KG_dir}/Score_files_for_ancestry/AllAncestry/1KGPhase3.w_hm3.AllAncestry.scale \
--pop_scale_for_keep ${Geno_1KG_dir}/Score_files_for_ancestry/AllAncestry/1KGPhase3.w_hm3.AllAncestry.scalefiles.txt
#################
# Calculate European ancestry PCs of population structure
#################
qsub -l h_vmem=15G /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/scaled_ancestry_scorer/scaled_ancestry_scorer.R \
--target_plink_chr ${UKBB_output}/Genotype/Harmonised/UKBB.w_hm3.QCd.AllSNP.chr \
--target_keep ${UKBB_output}/Projected_PCs/AllAncestry/UKBB.w_hm3.AllAncestry.EUR.keep \
--ref_freq_chr ${Geno_1KG_dir}/freq_files/EUR/1KGPhase3.w_hm3.EUR.chr \
--ref_score ${Geno_1KG_dir}/Score_files_for_ancestry/EUR/1KGPhase3.w_hm3.EUR.eigenvec.var \
--ref_eigenvec ${Geno_1KG_dir}/Score_files_for_ancestry/EUR/1KGPhase3.w_hm3.EUR.eigenvec \
--ref_scale ${Geno_1KG_dir}/Score_files_for_ancestry/EUR/1KGPhase3.w_hm3.EUR.scale \
--plink2 ${plink2} \
--output ${UKBB_output}/Projected_PCs/EUR/UKBB.w_hm3 \
--pop_data ${Geno_1KG_dir}/integrated_call_samples_v3.20130502.ALL.panel_small
```
</details>
<br/>
## TEDS
<details><summary>See code</summary>
```{bash, echo=T, eval=F}
# Set required variables
. /users/k1806347/brc_scratch/Software/MyGit/GenoPred/config_used/Target_scoring.config
#################
# Idenitfy ancestry of TEDS participants
#################
qsub -l h_vmem=15G /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/Ancestry_identifier/Ancestry_identifier.R \
--target_plink_chr ${TEDS_output_dir}/Genotype/Harmonised/TEDS.w_hm3.QCd.AllSNP.chr \
--ref_plink_chr ${Geno_1KG_dir}/1KGPhase3.w_hm3.chr \
--plink ${plink1_9} \
--n_pcs 100 \
--plink2 ${plink2} \
--output ${TEDS_output_dir}/Projected_PCs/Ancestry_idenitfier/TEDS.w_hm3.AllAncestry \
--ref_pop_scale ${Geno_1KG_dir}/super_pop_keep.list \
--pop_data ${Geno_1KG_dir}/integrated_call_samples_v3.20130502.ALL.panel_small
#################
# Calculate all ancestry PCs of population structure for Europeans
#################
qsub -l h_vmem=15G /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/scaled_ancestry_scorer/scaled_ancestry_scorer.R \
--target_plink_chr ${TEDS_output_dir}/Genotype/Harmonised/TEDS.w_hm3.QCd.AllSNP.chr \
--target_keep ${TEDS_output_dir}/Projected_PCs/Ancestry_idenitfier/TEDS.w_hm3.AllAncestry.EUR.keep \
--ref_freq_chr ${Geno_1KG_dir}/freq_files/EUR/1KGPhase3.w_hm3.EUR.chr \
--ref_score ${Geno_1KG_dir}/Score_files_for_ancestry/AllAncestry/1KGPhase3.w_hm3.AllAncestry.eigenvec.var \
--ref_eigenvec ${Geno_1KG_dir}/Score_files_for_ancestry/AllAncestry/1KGPhase3.w_hm3.AllAncestry.eigenvec \
--ref_scale ${Geno_1KG_dir}/Score_files_for_ancestry/AllAncestry/1KGPhase3.w_hm3.AllAncestry.EUR.scale \
--plink2 ${plink2} \
--output ${TEDS_output_dir}/Projected_PCs/EUR/AllAncestry/TEDS.w_hm3.AllAncestry \
--pop_data ${Geno_1KG_dir}/integrated_call_samples_v3.20130502.ALL.panel_small
module add general/R/3.5.0
module add compilers/gcc/8.1.0
module add general/python/2.7.10
R
opt$target_plink_chr<-'/users/k1806347/brc_scratch/Data/TEDS/Genotype/Harmonised/TEDS.w_hm3.QCd.AllSNP.chr'
opt$target_keep<-'/users/k1806347/brc_scratch/Data/TEDS/Projected_PCs/Ancestry_idenitfier/TEDS.w_hm3.AllAncestry.EUR.keep'
opt$ref_freq_chr<-'/users/k1806347/brc_scratch/Data/1KG/Phase3/freq_files/EUR/1KGPhase3.w_hm3.EUR.chr'
opt$ref_score<-'/users/k1806347/brc_scratch/Data/1KG/Phase3/Score_files_for_ancestry/AllAncestry/1KGPhase3.w_hm3.AllAncestry.eigenvec.var'
opt$ref_eigenvec<-'/users/k1806347/brc_scratch/Data/1KG/Phase3/Score_files_for_ancestry/AllAncestry/1KGPhase3.w_hm3.AllAncestry.eigenvec'
opt$ref_scale<-'/users/k1806347/brc_scratch/Data/1KG/Phase3/Score_files_for_ancestry/AllAncestry/1KGPhase3.w_hm3.AllAncestry.EUR.scale'
opt$plink2<-'/users/k1806347/brc_scratch/Software/plink2'
opt$output<-'/users/k1806347/brc_scratch/Data/TEDS/Projected_PCs/EUR/AllAncestry/TEDS.w_hm3.AllAncestry'
opt$pop_data<-'/users/k1806347/brc_scratch/Data/1KG/Phase3/integrated_call_samples_v3.20130502.ALL.panel_small'
#################
# Calculate European ancestry PCs of population structure
#################
qsub -l h_vmem=15G /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/scaled_ancestry_scorer/scaled_ancestry_scorer.R \
--target_plink_chr ${TEDS_output_dir}/Genotype/Harmonised/TEDS.w_hm3.QCd.AllSNP.chr \
--target_keep ${TEDS_output_dir}/Projected_PCs/Ancestry_idenitfier/TEDS.w_hm3.AllAncestry.EUR.keep \
--ref_freq_chr ${Geno_1KG_dir}/freq_files/EUR/1KGPhase3.w_hm3.EUR.chr \
--ref_score ${Geno_1KG_dir}/Score_files_for_ancestry/EUR/1KGPhase3.w_hm3.EUR.eigenvec.var \
--ref_eigenvec ${Geno_1KG_dir}/Score_files_for_ancestry/EUR/1KGPhase3.w_hm3.EUR.eigenvec \
--ref_scale ${Geno_1KG_dir}/Score_files_for_ancestry/EUR/1KGPhase3.w_hm3.EUR.scale \
--plink2 ${plink2} \
--output ${TEDS_output_dir}/Projected_PCs/EUR/EUR_specific/TEDS.w_hm3.EUR \
--pop_data ${Geno_1KG_dir}/integrated_call_samples_v3.20130502.ALL.panel_small
```
</details>
<br/>
## 23andMe
<details><summary>See code</summary>
```{bash, echo=T, eval=F}
# Set required variables
. /users/k1806347/brc_scratch/Software/MyGit/GenoPred/config_used/Target_scoring.config
#################
# Identify ancestry
#################
for individual in $(echo Oliver_Pain); do
sbatch -p brc,shared --mem=10G /users/k1806347/brc_scratch/Software/Rscript_singularity.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/Ancestry_identifier/Ancestry_identifier.R \
--target_plink_chr ${geno_23andMe}/${individual}/${individual}.1KGphase3.hm3.chr \
--ref_plink_chr ${Geno_1KG_dir}/1KGPhase3.w_hm3.chr \
--plink ${plink1_9} \
--n_pcs 100 \
--plink2 ${plink2} \
--output ${geno_23andMe}/${individual}/Projected_PCs/Ancestry_identifier/${individual}.w_hm3.AllAncestry \
--ref_pop_scale ${Geno_1KG_dir}/super_pop_keep.list \
--pop_data ${Geno_1KG_dir}/integrated_call_samples_v3.20130502.ALL.panel_small
done
#################
# Calculate AllAncestry PCs of population structure
#################
for individual in $(echo Kaili_Rimfeld); do
qsub /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/scaled_ancestry_scorer/scaled_ancestry_scorer.R \
--target_plink_chr ${geno_23andMe}/${individual}/${individual}.1KGphase3.hm3.chr \
--ref_freq_chr ${Geno_1KG_dir}/freq_files/EUR/1KGPhase3.w_hm3.EUR.chr \
--ref_score ${Geno_1KG_dir}/Score_files_for_ancestry/AllAncestry/1KGPhase3.w_hm3.AllAncestry.eigenvec.var \
--ref_eigenvec ${Geno_1KG_dir}/Score_files_for_ancestry/AllAncestry/1KGPhase3.w_hm3.AllAncestry.eigenvec \
--ref_scale ${Geno_1KG_dir}/Score_files_for_ancestry/AllAncestry/1KGPhase3.w_hm3.AllAncestry.EUR.scale \
--plink2 ${plink2} \
--output ${geno_23andMe}/${individual}/Projected_PCs/AllAncestry/${individual}.w_hm3.AllAncestry \
--pop_data ${Geno_1KG_dir}/integrated_call_samples_v3.20130502.ALL.panel_small
done
#################
# Calculate European ancestry PCs of population structure
#################
# Use the EUR.keep file from the AllAncestry run above to select people of EUR ancestry.
for individual in $(echo Kaili_Rimfeld); do
qsub /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/scaled_ancestry_scorer/scaled_ancestry_scorer.R \
--target_plink_chr ${geno_23andMe}/${individual}/${individual}.1KGphase3.hm3.chr \
--ref_freq_chr ${Geno_1KG_dir}/freq_files/EUR/1KGPhase3.w_hm3.EUR.chr \
--ref_score ${Geno_1KG_dir}/Score_files_for_ancestry/EUR/1KGPhase3.w_hm3.EUR.eigenvec.var \
--ref_eigenvec ${Geno_1KG_dir}/Score_files_for_ancestry/EUR/1KGPhase3.w_hm3.EUR.eigenvec \
--ref_scale ${Geno_1KG_dir}/Score_files_for_ancestry/EUR/1KGPhase3.w_hm3.EUR.scale \
--plink2 ${plink2} \
--output ${geno_23andMe}/${individual}/Projected_PCs/EUR/${individual}.w_hm3 \
--pop_data ${Geno_1KG_dir}/integrated_call_samples_v3.20130502.ALL.panel_small
done
```
</details>
<br/>
***
# Polygenic scoring
Here we calculate poylgenic scores for a range of outcomes in the target samples based on previously prepared reference scoring files, and scale the polygenic scores based on scores in a reference sample with matched ancestry. For more information on preparing reference files for polygenic scoring, see [here](https://opain.github.io/GenoPred/Pipeline_prep.html#4_polygenic_scoring).
One aim of the GenoPred project is to compare methods for calculating genotype-based scores. Here we compare three approaches for polygenic scoring:
* p-value thresholding and LD-based clumping (pT + clump)
* lassosum
* PRScs
* SBLUP
## pT + clump
This section uses a script called 'Scaled_polygenic_scorer.R'. See more information on the utility of this script [here](https://github.com/opain/GenoPred/tree/master/Scripts/Scaled_polygenic_scorer) for more information on this script.
### UK Biobank
#### Sparse p-value thresholding
We will calculate PRS both without and with control for ancestry PCs,
<details><summary>See code without control of ancestry</summary>
```{bash, echo=T, eval=F}
# Set required variables
. /users/k1806347/brc_scratch/Software/MyGit/GenoPred/config_used/Target_scoring.config
# Create a list of gwas that haven't got corresponding PRS files in UKBB
> ${UKBB_output}/PolygenicScores/EUR/todo.txt
for gwas in $(cut -f 1 -d ' ' ~/brc_scratch/Data/GWAS_sumstats/Largest_GWAS_over15K_withoutUKBB.txt);do
if [ ! -f ${UKBB_output}/PolygenicScores/EUR/${gwas}/UKBB.w_hm3.${gwas}.EUR.profiles ]; then
echo $gwas >> ${UKBB_output}/PolygenicScores/EUR/todo.txt
fi
done
# Calculate polygenic scores for for Europeans only for now.
n=0
for gwas in $(cat ${UKBB_output}/PolygenicScores/EUR/todo.txt);do
qsub -N $(echo PRS_job$(($n+10))) -hold_jid $(echo PRS_job$(($n+0))) /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/Scaled_polygenic_scorer/Scaled_polygenic_scorer.R \
--target_plink_chr ${UKBB_output}/Genotype/Harmonised/UKBB.w_hm3.QCd.AllSNP.chr \
--target_keep ${UKBB_output}/Projected_PCs/AllAncestry/UKBB.w_hm3.AllAncestry.EUR.keep \
--ref_score ${Geno_1KG_dir}/Score_files_for_poylygenic/${gwas}/1KGPhase3.w_hm3.${gwas} \
--ref_scale ${Geno_1KG_dir}/Score_files_for_poylygenic/${gwas}/1KGPhase3.w_hm3.${gwas}.EUR.scale \
--ref_freq_chr ${Geno_1KG_dir}/freq_files/EUR/1KGPhase3.w_hm3.EUR.chr \
--plink ${plink1_9} \
--pheno_name ${gwas} \
--output ${UKBB_output}/PolygenicScores/EUR/${gwas}/UKBB.w_hm3.${gwas}.EUR
n=$(($n+1))
done
```
</details>
<details><summary>See code with control of ancestry</summary>
```{bash, echo=T, eval=F}
# Set required variables
. /users/k1806347/brc_scratch/Software/MyGit/GenoPred/config_used/Target_scoring.config
# Create a files containing all EUR and AllAncestry PCs
module add general/R/3.5.0
R
library(data.table)
EUR<-fread('/users/k1806347/brc_scratch/Data/UKBB/Projected_PCs/EUR/UKBB.w_hm3.EUR.eigenvec')
names(EUR)[-1:-2]<-paste0('EUR_',names(EUR)[-1:-2])
All<-fread('/users/k1806347/brc_scratch/Data/UKBB/Projected_PCs/EUR/AllAncestry/UKBB.w_hm3.AllAncestry.EUR.eigenvec')
names(All)[-1:-2]<-paste0('AllAncestry_',names(All)[-1:-2])
PCs<-merge(EUR,All,by=c('FID','IID'))
write.table(PCs,'/users/k1806347/brc_scratch/Data/UKBB/Projected_PCs/UKBB.AllAncestry_EUR_PCs.EUR.eigenvec', col.names=T, row.names=F, quote=F)
q()
n
# Create a list of gwas that haven't got corresponding PRS files in UKBB
> ${UKBB_output}/PolygenicScores/EUR/todo.txt
for gwas in $(echo DEPR06 COLL01 HEIG03 BODY03 DIAB05 COAD01);do
if [ ! -f ${UKBB_output}/PolygenicScores/EUR/${gwas}/UKBB.w_hm3.${gwas}.EUR.PCadjusted.profiles ]; then
echo $gwas >> ${UKBB_output}/PolygenicScores/EUR/todo.txt
fi
done
# Calculate polygenic scores for for Europeans only for now.
n=0
for gwas in $(cat ${UKBB_output}/PolygenicScores/EUR/todo.txt);do
qsub -N $(echo PRS_job$(($n+10))) -hold_jid $(echo PRS_job$(($n+0))) /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/Scaled_polygenic_scorer/Scaled_polygenic_scorer.R \
--target_plink_chr ${UKBB_output}/Genotype/Harmonised/UKBB.w_hm3.QCd.AllSNP.chr \
--target_keep ${UKBB_output}/Projected_PCs/AllAncestry/UKBB.w_hm3.AllAncestry.EUR.keep \
--target_covar ${UKBB_output}/Projected_PCs/UKBB.AllAncestry_EUR_PCs.EUR.eigenvec \
--ref_score ${Geno_1KG_dir}/Score_files_for_poylygenic/${gwas}/1KGPhase3.w_hm3.EUR_PC_resid.${gwas} \
--ref_scale ${Geno_1KG_dir}/Score_files_for_poylygenic/${gwas}/1KGPhase3.w_hm3.EUR_PC_resid.${gwas}.EUR.scale \
--covar_model ${Geno_1KG_dir}/Score_files_for_poylygenic/${gwas}/1KGPhase3.w_hm3.EUR_PC_resid.${gwas}.models.rds \
--ref_freq_chr ${Geno_1KG_dir}/freq_files/EUR/1KGPhase3.w_hm3.EUR.chr \
--plink ${plink1_9} \
--pheno_name ${gwas} \
--output ${UKBB_output}/PolygenicScores/EUR/${gwas}/UKBB.w_hm3.${gwas}.EUR.PCadjusted
n=$(($n+1))
done
module add general/R/3.5.0
module add compilers/gcc/8.1.0
module add general/python/2.7.10
R
opt$target_plink_chr<-'/users/k1806347/brc_scratch/Data/UKBB/Genotype/Harmonised/UKBB.w_hm3.QCd.AllSNP.chr'
opt$target_keep<-'/users/k1806347/brc_scratch/Data/UKBB/Projected_PCs/AllAncestry/UKBB.w_hm3.AllAncestry.EUR.keep'
opt$target_covar<-'/users/k1806347/brc_scratch/Data/UKBB/Projected_PCs/UKBB.AllAncestry_EUR_PCs.EUR.eigenvec'
opt$ref_score<-'/users/k1806347/brc_scratch/Data/1KG/Phase3/Score_files_for_poylygenic/DEPR06/1KGPhase3.w_hm3.EUR_PC_resid.DEPR06'
opt$ref_scale<-'/users/k1806347/brc_scratch/Data/1KG/Phase3/Score_files_for_poylygenic/DEPR06/1KGPhase3.w_hm3.EUR_PC_resid.DEPR06.EUR.scale'
opt$ref_freq_chr<-'/users/k1806347/brc_scratch/Data/1KG/Phase3/freq_files/EUR/1KGPhase3.w_hm3.EUR.chr'
opt$covar_model<-'/users/k1806347/brc_scratch/Data/1KG/Phase3/Score_files_for_poylygenic/DEPR06/1KGPhase3.w_hm3.EUR_PC_resid.DEPR06.models.rds'
opt$plink<-'/users/k1806347/brc_scratch/Software/plink1.9.sh'
opt$pheno_name<-'DEPR06'
opt$output<-'/users/k1806347/brc_scratch/Data/UKBB/PolygenicScores/EUR/DEPR06/UKBB.w_hm3.DEPR06.EUR.PCadjusted'
gwas=EDUC03
qsub /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/Scaled_polygenic_scorer/Scaled_polygenic_scorer.R \
--target_plink_chr ${Geno_1KG_dir}/1KGPhase3.w_hm3.chr \
--target_keep ${Geno_1KG_dir}/keep_files/EUR_samples.keep \
--target_covar ${Geno_1KG_dir}/Score_files_for_ancestry/AllAncestry_EUR_PCs.EUR.EUR_scaled.eigenvec \
--ref_score ${Geno_1KG_dir}/Score_files_for_poylygenic/${gwas}/1KGPhase3.w_hm3.EUR_PC_resid.${gwas} \
--ref_scale ${Geno_1KG_dir}/Score_files_for_poylygenic/${gwas}/1KGPhase3.w_hm3.EUR_PC_resid.${gwas}.EUR.scale \
--covar_model ${Geno_1KG_dir}/Score_files_for_poylygenic/${gwas}/1KGPhase3.w_hm3.EUR_PC_resid.${gwas}.models.rds \
--ref_freq_chr ${Geno_1KG_dir}/freq_files/EUR/1KGPhase3.w_hm3.EUR.chr \
--plink ${plink1_9} \
--pheno_name ${gwas} \
--output ${UKBB_output}/PolygenicScores/EUR/${gwas}/1KG.w_hm3.${gwas}.EUR.PCadjusted
module add general/R/3.5.0
R
library(data.table)
score<-fread('/users/k1806347/brc_scratch/Data/UKBB/Projected_PCs/UKBB.AllAncestry_EUR_PCs.EUR.eigenvec')
--ref_plink_chr ${Geno_1KG_dir}/1KGPhase3.w_hm3.chr \
--ref_keep ${Geno_1KG_dir}/keep_files/EUR_samples.keep \
--sumstats ${gwas_rep}/${gwas}.sumstats.gz \
--plink ${plink1_9} \
--memory 3000 \
--covar ${Geno_1KG_dir}/Score_files_for_ancestry/AllAncestry_EUR_PCs.EUR.eigenvec \
--output ${Geno_1KG_dir}/Score_files_for_poylygenic/${gwas}/1KGPhase3.w_hm3.EUR_PC_resid.${gwas} \
--ref_pop_scale ${Geno_1KG_dir}/super_pop_keep.list
```
</details>
<br/>
#### Dense p-value thresholding
<details><summary>See code</summary>
```{bash, echo=T, eval=F}
# Set required variables
. /users/k1806347/brc_scratch/Software/MyGit/GenoPred/config_used/Target_scoring.config
###
# Split the EUR UKBB individuals into 10K batches
###
# Temporary files would require a large amount of storage for all UKBB individuals
# Splitting the data into batches avoids this issue
mkdir /users/k1806347/brc_scratch/Data/UKBB/PolygenicScores_dense
split -l 10000 -d ${UKBB_output}/Projected_PCs/AllAncestry/UKBB.w_hm3.AllAncestry.EUR.keep ${UKBB_output}/PolygenicScores_dense/UKBB.w_hm3.AllAncestry.EUR.keep.Batch_
# Calculate polygenic scores for for Europeans only for now.
n=0
for gwas in $(echo DEPR06 COLL01 HEIG03 BODY03 DIAB05 COAD01);do
for batch in $(ls ${UKBB_output}/PolygenicScores_dense/UKBB.w_hm3.AllAncestry.EUR.keep.Batch_* | cut -d. -f6-);do
qsub -N $(echo PRS_job$(($n+100))) -hold_jid $(echo PRS_job$(($n+0))) /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/Scaled_polygenic_scorer/Scaled_polygenic_scorer.R \
--target_plink_chr ${UKBB_output}/Genotype/Harmonised/UKBB.w_hm3.QCd.AllSNP.chr \
--target_keep ${UKBB_output}/PolygenicScores_dense/UKBB.w_hm3.AllAncestry.EUR.keep.${batch} \
--ref_score ${Geno_1KG_dir}/Score_files_for_poylygenic_dense/${gwas}/1KGPhase3.w_hm3.${gwas} \
--ref_scale ${Geno_1KG_dir}/Score_files_for_poylygenic_dense/${gwas}/1KGPhase3.w_hm3.${gwas}.EUR.scale \
--ref_freq_chr ${Geno_1KG_dir}/freq_files/EUR/1KGPhase3.w_hm3.EUR.chr \
--plink ${plink1_9} \
--pheno_name ${gwas} \
--output ${UKBB_output}/PolygenicScores_dense/EUR/${gwas}/${batch}/UKBB.w_hm3.${gwas}.EUR.${batch}
n=$(($n+1))
done
done
# Check all the batches finished correctly There should be 46 files
for gwas in $(echo DEPR06 COLL01 HEIG03 BODY03 DIAB05 COAD01);do
ls ${UKBB_output}/PolygenicScores_dense/EUR/${gwas}/*/UKBB.w_hm3.${gwas}.EUR.*.profiles | wc -l
done
# Combine the batches into a single file
for gwas in $(echo DEPR06 COLL01 HEIG03 BODY03 DIAB05 COAD01);do
head -1 ${UKBB_output}/PolygenicScores_dense/EUR/${gwas}/Batch_00/UKBB.w_hm3.${gwas}.EUR.Batch_00.profiles > ${UKBB_output}/PolygenicScores_dense/EUR/${gwas}/UKBB.w_hm3.${gwas}.EUR.profiles
tail -n +2 -q ${UKBB_output}/PolygenicScores_dense/EUR/${gwas}/*/UKBB.w_hm3.${gwas}.EUR.*.profiles >> ${UKBB_output}/PolygenicScores_dense/EUR/${gwas}/UKBB.w_hm3.${gwas}.EUR.profiles
done
# Delete per batch files and move log files into a single folder
for gwas in $(echo DEPR06 COLL01 HEIG03 BODY03 DIAB05 COAD01);do
mkdir ${UKBB_output}/PolygenicScores_dense/EUR/${gwas}/log_files
mv ${UKBB_output}/PolygenicScores_dense/EUR/${gwas}/*/UKBB.w_hm3.${gwas}.EUR.*.log ${UKBB_output}/PolygenicScores_dense/EUR/${gwas}/log_files/
rm -r ${UKBB_output}/PolygenicScores_dense/EUR/${gwas}/Batch_*
done
```
</details>
<br/>
### TEDS
#### Sparse p-value thresholding
<details><summary>See code</summary>
```{bash, echo=T, eval=F}
# Set required variables
. /users/k1806347/brc_scratch/Software/MyGit/GenoPred/config_used/Target_scoring.config
mkdir -p ${TEDS_output_dir}/PolygenicScores/EUR
# Create a list of gwas that haven't got corresponding PRS files in TEDS
> ${TEDS_output_dir}/PolygenicScores/EUR/todo.txt
for gwas in $(cut -f 1 -d ' ' ~/brc_scratch/Data/GWAS_sumstats/Largest_GWAS_over15K_withoutTEDS.txt);do
if [ ! -f ${TEDS_output_dir}/PolygenicScores/EUR/${gwas}/TEDS.w_hm3.${gwas}.EUR.profiles ]; then
echo $gwas >> ${TEDS_output_dir}/PolygenicScores/EUR/todo.txt
fi
done
# Calculate polygenic scores for for Europeans only for now.
n=0
for gwas in $(cat ${TEDS_output_dir}/PolygenicScores/EUR/todo.txt);do
qsub -N $(echo PRS_job$(($n+50))) -hold_jid $(echo PRS_job$(($n+0))) /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/Scaled_polygenic_scorer/Scaled_polygenic_scorer.R \
--target_plink_chr ${TEDS_output_dir}/Genotype/Harmonised/TEDS.w_hm3.QCd.AllSNP.chr \
--target_keep ${TEDS_output_dir}/Projected_PCs/Ancestry_idenitfier/TEDS.w_hm3.AllAncestry.EUR.keep \
--ref_score ${Geno_1KG_dir}/Score_files_for_poylygenic/${gwas}/1KGPhase3.w_hm3.${gwas} \
--ref_scale ${Geno_1KG_dir}/Score_files_for_poylygenic/${gwas}/1KGPhase3.w_hm3.${gwas}.EUR.scale \
--ref_freq_chr ${Geno_1KG_dir}/freq_files/EUR/1KGPhase3.w_hm3.EUR.chr \
--plink ${plink1_9} \
--pheno_name ${gwas} \
--output ${TEDS_output_dir}/PolygenicScores/EUR/${gwas}/TEDS.w_hm3.${gwas}.EUR
n=$(($n+1))
done
```
</details>
<br/>
#### Dense p-value thresholding
<details><summary>See code</summary>
```{bash, echo=T, eval=F}
# Set required variables
. /users/k1806347/brc_scratch/Software/MyGit/GenoPred/config_used/Target_scoring.config
###
# Split the EUR TEDS individuals into 10K batches
###
# Temporary files would require a large amount of storage for all TEDS individuals
# Splitting the data into batches avoids this issue
mkdir /users/k1806347/brc_scratch/Data/TEDS/PolygenicScores_dense
split -l 1000 -d ${TEDS_output_dir}/Projected_PCs/Ancestry_idenitfier/TEDS.w_hm3.AllAncestry.EUR.keep ${TEDS_output_dir}/PolygenicScores_dense/TEDS.w_hm3.AllAncestry.EUR.keep.Batch_
# Calculate polygenic scores for for Europeans only for now.
n=0
for gwas in $(echo HEIG03 EDUC03 ADHD04 BODY11);do
for batch in $(ls ${TEDS_output_dir}/PolygenicScores_dense/TEDS.w_hm3.AllAncestry.EUR.keep.Batch_* | cut -d. -f6-);do
qsub -N $(echo PRS_job$(($n+50))) -hold_jid $(echo PRS_job$(($n+0))) /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/Scaled_polygenic_scorer/Scaled_polygenic_scorer.R \
--target_plink_chr ${TEDS_output_dir}/Genotype/Harmonised/TEDS.w_hm3.QCd.AllSNP.chr \
--target_keep ${TEDS_output_dir}/PolygenicScores_dense/TEDS.w_hm3.AllAncestry.EUR.keep.${batch} \
--ref_score ${Geno_1KG_dir}/Score_files_for_poylygenic_dense/${gwas}/1KGPhase3.w_hm3.${gwas} \
--ref_scale ${Geno_1KG_dir}/Score_files_for_poylygenic_dense/${gwas}/1KGPhase3.w_hm3.${gwas}.EUR.scale \
--ref_freq_chr ${Geno_1KG_dir}/freq_files/EUR/1KGPhase3.w_hm3.EUR.chr \
--plink ${plink1_9} \
--pheno_name ${gwas} \
--output ${TEDS_output_dir}/PolygenicScores_dense/EUR/${gwas}/${batch}/TEDS.w_hm3.${gwas}.EUR.${batch}
n=$(($n+1))
done
done
# Check all the batches finished correctly There should be 11 files
for gwas in $(echo HEIG03 EDUC03 ADHD04 BODY11);do
ls ${TEDS_output_dir}/PolygenicScores_dense/EUR/${gwas}/*/TEDS.w_hm3.${gwas}.EUR.*.profiles | wc -l
done
# Combine the batches into a single file
for gwas in $(echo HEIG03 EDUC03 ADHD04 BODY11);do
head -1 ${TEDS_output_dir}/PolygenicScores_dense/EUR/${gwas}/Batch_00/TEDS.w_hm3.${gwas}.EUR.Batch_00.profiles > ${TEDS_output_dir}/PolygenicScores_dense/EUR/${gwas}/TEDS.w_hm3.${gwas}.EUR.profiles
tail -n +2 -q ${TEDS_output_dir}/PolygenicScores_dense/EUR/${gwas}/*/TEDS.w_hm3.${gwas}.EUR.*.profiles >> ${TEDS_output_dir}/PolygenicScores_dense/EUR/${gwas}/TEDS.w_hm3.${gwas}.EUR.profiles
done
# Delete per batch files and move log files into a single folder
for gwas in $(echo EDUC03 ADHD04 BODY11);do
mkdir ${TEDS_output_dir}/PolygenicScores_dense/EUR/${gwas}/log_files
mv ${TEDS_output_dir}/PolygenicScores_dense/EUR/${gwas}/*/TEDS.w_hm3.${gwas}.EUR.*.log ${TEDS_output_dir}/PolygenicScores_dense/EUR/${gwas}/log_files/
rm -r ${TEDS_output_dir}/PolygenicScores_dense/EUR/${gwas}/Batch_*
done
```
</details>
<br/>
### 23andMe
<details><summary>See code</summary>
```{bash, echo=T, eval=F}
# Set required variables
. /users/k1806347/brc_scratch/Software/MyGit/GenoPred/config_used/Target_scoring.config
n=0
for individual in $(echo Robert_Plomin Esther_Anon Sophie_vonStumm); do
mkdir -p ${geno_23andMe}/${individual}/PolygenicScores/EUR
# Create a list of gwas that haven't got corresponding PRS files
> ${geno_23andMe}/${individual}/PolygenicScores/EUR/todo.txt
for gwas in $(ls ${Geno_1KG_dir}/Score_files_for_poylygenic/ | sed '/todo.txt/d');do
if [ ! -f ${geno_23andMe}/${individual}/PolygenicScores/EUR/${gwas}/${individual}.w_hm3.${gwas}.EUR.profiles ]; then
echo $gwas >> ${geno_23andMe}/${individual}/PolygenicScores/EUR/todo.txt
fi
done
# Calculate polygenic scores for for Europeans only for now.
for gwas in $(cat ${geno_23andMe}/${individual}/PolygenicScores/EUR/todo.txt);do
qsub -N $(echo PRS_job$(($n+10))) -hold_jid $(echo PRS_job$(($n+0))) /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/Scaled_polygenic_scorer/Scaled_polygenic_scorer.R \
--target_plink_chr ${geno_23andMe}/${individual}/${individual}.1KGphase3.hm3.chr \
--ref_score ${Geno_1KG_dir}/Score_files_for_poylygenic/${gwas}/1KGPhase3.w_hm3.${gwas} \
--ref_scale ${Geno_1KG_dir}/Score_files_for_poylygenic/${gwas}/1KGPhase3.w_hm3.${gwas}.EUR.scale \
--ref_freq_chr ${Geno_1KG_dir}/freq_files/EUR/1KGPhase3.w_hm3.EUR.chr \
--plink ${plink1_9} \
--pheno_name ${gwas} \
--output ${geno_23andMe}/${individual}/PolygenicScores/EUR/${gwas}/${individual}.w_hm3.${gwas}.EUR
n=$(($n+1))
done
done
###
# Calculate PRS adjusted for PCs
###
# Set required variables
. /users/k1806347/brc_scratch/Software/MyGit/GenoPred/config_used/Target_scoring.config
# Create a files containing all EUR and AllAncestry PCs for EUR individuals in the reference
module add general/R/3.5.0
R
library(data.table)
geno_23andMe<-'/users/k1806347/brc_scratch/Data/23andMe'
for(i in c('Oliver_Pain','Kaili_Rimfeld')){
EUR<-fread(paste0(geno_23andMe,'/',i,'/Projected_PCs/EUR/',i,'.w_hm3.EUR.eigenvec'))
names(EUR)[-1:-2]<-paste0('EUR_',names(EUR)[-1:-2])
All<-fread(paste0(geno_23andMe,'/',i,'/Projected_PCs/AllAncestry/',i,'.w_hm3.AllAncestry.EUR.eigenvec'))
names(All)[-1:-2]<-paste0('AllAncestry_',names(All)[-1:-2])
PCs<-merge(EUR,All,by=c('FID','IID'))
write.table(PCs,paste0(geno_23andMe,'/',i,'/Projected_PCs/',i,'.AllAncestry_EUR_PCs.EUR.eigenvec'), col.names=T, row.names=F, quote=F)
}
q()
n
for individual in $(echo Oliver_Pain Kaili_Rimfeld); do
for gwas in $(echo EDUC03 HEIG03 BODY11); do
qsub /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/Scaled_polygenic_scorer/Scaled_polygenic_scorer.R \
--target_plink_chr ${geno_23andMe}/${individual}/${individual}.1KGphase3.hm3.chr \
--target_covar ${geno_23andMe}/${individual}/Projected_PCs/${individual}.AllAncestry_EUR_PCs.EUR.eigenvec \
--ref_score ${Geno_1KG_dir}/Score_files_for_poylygenic/${gwas}/1KGPhase3.w_hm3.EUR_PC_resid.${gwas} \
--ref_scale ${Geno_1KG_dir}/Score_files_for_poylygenic/${gwas}/1KGPhase3.w_hm3.EUR_PC_resid.${gwas}.EUR.scale \
--ref_freq_chr ${Geno_1KG_dir}/freq_files/EUR/1KGPhase3.w_hm3.EUR.chr \
--covar_model ${Geno_1KG_dir}/Score_files_for_poylygenic/${gwas}/1KGPhase3.w_hm3.EUR_PC_resid.${gwas}.models.rds \
--plink ${plink1_9} \
--pheno_name ${gwas} \
--output ${geno_23andMe}/${individual}/PolygenicScores/EUR/${gwas}/${individual}.w_hm3.${gwas}.EUR.PCadjusted
done
done
module add general/R/3.5.0
module add compilers/gcc/8.1.0
module add general/python/2.7.10
R
opt$target_plink_chr<-'/users/k1806347/brc_scratch/Data/23andMe/Oliver_Pain/Oliver_Pain.1KGphase3.hm3.chr'
opt$target_covar<-'/users/k1806347/brc_scratch/Data/23andMe/Oliver_Pain/Projected_PCs/Oliver_Pain.AllAncestry_EUR_PCs.EUR.eigenvec'
opt$ref_score<-'/users/k1806347/brc_scratch/Data/1KG/Phase3/Score_files_for_poylygenic/EDUC03/1KGPhase3.w_hm3.EUR_PC_resid.EDUC03'
opt$ref_scale<-'/users/k1806347/brc_scratch/Data/1KG/Phase3/Score_files_for_poylygenic/EDUC03/1KGPhase3.w_hm3.EUR_PC_resid.EDUC03.EUR.scale'
opt$ref_freq_chr<-'/users/k1806347/brc_scratch/Data/1KG/Phase3/freq_files/EUR/1KGPhase3.w_hm3.EUR.chr'
opt$covar_model<-'/users/k1806347/brc_scratch/Data/1KG/Phase3/Score_files_for_poylygenic/EDUC03/1KGPhase3.w_hm3.EUR_PC_resid.EDUC03.models.rds'
opt$plink<-'/users/k1806347/brc_scratch/Software/plink1.9.sh'
opt$pheno_name<-'EDUC03'
opt$output<-'/users/k1806347/brc_scratch/Data/23andMe/Oliver_Pain/PolygenicScores/EUR/EDUC03/Oliver_Pain.w_hm3.EDUC03.EUR.PCadjusted'
```
</details>
<br/>
***
## lassosum
This section uses a script called 'Scaled_polygenic_scorer_lassosum.R'. See more information on the utility of this script [here](https://github.com/opain/GenoPred/tree/master/Scripts/Scaled_polygenic_scorer_lassosum) for more information on this script.
### UK Biobank
<details><summary>See code</summary>
```{bash, echo=T, eval=F}
# Set required variables
. /users/k1806347/brc_scratch/Software/MyGit/GenoPred/config_used/Target_scoring.config
# Here we only calculate scores relevent to the phenotyps that we will use for comparing methods
for gwas in $(echo DEPR06);do
sbatch -n 10 --mem 5G -p brc,shared /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/Scaled_polygenic_scorer_lassosum/Scaled_polygenic_scorer_lassosum.R \
--target_plink_chr ${UKBB_output}/Genotype/Harmonised/UKBB.w_hm3.QCd.AllSNP.chr \
--target_keep ${UKBB_output}/Projected_PCs/AllAncestry/UKBB.w_hm3.AllAncestry.EUR.keep \
--ref_score ${Geno_1KG_dir}/Score_files_for_poylygenic_lassosum/${gwas}/1KGPhase3.w_hm3.${gwas} \
--ref_scale ${Geno_1KG_dir}/Score_files_for_poylygenic_lassosum/${gwas}/1KGPhase3.w_hm3.${gwas}.EUR.scale \
--ref_freq_chr ${Geno_1KG_dir}/freq_files/EUR/1KGPhase3.w_hm3.EUR.chr \
--plink ${plink1_9} \
--pheno_name ${gwas} \
--n_cores 10 \
--output ${UKBB_output}/PolygenicScores_lassosum/EUR/${gwas}/UKBB.w_hm3.${gwas}.EUR
done
module add apps/R/3.6.0
opt$target_plink_chr<-'/users/k1806347/brc_scratch/Data/UKBB/Genotype/mini_test/UKBB.w_hm3.QCd.AllSNP.mini_test.chr'
opt$target_keep<-'/users/k1806347/brc_scratch/Data/UKBB/Projected_PCs/AllAncestry/UKBB.w_hm3.AllAncestry.EUR.keep'
opt$ref_score<-'/users/k1806347/brc_scratch/Data/1KG/Phase3/Score_files_for_poylygenic_lassosum/DEPR06/1KGPhase3.w_hm3.DEPR06'
opt$ref_scale<-'/users/k1806347/brc_scratch/Data/1KG/Phase3/Score_files_for_poylygenic_lassosum/DEPR06/1KGPhase3.w_hm3.DEPR06.EUR.scale'
opt$ref_freq_chr<-'/users/k1806347/brc_scratch/Data/1KG/Phase3/freq_files/EUR/1KGPhase3.w_hm3.EUR.chr'
opt$plink<-'/users/k1806347/brc_scratch/Software/plink1.9/plink'
opt$pheno_name<-'DEPR06'
opt$n_cores<-2
opt$output<-'/users/k1806347/brc_scratch/Data/UKBB/PolygenicScores_lassosum/EUR/DEPR06/UKBB.w_hm3.DEPR06.EUR'
```
</details>
<br/>
### TEDS
<details><summary>See code</summary>
```{bash, echo=T, eval=F}
# Set required variables
. /users/k1806347/brc_scratch/Software/MyGit/GenoPred/config_used/Target_scoring.config
# Here we only calculate scores relevent to the phenotyps that we will use for comparing methods
n=0
for gwas in $(echo HEIG03 EDUC03 ADHD04 BODY11);do
qsub -N $(echo PRS_job$(($n+10))) -hold_jid $(echo PRS_job$(($n+0))) -pe smp 6 -l h_vmem=10G /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/Scaled_polygenic_scorer_lassosum/Scaled_polygenic_scorer_lassosum.R \
--target_plink_chr /users/k1806347/brc_scratch/Data/TEDS/Genotype/Harmonised/TEDS.w_hm3.QCd.AllSNP.chr \
--target_keep /users/k1806347/brc_scratch/Data/TEDS/Projected_PCs/Ancestry_idenitfier/TEDS.w_hm3.AllAncestry.EUR.keep \
--ref_model ${Geno_1KG_dir}/Score_files_for_poylygenic_lassosum/${gwas}/1KGPhase3.w_hm3.${gwas}.unvalidated.model.RDS \
--ref_scale ${Geno_1KG_dir}/Score_files_for_poylygenic_lassosum/${gwas}/1KGPhase3.w_hm3.${gwas}.EUR.scale \
--pheno_name ${gwas} \
--n_cores 6 \
--output /users/k1806347/brc_scratch/Data/TEDS/PolygenicScores_lassosum/EUR/${gwas}/TEDS.w_hm3.${gwas}.EUR
n=$(($n+1))
done
```
</details>
<br/>
### 23andMe
<details><summary>See code</summary>
```{bash, echo=T, eval=F}
# Set required variables
. /users/k1806347/brc_scratch/Software/MyGit/GenoPred/config_used/Target_scoring.config
for individual in $(echo Kaili_Rimfeld); do
# Here we only calculate scores relevent to the phenotyps that we will use for comparing methods
n=0
for gwas in $(echo DEPR06 COLL01 HEIG03 BODY03);do
qsub -N $(echo PRS_job$(($n+10))) -hold_jid $(echo PRS_job$(($n+0))) -pe smp 1 -l h_vmem=5G /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/Scaled_polygenic_scorer_lassosum/Scaled_polygenic_scorer_lassosum.R \
--target_plink_chr ${geno_23andMe}/${individual}/${individual}.1KGphase3.hm3.chr \
--target_keep ${geno_23andMe}/${individual}/Projected_PCs/AllAncestry/${individual}.w_hm3.AllAncestry.model_pred.EUR.keep \
--ref_model ${Geno_1KG_dir}/Score_files_for_poylygenic_lassosum/${gwas}/1KGPhase3.w_hm3.${gwas}.unvalidated.model.RDS \
--ref_scale ${Geno_1KG_dir}/Score_files_for_poylygenic_lassosum/${gwas}/1KGPhase3.w_hm3.${gwas}.EUR.scale \
--pheno_name ${gwas} \
--n_cores 1 \
--output ${geno_23andMe}/${individual}/PolygenicScores_lassosum/EUR/${gwas}/${individual}.w_hm3.${gwas}.EUR
n=$(($n+1))
done
done
module add general/R/3.5.0
module add compilers/gcc/8.1.0
module add general/python/2.7.10
R
opt$target_plink_chr<-'/users/k1806347/brc_scratch/Data/23andMe/Kaili_Rimfeld/Kaili_Rimfeld.1KGphase3.hm3.chr'
opt$target_keep<-'/users/k1806347/brc_scratch/Data/23andMe/Kaili_Rimfeld/Projected_PCs/AllAncestry/Kaili_Rimfeld.w_hm3.AllAncestry.model_pred.EUR.keep'
opt$ref_model<-'/users/k1806347/brc_scratch/Data/1KG/Phase3/Score_files_for_poylygenic_lassosum/DEPR06/1KGPhase3.w_hm3.DEPR06.unvalidated.model.RDS'
opt$ref_scale<-'/users/k1806347/brc_scratch/Data/1KG/Phase3/Score_files_for_poylygenic_lassosum/DEPR06/1KGPhase3.w_hm3.DEPR06.EUR.scale'
opt$pheno_name<-'DEPR06'
opt$n_cores<-1
opt$output<-'/users/k1806347/brc_scratch/Data/23andMe/Kaili_Rimfeld/PolygenicScores_lassosum/EUR/DEPR06/Kaili_Rimfeld.w_hm3.DEPR06.EUR'
# Note. lassosum scoring failed with one individual.
```
</details>
<br/>
## PRScs
This section uses a script called 'Scaled_polygenic_scorer_PRScs.R'. See more information on the utility of this script [here](https://github.com/opain/GenoPred/tree/master/Scripts/Scaled_polygenic_scorer_PRScs) for more information on this script.
### UK Biobank
<details><summary>See code</summary>
```{bash, echo=T, eval=F}
# Set required variables
. /users/k1806347/brc_scratch/Software/MyGit/GenoPred/config_used/Target_scoring.config
# Create a list of gwas that haven't got corresponding PRS files in UKBB
> ${UKBB_output}/PolygenicScores/EUR/todo_PRScs.txt
#for gwas in $(cut -f 1 -d ' ' ~/brc_scratch/Data/GWAS_sumstats/Largest_GWAS_over15K_withoutUKBB.txt);do
for gwas in $(echo DEPR06 COLL01 HEIG03 BODY03 DIAB05 COAD01 CROH01 SCLE02 RHEU01);do
if [ ! -f ${UKBB_output}/PolygenicScores_PRScs/EUR/${gwas}/UKBB.w_hm3.${gwas}.EUR.PRScs_profiles ]; then
echo $gwas >> ${UKBB_output}/PolygenicScores/EUR/todo_PRScs.txt
fi
done
n=0
for gwas in $(cat ${UKBB_output}/PolygenicScores/EUR/todo_PRScs.txt);do
qsub -N $(echo PRScs_job$(($n+25))) -hold_jid $(echo PRScs_job$(($n+0))) /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/Scaled_polygenic_scorer_PRScs/Scaled_polygenic_scorer_PRScs.R \
--target_plink_chr ${UKBB_output}/Genotype/Harmonised/UKBB.w_hm3.QCd.AllSNP.chr \
--target_keep ${UKBB_output}/Projected_PCs/AllAncestry/UKBB.w_hm3.AllAncestry.EUR.keep \
--ref_score ${Geno_1KG_dir}/Score_files_for_poylygenic_PRScs/${gwas}/1KGPhase3.w_hm3.${gwas} \
--ref_scale ${Geno_1KG_dir}/Score_files_for_poylygenic_PRScs/${gwas}/1KGPhase3.w_hm3.${gwas}.EUR.scale \
--ref_freq_chr ${Geno_1KG_dir}/freq_files/EUR/1KGPhase3.w_hm3.EUR.chr \
--plink ${plink1_9} \
--pheno_name ${gwas} \
--output ${UKBB_output}/PolygenicScores_PRScs/EUR/${gwas}/UKBB.w_hm3.${gwas}.EUR
n=$(($n+1))
done
```
</details>
<br/>
### TEDS
<details><summary>See code</summary>
```{bash, echo=T, eval=F}
# Set required variables
. /users/k1806347/brc_scratch/Software/MyGit/GenoPred/config_used/Target_scoring.config
# Create a list of gwas that haven't got corresponding PRS files in TEDS
> ${TEDS_output_dir}/PolygenicScores/EUR/todo_PRScs.txt
for gwas in $(echo HEIG03 EDUC03 ADHD04 BODY11);do
if [ ! -f ${TEDS_output_dir}/PolygenicScores_PRScs/EUR/${gwas}/TEDS.w_hm3.${gwas}.EUR.PRScs_profiles ]; then
echo $gwas >> ${TEDS_output_dir}/PolygenicScores/EUR/todo_PRScs.txt
fi
done
n=0
for gwas in $(cat ${TEDS_output_dir}/PolygenicScores/EUR/todo_PRScs.txt);do
qsub -N $(echo PRScs_job$(($n+25))) -hold_jid $(echo PRScs_job$(($n+0))) /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/Scaled_polygenic_scorer_PRScs/Scaled_polygenic_scorer_PRScs.R \
--target_plink_chr ${TEDS_output_dir}/Genotype/Harmonised/TEDS.w_hm3.QCd.AllSNP.chr \
--target_keep ${TEDS_output_dir}/Projected_PCs/Ancestry_idenitfier/TEDS.w_hm3.AllAncestry.EUR.keep \
--ref_score ${Geno_1KG_dir}/Score_files_for_poylygenic_PRScs/${gwas}/1KGPhase3.w_hm3.${gwas} \
--ref_scale ${Geno_1KG_dir}/Score_files_for_poylygenic_PRScs/${gwas}/1KGPhase3.w_hm3.${gwas}.EUR.scale \
--ref_freq_chr ${Geno_1KG_dir}/freq_files/EUR/1KGPhase3.w_hm3.EUR.chr \
--plink ${plink1_9} \
--pheno_name ${gwas} \
--output ${TEDS_output_dir}/PolygenicScores_PRScs/EUR/${gwas}/TEDS.w_hm3.${gwas}.EUR
n=$(($n+1))
done
```
</details>
<br/>
### 23andMe
<details><summary>See code</summary>
```{bash, echo=T, eval=F}
# Set required variables
. /users/k1806347/brc_scratch/Software/MyGit/GenoPred/config_used/Target_scoring.config
for individual in $(echo Oliver_Pain Kaili_Rimfeld Robert_Plomin); do
mkdir -p ${geno_23andMe}/${individual}/PolygenicScores_PRScs/EUR
# Create a list of gwas that haven't got corresponding PRS files in UKBB
> ${geno_23andMe}/${individual}/PolygenicScores/EUR/todo_PRScs.txt
for gwas in $(echo DEPR06 COLL01 HEIG03 BODY03);do
if [ ! -f ${geno_23andMe}/${individual}/PolygenicScores_PRScs/EUR/${gwas}/UKBB.w_hm3.${gwas}.EUR.PRScs_profile ]; then
echo $gwas >> ${geno_23andMe}/${individual}/PolygenicScores/EUR/todo_PRScs.txt
fi
done
n=0
for gwas in $(cat ${geno_23andMe}/${individual}/PolygenicScores/EUR/todo_PRScs.txt);do
qsub -N $(echo PRScs_job$(($n+25))) -hold_jid $(echo PRScs_job$(($n+0))) /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/Scaled_polygenic_scorer_PRScs/Scaled_polygenic_scorer_PRScs.R \
--target_plink_chr ${geno_23andMe}/${individual}/${individual}.1KGphase3.hm3.chr \
--ref_score ${Geno_1KG_dir}/Score_files_for_poylygenic_PRScs/${gwas}/1KGPhase3.w_hm3.${gwas} \
--ref_scale ${Geno_1KG_dir}/Score_files_for_poylygenic_PRScs/${gwas}/1KGPhase3.w_hm3.${gwas}.EUR.scale \
--ref_freq_chr ${Geno_1KG_dir}/freq_files/EUR/1KGPhase3.w_hm3.EUR.chr \
--plink ${plink1_9} \
--pheno_name ${gwas} \
--output ${geno_23andMe}/${individual}/PolygenicScores_PRScs/EUR/${gwas}/${individual}.w_hm3.${gwas}.EUR
n=$(($n+1))
done
done
```
</details>
<br/>
***
## SBLUP
This section uses a script called 'Scaled_polygenic_scorer_PRScs.R'. See more information on the utility of this script [here](https://github.com/opain/GenoPred/tree/master/Scripts/Scaled_polygenic_scorer_PRScs) for more information on this script.
### UK Biobank
<details><summary>See code</summary>
```{bash, echo=T, eval=F}
# Set required variables
. /users/k1806347/brc_scratch/Software/MyGit/GenoPred/config_used/Target_scoring.config
mkdir -p ${UKBB_output}/PolygenicScores_SBLUP/EUR
# Create a list of gwas that haven't got corresponding PRS files in UKBB
> ${UKBB_output}/PolygenicScores_SBLUP/EUR/todo_SBLUP.txt
for gwas in $(echo DEPR06 COLL01 HEIG03 BODY03 DIAB05 COAD01 CROH01 SCLE02 RHEU01);do
if [ ! -f ${UKBB_output}/PolygenicScores_SBLUP/EUR/${gwas}/UKBB.w_hm3.${gwas}.EUR.SBLUP_profiles ]; then
echo $gwas >> ${UKBB_output}/PolygenicScores_SBLUP/EUR/todo_SBLUP.txt
fi
done
n=0
for gwas in $(cat ${UKBB_output}/PolygenicScores_SBLUP/EUR/todo_SBLUP.txt);do
qsub -N $(echo SBLUP_job$(($n+25))) -hold_jid $(echo SBLUP_job$(($n+0))) /users/k1806347/brc_scratch/Software/Rscript.sh /users/k1806347/brc_scratch/Software/MyGit/GenoPred/Scripts/Scaled_polygenic_scorer_SBLUP/Scaled_polygenic_scorer_SBLUP.R \
--target_plink_chr ${UKBB_output}/Genotype/Harmonised/UKBB.w_hm3.QCd.AllSNP.chr \
--target_keep ${UKBB_output}/Projected_PCs/AllAncestry/UKBB.w_hm3.AllAncestry.EUR.keep \
--ref_score ${Geno_1KG_dir}/Score_files_for_poylygenic_SBLUP/${gwas}/GWAS_sumstats_SBLUP.sblup.cojo \
--ref_scale ${Geno_1KG_dir}/Score_files_for_poylygenic_SBLUP/${gwas}/1KGPhase3.w_hm3.${gwas}.EUR.scale \
--ref_freq_chr ${Geno_1KG_dir}/freq_files/EUR/1KGPhase3.w_hm3.EUR.chr \
--plink ${plink1_9} \
--pheno_name ${gwas} \
--output ${UKBB_output}/PolygenicScores_SBLUP/EUR/${gwas}/UKBB.w_hm3.${gwas}.EUR
n=$(($n+1))
done
```
</details>
<br/>
### TEDS
<details><summary>See code</summary>
```{bash, echo=T, eval=F}
# Set required variables
. /users/k1806347/brc_scratch/Software/MyGit/GenoPred/config_used/Target_scoring.config
mkdir -p ${TEDS_output_dir}/PolygenicScores_SBLUP/EUR
# Create a list of gwas that haven't got corresponding PRS files in TEDS
> ${TEDS_output_dir}/PolygenicScores_SBLUP/EUR/todo_SBLUP.txt
for gwas in $(echo HEIG03 EDUC03 ADHD04 BODY11);do
if [ ! -f ${TEDS_output_dir}/PolygenicScores_SBLUP/EUR/${gwas}/TEDS.w_hm3.${gwas}.EUR.SBLUP_profiles ]; then
echo $gwas >> ${TEDS_output_dir}/PolygenicScores_SBLUP/EUR/todo_SBLUP.txt
fi
done