-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtutorial.shtml
1859 lines (1594 loc) · 77.3 KB
/
tutorial.shtml
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
<html>
<body>
<head>
<link rel="stylesheet" href="plink.css" type="text/css">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<title>PLINK: Whole genome data analysis toolset</title>
</head>
<!--<html>-->
<!--<title>PLINK</title>-->
<!--<body>-->
<font size="6" color="darkgreen"><b>plink...</b></font>
<div style="position:absolute;right:10px;top:10px;font-size:
75%"><em>Last original <tt>PLINK</tt> release is <b>v1.07</b>
(10-Oct-2009); <b>PLINK 1.9</b> is now <a href="plink2.shtml"> available</a> for beta-testing</em></div>
<h1>Whole genome association analysis toolset</h1>
<font size="1" color="darkgreen">
<em>
<a href="index.shtml">Introduction</a> |
<a href="contact.shtml">Basics</a> |
<a href="download.shtml">Download</a> |
<a href="reference.shtml">Reference</a> |
<a href="data.shtml">Formats</a> |
<a href="dataman.shtml">Data management</a> |
<a href="summary.shtml">Summary stats</a> |
<a href="thresh.shtml">Filters</a> |
<a href="strat.shtml">Stratification</a> |
<a href="ibdibs.shtml">IBS/IBD</a> |
<a href="anal.shtml">Association</a> |
<a href="fanal.shtml">Family-based</a> |
<a href="perm.shtml">Permutation</a> |
<a href="ld.shtml">LD calcualtions</a> |
<a href="haplo.shtml">Haplotypes</a> |
<a href="whap.shtml">Conditional tests</a> |
<a href="proxy.shtml">Proxy association</a> |
<a href="pimputation.shtml">Imputation</a> |
<a href="dosage.shtml">Dosage data</a> |
<a href="metaanal.shtml">Meta-analysis</a> |
<a href="annot.shtml">Result annotation</a> |
<a href="clump.shtml">Clumping</a> |
<a href="grep.shtml">Gene Report</a> |
<a href="epi.shtml">Epistasis</a> |
<a href="cnv.shtml">Rare CNVs</a> |
<a href="gvar.shtml">Common CNPs</a> |
<a href="rfunc.shtml">R-plugins</a> |
<a href="psnp.shtml">SNP annotation</a> |
<a href="simulate.shtml">Simulation</a> |
<a href="profile.shtml">Profiles</a> |
<a href="ids.shtml">ID helper</a> |
<a href="res.shtml">Resources</a> |
<a href="flow.shtml">Flow chart</a> |
<a href="misc.shtml">Misc.</a> |
<a href="faq.shtml">FAQ</a> |
<a href="gplink.shtml">gPLINK</a>
</em></font>
</p>
<table border=0>
<tr>
<td bgcolor="lightblue" valign="top" width=20%>
<font size="1">
<a href="index.shtml">1. Introduction</a> </p>
<a href="contact.shtml">2. Basic information</a> </p>
<ul>
<li> <a href="contact.shtml#cite">Citing PLINK</a>
<li> <a href="contact.shtml#probs">Reporting problems</a>
<li> <a href="news.shtml">What's new?</a>
<li> <a href="pdf.shtml">PDF documentation</a>
</ul>
<a href="download.shtml">3. Download and general notes</a> </p>
<ul>
<li> <a href="download.shtml#download">Stable download</a>
<li> <a href="download.shtml#latest">Development code</a>
<li> <a href="download.shtml#general">General notes</a>
<li> <a href="download.shtml#msdos">MS-DOS notes</a>
<li> <a href="download.shtml#nix">Unix/Linux notes</a>
<li> <a href="download.shtml#compilation">Compilation</a>
<li> <a href="download.shtml#input">Using the command line</a>
<li> <a href="download.shtml#output">Viewing output files</a>
<li> <a href="changelog.shtml">Version history</a>
</ul>
<a href="reference.shtml">4. Command reference table</a> </p>
<ul>
<li> <a href="reference.shtml#options">List of options</a>
<li> <a href="reference.shtml#output">List of output files</a>
<li> <a href="newfeat.shtml">Under development</a>
</ul>
<a href="data.shtml">5. Basic usage/data formats</a>
<ul>
<li> <a href="data.shtml#plink">Running PLINK</a>
<li> <a href="data.shtml#ped">PED files</a>
<li> <a href="data.shtml#map">MAP files</a>
<li> <a href="data.shtml#tr">Transposed filesets</a>
<li> <a href="data.shtml#long">Long-format filesets</a>
<li> <a href="data.shtml#bed">Binary PED files</a>
<li> <a href="data.shtml#pheno">Alternate phenotypes</a>
<li> <a href="data.shtml#covar">Covariate files</a>
<li> <a href="data.shtml#clst">Cluster files</a>
<li> <a href="data.shtml#sets">Set files</a>
</ul>
<a href="dataman.shtml">6. Data management</a> </p>
<ul>
<li> <a href="dataman.shtml#recode">Recode</a>
<li> <a href="dataman.shtml#recode">Reorder</a>
<li> <a href="dataman.shtml#snplist">Write SNP list</a>
<li> <a href="dataman.shtml#updatemap">Update SNP map</a>
<li> <a href="dataman.shtml#updateallele">Update allele information</a>
<li> <a href="dataman.shtml#refallele">Force reference allele</a>
<li> <a href="dataman.shtml#updatefam">Update individuals</a>
<li> <a href="dataman.shtml#wrtcov">Write covariate files</a>
<li> <a href="dataman.shtml#wrtclst">Write cluster files</a>
<li> <a href="dataman.shtml#flip">Flip strand</a>
<li> <a href="dataman.shtml#flipscan">Scan for strand problem</a>
<li> <a href="dataman.shtml#merge">Merge two files</a>
<li> <a href="dataman.shtml#mergelist">Merge multiple files</a>
<li> <a href="dataman.shtml#extract">Extract SNPs</a>
<li> <a href="dataman.shtml#exclude">Remove SNPs</a>
<li> <a href="dataman.shtml#zero">Zero out sets of genotypes</a>
<li> <a href="dataman.shtml#keep">Extract Individuals</a>
<li> <a href="dataman.shtml#remove">Remove Individuals</a>
<li> <a href="dataman.shtml#filter">Filter Individuals</a>
<li> <a href="dataman.shtml#attrib">Attribute filters</a>
<li> <a href="dataman.shtml#makeset">Create a set file</a>
<li> <a href="dataman.shtml#tabset">Tabulate SNPs by sets</a>
<li> <a href="dataman.shtml#snp-qual">SNP quality scores</a>
<li> <a href="dataman.shtml#geno-qual">Genotypic quality scores</a>
</ul>
<a href="summary.shtml">7. Summary stats</a>
<ul>
<li> <a href="summary.shtml#missing">Missingness</a>
<li> <a href="summary.shtml#oblig_missing">Obligatory missingness</a>
<li> <a href="summary.shtml#clustermissing">IBM clustering</a>
<li> <a href="summary.shtml#testmiss">Missingness by phenotype</a>
<li> <a href="summary.shtml#mishap">Missingness by genotype</a>
<li> <a href="summary.shtml#hardy">Hardy-Weinberg</a>
<li> <a href="summary.shtml#freq">Allele frequencies</a>
<li> <a href="summary.shtml#prune">LD-based SNP pruning</a>
<li> <a href="summary.shtml#mendel">Mendel errors</a>
<li> <a href="summary.shtml#sexcheck">Sex check</a>
<li> <a href="summary.shtml#pederr">Pedigree errors</a>
</ul>
<a href="thresh.shtml">8. Inclusion thresholds</a>
<ul>
<li> <a href="thresh.shtml#miss2">Missing/person</a>
<li> <a href="thresh.shtml#maf">Allele frequency</a>
<li> <a href="thresh.shtml#miss1">Missing/SNP</a>
<li> <a href="thresh.shtml#hwd">Hardy-Weinberg</a>
<li> <a href="thresh.shtml#mendel">Mendel errors</a>
</ul>
<a href="strat.shtml">9. Population stratification</a>
<ul>
<li> <a href="strat.shtml#cluster">IBS clustering</a>
<li> <a href="strat.shtml#permtest">Permutation test</a>
<li> <a href="strat.shtml#options">Clustering options</a>
<li> <a href="strat.shtml#matrix">IBS matrix</a>
<li> <a href="strat.shtml#mds">Multidimensional scaling</a>
<li> <a href="strat.shtml#outlier">Outlier detection</a>
</ul>
<a href="ibdibs.shtml">10. IBS/IBD estimation</a>
<ul>
<li> <a href="ibdibs.shtml#genome">Pairwise IBD</a>
<li> <a href="ibdibs.shtml#inbreeding">Inbreeding</a>
<li> <a href="ibdibs.shtml#homo">Runs of homozygosity</a>
<li> <a href="ibdibs.shtml#segments">Shared segments</a>
</ul>
<a href="anal.shtml">11. Association</a>
<ul>
<li> <a href="anal.shtml#cc">Case/control</a>
<li> <a href="anal.shtml#fisher">Fisher's exact</a>
<li> <a href="anal.shtml#model">Full model</a>
<li> <a href="anal.shtml#strat">Stratified analysis</a>
<li> <a href="anal.shtml#homog">Tests of heterogeneity</a>
<li> <a href="anal.shtml#hotel">Hotelling's T(2) test</a>
<li> <a href="anal.shtml#qt">Quantitative trait</a>
<li> <a href="anal.shtml#qtmeans">Quantitative trait means</a>
<li> <a href="anal.shtml#qtgxe">Quantitative trait GxE</a>
<li> <a href="anal.shtml#glm">Linear and logistic models</a>
<li> <a href="anal.shtml#set">Set-based tests</a>
<li> <a href="anal.shtml#adjust">Multiple-test correction</a>
</ul>
<a href="fanal.shtml">12. Family-based association</a>
<ul>
<li> <a href="fanal.shtml#tdt">TDT</a>
<li> <a href="fanal.shtml#ptdt">ParenTDT</a>
<li> <a href="fanal.shtml#poo">Parent-of-origin</a>
<li> <a href="fanal.shtml#dfam">DFAM test</a>
<li> <a href="fanal.shtml#qfam">QFAM test</a>
</ul>
<a href="perm.shtml">13. Permutation procedures</a>
<ul>
<li> <a href="perm.shtml#perm">Basic permutation</a>
<li> <a href="perm.shtml#aperm">Adaptive permutation</a>
<li> <a href="perm.shtml#mperm">max(T) permutation</a>
<li> <a href="perm.shtml#rank">Ranked permutation</a>
<li> <a href="perm.shtml#genedropmodel">Gene-dropping</a>
<li> <a href="perm.shtml#cluster">Within-cluster</a>
<li> <a href="perm.shtml#mkphe">Permuted phenotypes files</a>
</ul>
<a href="ld.shtml">14. LD calculations</a>
<ul>
<li> <a href="ld.shtml#ld1">2 SNP pairwise LD</a>
<li> <a href="ld.shtml#ld2">N SNP pairwise LD</a>
<li> <a href="ld.shtml#tags">Tagging options</a>
<li> <a href="ld.shtml#blox">Haplotype blocks</a>
</ul>
<a href="haplo.shtml">15. Multimarker tests</a>
<ul>
<li> <a href="haplo.shtml#hap1">Imputing haplotypes</a>
<li> <a href="haplo.shtml#precomputed">Precomputed lists</a>
<li> <a href="haplo.shtml#hap2">Haplotype frequencies</a>
<li> <a href="haplo.shtml#hap3">Haplotype-based association</a>
<li> <a href="haplo.shtml#hap3c">Haplotype-based GLM tests</a>
<li> <a href="haplo.shtml#hap3b">Haplotype-based TDT</a>
<li> <a href="haplo.shtml#hap4">Haplotype imputation</a>
<li> <a href="haplo.shtml#hap5">Individual phases</a>
</ul>
<a href="whap.shtml">16. Conditional haplotype tests</a>
<ul>
<li> <a href="whap.shtml#whap1">Basic usage</a>
<li> <a href="whap.shtml#whap2">Specifying type of test</a>
<li> <a href="whap.shtml#whap3">General haplogrouping</a>
<li> <a href="whap.shtml#whap4">Covariates and other SNPs</a>
</ul>
<a href="proxy.shtml">17. Proxy association</a>
<ul>
<li> <a href="proxy.shtml#proxy1">Basic usage</a>
<li> <a href="proxy.shtml#proxy2">Refining a signal</a>
<li> <a href="proxy.shtml#proxy2b">Multiple reference SNPs</a>
<li> <a href="proxy.shtml#proxy3">Haplotype-based SNP tests</a>
</ul>
<a href="pimputation.shtml">18. Imputation (beta)</a>
<ul>
<li> <a href="pimputation.shtml#impute1">Making reference set</a>
<li> <a href="pimputation.shtml#impute2">Basic association test</a>
<li> <a href="pimputation.shtml#impute3">Modifying parameters</a>
<li> <a href="pimputation.shtml#impute4">Imputing discrete calls</a>
<li> <a href="pimputation.shtml#impute5">Verbose output options</a>
</ul>
<a href="dosage.shtml">19. Dosage data</a>
<ul>
<li> <a href="dosage.shtml#format">Input file formats</a>
<li> <a href="dosage.shtml#assoc">Association analysis</a>
<li> <a href="dosage.shtml#output">Outputting dosage data</a>
</ul>
<a href="metaanal.shtml">20. Meta-analysis</a>
<ul>
<li> <a href="metaanal.shtml#basic">Basic usage</a>
<li> <a href="metaanal.shtml#opt">Misc. options</a>
</ul>
<a href="annot.shtml">21. Annotation</a>
<ul>
<li> <a href="annot.shtml#basic">Basic usage</a>
<li> <a href="annot.shtml#opt">Misc. options</a>
</ul>
<a href="clump.shtml">22. LD-based results clumping</a>
<ul>
<li> <a href="clump.shtml#clump1">Basic usage</a>
<li> <a href="clump.shtml#clump2">Verbose reporting</a>
<li> <a href="clump.shtml#clump3">Combining multiple studies</a>
<li> <a href="clump.shtml#clump4">Best single proxy</a>
</ul>
<a href="grep.shtml">23. Gene-based report</a>
<ul>
<li> <a href="grep.shtml#grep1">Basic usage</a>
<li> <a href="grep.shtml#grep2">Other options</a>
</ul>
<a href="epi.shtml">24. Epistasis</a>
<ul>
<li> <a href="epi.shtml#snp">SNP x SNP</a>
<li> <a href="epi.shtml#case">Case-only</a>
<li> <a href="epi.shtml#gene">Gene-based</a>
</ul>
<a href="cnv.shtml">25. Rare CNVs</a>
<ul>
<li> <a href="cnv.shtml#format">File format</a>
<li> <a href="cnv.shtml#maps">MAP file construction</a>
<li> <a href="cnv.shtml#loading">Loading CNVs</a>
<li> <a href="cnv.shtml#olap_check">Check for overlap</a>
<li> <a href="cnv.shtml#type_filter">Filter on type </a>
<li> <a href="cnv.shtml#gene_filter">Filter on genes </a>
<li> <a href="cnv.shtml#freq_filter">Filter on frequency </a>
<li> <a href="cnv.shtml#burden">Burden analysis</a>
<li> <a href="cnv.shtml#burden2">Geneset enrichment</a>
<li> <a href="cnv.shtml#assoc">Mapping loci</a>
<li> <a href="cnv.shtml#reg-assoc">Regional tests</a>
<li> <a href="cnv.shtml#qt-assoc">Quantitative traits</a>
<li> <a href="cnv.shtml#write_cnvlist">Write CNV lists</a>
<li> <a href="cnv.shtml#report">Write gene lists</a>
<li> <a href="cnv.shtml#groups">Grouping CNVs </a>
</ul>
<a href="gvar.shtml">26. Common CNPs</a>
<ul>
<li> <a href="gvar.shtml#cnv2"> CNPs/generic variants</a>
<li> <a href="gvar.shtml#cnv2b"> CNP/SNP association</a>
</ul>
<a href="rfunc.shtml">27. R-plugins</a>
<ul>
<li> <a href="rfunc.shtml#rfunc1">Basic usage</a>
<li> <a href="rfunc.shtml#rfunc2">Defining the R function</a>
<li> <a href="rfunc.shtml#rfunc2b">Example of debugging</a>
<li> <a href="rfunc.shtml#rfunc3">Installing Rserve</a>
</ul>
<a href="psnp.shtml">28. Annotation web-lookup</a>
<ul>
<li> <a href="psnp.shtml#psnp1">Basic SNP annotation</a>
<li> <a href="psnp.shtml#psnp2">Gene-based SNP lookup</a>
<li> <a href="psnp.shtml#psnp3">Annotation sources</a>
</ul>
<a href="simulate.shtml">29. Simulation tools</a>
<ul>
<li> <a href="simulate.shtml#sim1">Basic usage</a>
<li> <a href="simulate.shtml#sim2">Resampling a population</a>
<li> <a href="simulate.shtml#sim3">Quantitative traits</a>
</ul>
<a href="profile.shtml">30. Profile scoring</a>
<ul>
<li> <a href="profile.shtml#prof1">Basic usage</a>
<li> <a href="profile.shtml#prof2">SNP subsets</a>
<li> <a href="profile.shtml#dose">Dosage data</a>
<li> <a href="profile.shtml#prof3">Misc options</a>
</ul>
<a href="ids.shtml">31. ID helper</a>
<ul>
<li> <a href="ids.shtml#ex">Overview/example</a>
<li> <a href="ids.shtml#intro">Basic usage</a>
<li> <a href="ids.shtml#check">Consistency checks</a>
<li> <a href="ids.shtml#alias">Aliases</a>
<li> <a href="ids.shtml#joint">Joint IDs</a>
<li> <a href="ids.shtml#lookup">Lookups</a>
<li> <a href="ids.shtml#replace">Replace values</a>
<li> <a href="ids.shtml#match">Match files</a>
<li> <a href="ids.shtml#qmatch">Quick match files</a>
<li> <a href="ids.shtml#misc">Misc.</a>
</ul>
<a href="res.shtml">32. Resources</a>
<ul>
<li> <a href="res.shtml#hapmap">HapMap (PLINK format)</a>
<li> <a href="res.shtml#teach">Teaching materials</a>
<li> <a href="res.shtml#mmtests">Multimarker tests</a>
<li> <a href="res.shtml#sets">Gene-set lists</a>
<li> <a href="res.shtml#glist">Gene range lists</a>
<li> <a href="res.shtml#attrib">SNP attributes</a>
</ul>
<a href="flow.shtml">33. Flow-chart</a>
<ul>
<li> <a href="flow.shtml">Order of commands</a>
</ul>
<a href="misc.shtml">34. Miscellaneous</a>
<ul>
<li> <a href="misc.shtml#opt">Command options/modifiers</a>
<li> <a href="misc.shtml#output">Association output modifiers</a>
<li> <a href="misc.shtml#species">Different species</a>
<li> <a href="misc.shtml#bugs">Known issues</a>
</ul>
<a href="faq.shtml">35. FAQ & Hints</a>
</p>
<a href="gplink.shtml">36. gPLINK</a>
<ul>
<li> <a href="gplink.shtml">gPLINK mainpage</a>
<li> <a href="gplink_tutorial/index.html">Tour of gPLINK</a>
<li> <a href="gplink.shtml#overview">Overview: using gPLINK</a>
<li> <a href="gplink.shtml#locrem">Local versus remote modes</a>
<li> <a href="gplink.shtml#start">Starting a new project</a>
<li> <a href="gplink.shtml#config">Configuring gPLINK</a>
<li> <a href="gplink.shtml#plink">Initiating PLINK jobs</a>
<li> <a href="gplink.shtml#view">Viewing PLINK output</a>
<li> <a href="gplink.shtml#hv">Integration with Haploview</a>
<li> <a href="gplink.shtml#down">Downloading gPLINK</a></p>
</ul>
</font>
</td><td width=5%>
<td valign="top">
</p>
<h1>A <tt>PLINK</tt> tutorial</h1>
</p>
In this tutorial, we will consider using <tt>PLINK</tt> to analyse
example data: randomly selected genotypes (approximately 80,000
autosomal SNPs) from the 89 Asian HapMap individuals. A phenotype
has been simulated based on the genotype at one SNP. In this tutorial,
we will walk through using <tt>PLINK</tt> to work with the data,
using a range of features: data management, summary statistics,
population stratification and basic association analysis.
</p><strong>NOTE</strong> These data do not, of course, represent a
realistic study design or a realistic disease model. The point of this
exercise is simply to get used to running <tt>PLINK</tt>.
<a name="asian"></a>
<h2>89 HapMap samples and 80K random SNPs</h2>
</p>
The first step is to obtain a working copy of <tt>PLINK</tt> and of the
example data files.
<ol>
<li> Make sure you have <tt>PLINK</tt> installed on your machine (see
<a href="download.shtml">these instructions</a>).
<li> Download the <a href="hapmap1.zip">example data</a> archive file
which contains the genotypes, map files and two extra phenotype files,
described below (zipped, approximately 2.8M)
<li> Create a new folder/directory on your machine, and unzip the file
you downloaded (called <tt>hapmap1.zip</tt>) into this folder.
</ol>
<strong>HINT!</strong> If you are a Windows user who is unsure how to
do this, follow <a href="gentle.shtml">this link</a></p>
<hr width=25%>
Two phenotypes were generated: a quantitative triat and a disease trait
(affection status, coded 1=unaffected, 2=affected), based on a median
split of the quantitative trait. The quantitative trait was generated
as a function of three simple components:
<ul>
<li> A random component
<li> Chinese versus Japanese identity
<li> A variant on chromosome 2, <tt>rs2222162</tt>
</ul>
Remember, this model is not intended to be realistic. The following
contingency table shows the joint distribution of disease and
subpopulation:
<pre>
<b>Chinese</b> <b>Japanese</b>
<b>Control</b> 34 11
<b>Case</b> 11 33
</pre>
which shows a strong relationship between these two variables. The next
table shows the association between the variant <tt>rs2222162</tt> and
disease:
<pre>
<b>Genotype</b>
<b>11</b> <b>12</b> <b>22</b>
<b>Control</b> 17 22 6
<b>Case</b> 3 19 22
</pre>
Again, the strong association is clear. Note that the alleles have been
recoded as <tt>1</tt> and <tt>2</tt> (this is not necessary for
<tt>PLINK</tt> to work, however -- it can accept any coding for SNPs).
</p>
In summary, we have a single causal variant that is associated with
disease. Complicating factors are that this variant is one of
83534 SNPs and also that there might be some degree of confounding
of the SNP-disease associations due to the subpopulation-disease
association -- i.e. a possibility that population stratification effects
will exist. Even though we might expect the two subpopulations to be
fairly similar from an overall genetic perspective, and even though the
sample size is small, this might still lead to an increase in false
positive rates if not controlled for.</p>
We will use the affection status variable as the default variable for
analysis (i.e. the sixth column in the PED file). The quantitative
trait is in a separate alternate phenotype file, <tt>qt.phe</tt>. The
file <tt>pop.phe</tt> contains a dummy phenotype that is coded 1 for
Chinese individuals and 2 for Japanese individuals. We will use this
in investigating between-population differences. You can view these
alternate phenotype files in any text editor.
</p>
In this tutorial dataset we focus on autosomal SNPs for simplicity,
although <tt>PLINK</tt> does provide support for X and Y chromosome
SNPs for a number of analyses. See the main documentation for further
information.
</P>
<a name="asian3"></a>
<h2>Using <tt>PLINK</tt> to analyse these data</h2>
</p>
This tutorial is intended to introduce some of <tt>PLINK</tt>'s
features rather than provide exhaustive coverage of them. Futhermore, it
is not intended as an analysis plan for whole genome data, or to represent
anything close to 'best practice'.
</p>
These hyperlinks show an overview of topics:
<ul>
<li> <a href="#t1">Getting started</a>
<li> <a href="#t2">Making a binary PED file</a>
<li> <a href="#t3">Working with the binary PED file</a>
<li> <a href="#t4">Summary statistics: missing rates</a>
<li> <a href="#t5">Summary statistics: allele frequencies</a>
<li> <a href="#t6">Basic association analysis</a>
<li> <a href="#t7">Genotypic association models</a>
<li> <a href="#t8">Stratification analysis</a>
<li> <a href="#t9">Association analysis, accounting for clusters</a>
<li> <a href="#t10">Quantitative trait association analysis</a>
<li> <a href="#t11">Extracting a SNP of interest</a>
</ul>
</p>
<a name="t1"></a>
<b><font color="green"><em>Getting started</em></font></b></p>
Just typing <tt>plink</tt> and specifying a file with no further
options is a good way to check that the file is intact, and to get
some basic summary statistics about the file.
<h5>
plink --file hapmap1
</h5></p>
The <tt>--file</tt> option takes a single parameter, the root of the input
file names, and will look for two files: a PED file and a MAP file with
this root name. In otherwords, <tt>--file hapmap1</tt> implies
<tt>hapmap1.ped</tt> and <tt>hapmap1.map</tt> should exist in the
current directory.
</p><strong>HINT!</strong> It is possible to specify files outside of the
current directory, and to have the PED and MAP files have different root
names, or not end in <tt>.ped</tt> and <tt>.map</tt>, by using the
<tt>--ped</tt> and <tt>--map</tt> options.
</p>
PED and MAP files are plain text files; PED files contain genotype
information (one person per row) and MAP files contain information on
the name and position of the markers in the PED file. If you are not
familiar with the file formats required for PED and MAP files, please
consult <a href="data.shtml">this page</a>.</p>
The above command should generate something like the following output
in the console window. It will also save this information to a file
called <tt>plink.log</tt>.
<pre>
@----------------------------------------------------------@
| PLINK! | v0.99l | 27/Jul/2006 |
|----------------------------------------------------------|
| (C) 2006 Shaun Purcell, GNU General Public License, v2 |
|----------------------------------------------------------|
| http://pngu.mgh.harvard.edu/purcell/plink/ |
@----------------------------------------------------------@
Web-based version check ( --noweb to skip )
Connecting to web... OK, v0.99l is current
*** Pre-Release Testing Version ***
Writing this text to log file [ plink.log ]
Analysis started: Mon Jul 31 09:00:11 2006
Options in effect:
--file hapmap1
83534 (of 83534) markers to be included from [ hapmap1.map ]
89 individuals read from [ hapmap1.ped ]
89 individuals with nonmissing phenotypes
Assuming a binary trait (1=unaff, 2=aff, 0=miss)
Missing phenotype value is also -9
Before frequency and genotyping pruning, there are 83534 SNPs
Applying filters (SNP-major mode)
89 founders and 0 non-founders found
0 of 89 individuals removed for low genotyping ( MIND > 0.1 )
859 SNPs failed missingness test ( GENO > 0.1 )
16994 SNPs failed frequency test ( MAF < 0.01 )
After frequency and genotyping pruning, there are 65803 SNPs
Analysis finished: Mon Jul 31 09:00:19 2006
</pre>
</P>
The information contained here can be summarized as follows:
<ul>
<li> A banner showing copyright information and the version number -- the
web-based version check shows that this is an up-to-date version of <tt>PLINK</tt>
and displays a message that v0.99l is a pre-release testing version.
</p>
<li> A message indicating that the log file will be saved in
<tt>plink.log</tt>. The name of the output file can be changed with the
<tt>--out</tt> option -- e.g. specifying <tt>--out anal1</tt> will
generate a log file called <tt>anal1.log</tt> instead.
</p>
<li> A list of the command options specified is given next: in this case
it is only a single option, <tt>--file hapmap1</tt>. By keeping track of
log files, and naming each analysis with its own <tt>--out</tt> name, it
makes it easier to keep track of when and how the different output
files were generated.
</p>
<li> Next is some information on the number of markers and individuals
read from the MAP and PED file. In total, just over 80,000 SNPs were read
in from the MAP file. It is written <tt>"...83534 (of 83534)..."</tt> because
some SNPs might be excluded (by making the physical position a
negative number in the MAP file), in which case the first number would
indicate how many SNPs are included. In this case, all SNPs are
read in from the PED file. We also see that 89 individuals were read in
from the PED file, and that all these individuals had valid phenotype
information.
</p>
<li> Next, <tt>PLINK</tt> tells us that the phenotype is an affection
status variable, as opposed to a quantitative trait, and lets us know
what the missing values are.
</p>
<li> The next stage is the filtering stage -- individuals and/or SNPs are
removed on the basis of thresholds. Please see <a href="thresh.shtml">this
page</a> for more information on setting thresholds. In this case we see
that no individuals were removed, but almost 20,000 SNPs were removed,
based on missingness (859) and frequency (16994).
This particularly high proportion of removed SNPs is based on the
fact that these are random HapMap SNPs in the Chinese and Japanese
samples, rather than pre-selected markers on a whole-genome association
product: there will be many more rare and monomorphic markers here than one
would normally expect.
</p>
<li>Finally, a line is given that indicates when this analysis finished.
You can see that it took 8 seconds (on my machine at least) to read in
the file and apply the
filters.
</ul>
If other analyses had been requsted, then the other output files generated
would have been indicated in the log file. All output files that
<tt>PLINK</tt> generates have the same format: <tt>root.extension</tt> where
<tt>root</tt> is, by default, "plink" but can be changed with the
<tt>--out</tt> option, and the extension will depend on the type of output
file it is (a complete list of extensions is given <a
href="reference.shtml#output">here</a>).
</p>
<a name="t2"></a>
<b><font color="green"><em>Making a binary PED file</em></font></b></p>
The first thing we will do is to make a binary PED file. This more compact
representation of the data saves space and speeds up subsequent analysis.
To make a binary PED file, use the following command.
<h5>
plink --file hapmap1 --make-bed --out hapmap1
</h5></p>
If it runs correctly on your machine, you should see the following in
your output:
<pre>
<em>above as before</em>
...
Before frequency and genotyping pruning, there are 83534 SNPs
Applying filters (SNP-major mode)
89 founders and 0 non-founders found
0 SNPs failed missingness test ( GENO > 1 )
0 SNPs failed frequency test ( MAF < 0 )
After frequency and genotyping pruning, there are 83534 SNPs
Writing pedigree information to [ hapmap1.fam ]
Writing map (extended format) information to [ hapmap1.bim ]
Writing genotype bitfile to [ hapmap1.bed ]
Using (default) SNP-major mode
Analysis finished: Mon Jul 31 09:10:05 2006
</pre>
There are several things to note:
<ul>
<li> When using the <tt>--make-bed</tt> option, the threshold filters
for missing rates and allele frequency were automatically set to exclude
nobody. Although these filters can be specified manually (using
<tt>--mind</tt>, <tt>--geno</tt> and <tt>--maf</tt>) to exclude people,
this default tends to be wanted when creating a new PED or binary PED file.
The commands <tt>--extract</tt> / <tt>--exclude</tt> and
<tt>--keep</tt> / <tt>--remove</tt> can also be applied at this stage.
</p>
<li> Three files are created with this command -- the binary file that
contains the raw genotype data <tt>hapmap1.bed</tt> but also a revsied
map file <tt>hapmap1.bim</tt> which contains two extra columns that give the
allele names for each SNP, and <tt>hapmap1.fam</tt> which is just the
first six columns of <tt>hapmap1.ped</tt>. You can view the
<tt>.bim</tt> and <tt>.fam</tt> files -- but do not try to view
the <tt>.bed</tt> file. None of these three files should be manually
editted.
</ul>
</p>
If, for example, you wanted to create a new file that only includes individuals
with high genotyping (at least 95% complete), you would run:
<h5>
plink --file hapmap1 --make-bed --mind 0.05 --out highgeno
</h5></p>
which would create files
<pre>
highgeno.bed
highgeno.bim
highgeno.fam
</pre>
</p>
<a name="t3"></a>
<b><font color="green"><em>Working with the binary PED file</em></font></b></p>
To specify that the input data are in binary format, as opposed to the
normal text PED/MAP format, just use the <tt>--bfile</tt> option instead
of <tt>--file</tt>. To repeat the first command we ran (which just loads
the data and prints some basic summary statistics):
<h5>
plink --bfile hapmap1
</h5></p>
<pre>
Writing this text to log file [ plink.log ]
Analysis started: Mon Jul 31 09:12:08 2006
Options in effect:
--bfile hapmap1
Reading map (extended format) from [ hapmap1.bim ]
83534 markers to be included from [ hapmap1.bim ]
Reading pedigree information from [ hapmap1.fam ]
89 individuals read from [ hapmap1.fam ]
89 individuals with nonmissing phenotypes
Reading genotype bitfile from [ hapmap1.bed ]
Detected that binary PED file is v1.00 SNP-major mode
Before frequency and genotyping pruning, there are 83534 SNPs
Applying filters (SNP-major mode)
89 founders and 0 non-founders found
0 of 89 individuals removed for low genotyping ( MIND > 0.1 )
859 SNPs failed missingness test ( GENO > 0.1 )
16994 SNPs failed frequency test ( MAF < 0.01 )
After frequency and genotyping pruning, there are 65803 SNPs
Analysis finished: Mon Jul 31 09:12:10 2006
</pre>
The things to note here:
<ul>
<li> That three files <tt>hapmap1.bim</tt>, <tt>hapmap1.fam</tt> and
<tt>hapmap1.bed</tt> were loaded instead of the usual two files. That is,
<tt>hapmap1.ped</tt> and <tt>hapmap1.map</tt> are not used in this
analysis, and could in fact be deleted now.
</p>
<li> The data are loaded in much more quickly -- based on the timestamp
at the beginning and end of the log output, this took 2 seconds instead of
10.
</ul>
</p>
<a name="t4"></a>
<b><font color="green"><em>Summary statistics: missing rates</em></font></b></p>
Next, we shall generate some simple summary statistics on rates of missing
data in the file, using the <tt>--missing</tt> option:
<h5>
plink --bfile hapmap1 --missing --out miss_stat
</h5></p>
which should generate the following output:
<pre>
...
0 of 89 individuals removed for low genotyping ( MIND > 0.1 )
Writing individual missingness information to [ miss_stat.imiss ]
Writing locus missingness information to [ miss_stat.lmiss ]
...
</pre>
</p>
Here we see that no individuals were removed for low genotypes (<tt>MIND >
0.1</tt> implies that we accept people with less than 10 percent missingness).
</p>
The per individual and per SNP (after excluding individuals on the basis of
low genotyping) rates are then output to the files <tt>miss_stat.imiss</tt>
and <tt>miss_stat.lmiss</tt> respectively. If we had not specified an
<tt>--out</tt> option, the root output filename would have defaulted to "plink". </p>
These output files are standard, plain text files that can be viewed in
any text editor, pager, spreadsheet or statistics package (albeit one
that can handle large files). Taking a look at the file
<tt>miss_stat.lmiss</tt>, for example using the <tt>more</tt> command which is
present on most systems:
<h5>
more miss_stat.lmiss
</h5></p>
we see
<pre>
CHR SNP N_MISS F_MISS
1 rs6681049 0 0
1 rs4074137 0 0
1 rs7540009 0 0
1 rs1891905 0 0
1 rs9729550 0 0
1 rs3813196 0 0
1 rs6704013 2 0.0224719
1 rs307347 12 0.134831
1 rs9439440 2 0.0224719
...
</pre>
That is, for each SNP, we see the number of missing individuals
(<tt>N_MISS</tt>) and the proportion of individuals missing
(<tt>F_MISS</tt>). Similarly:
<h5>
more miss_stat.imiss
</h5></p>
we see
<pre>
FID IID MISS_PHENO N_MISS F_MISS
HCB181 1 N 671 0.00803266
HCB182 1 N 1156 0.0138387
HCB183 1 N 498 0.00596164
HCB184 1 N 412 0.00493212
HCB185 1 N 329 0.00393852
HCB186 1 N 1233 0.0147605
HCB187 1 N 258 0.00308856
...
</pre>
The final column is the actual genotyping rate for that individual -- we
see the genotyping rate is very high here.
</p>
<strong>HINT</strong> If you are using a spreadsheet package that can only
display a limited number of rows (some popular packages can handle just over
65,000 rows) then it might be desirable to ask <tt>PLINK</tt> to analyse the data by
chromosome, using the <tt>--chr</tt> option. For example, to perform the above
analysis for chromosome 1:
<h5>
plink --bfile hapmap1 --chr 1 --out res1 --missing
</h5></p>
then for chromosome 2:
<h5>
plink --bfile hapmap1 --chr 2 --out res2 --missing
</h5></p>
and so on.
</p>
<a name="t5"></a>
<b><font color="green"><em>Summary statistics: allele frequencies</em></font></b></p>
Next we perform a similar analysis, except requesting allele frequencies
instead of genotyping rates. The following command generates a file
called <tt>freq_stat.frq</tt> which contains the minor allele frequency and
allele codes for each SNP.
<h5>
plink --bfile hapmap1 --freq --out freq_stat
</h5></p>
It is also possible to perform this frequency analysis (and the
missingness analysis) stratified by a categorical, cluster variable. In
this case, we shall use the file that indicates whether the
individual is from the Chinese or the Japanese sample, <tt>pop.phe</tt>.
This cluster file contains three columns; each row is an individual. The
format is described more fully in the <a href="data.shtml#cluster">main
documentation</a>.
</p>
To perform a stratified analysis, use the <tt>--within</tt> option.
<h5>
plink --bfile hapmap1 --freq --within pop.phe --out freq_stat
</h5></p>
The output will now indicate that a file called <tt>freq_stat.frq.strat</tt>.
has been generated instead of <tt>freq_stat.frq</tt>. If we view this file:
<h5>
more freq_stat.frq.strat
</h5></p>
we see each row is now the allele frequency for each SNP stratifed by subpopulation:
<pre>
CHR SNP CLST A1 A2 MAF
1 rs6681049 1 1 2 0.233333
1 rs6681049 2 1 2 0.193182
1 rs4074137 1 1 2 0.1
1 rs4074137 2 1 2 0.0568182
1 rs7540009 1 0 2 0
1 rs7540009 2 0 2 0
1 rs1891905 1 1 2 0.411111
1 rs1891905 2 1 2 0.397727
...
</pre>
Here we see that each SNP is represented twice - the <tt>CLST</tt>
column indicates whether the frequency is from the Chinese or Japanese
populations, coded as per the <tt>pop.phe</tt> file.</p>
</p>
If you were just interested in a specific SNP, and wanted to know what
the frequency was in the two populations, you can use the <tt>--snp</tt>
option to select this SNP:
<h5>
plink --bfile hapmap1 --snp rs1891905 --freq --within pop.phe --out snp1_frq_stat
</h5></p>
would generate a file <tt>snp1_frq_stat.frq.strat</tt> containing only the
population-specific frequencies for this single SNP. You can
also specify a range of SNPs by adding the <tt>--window</tt> <em>kb</em> option or
using the options <tt>--from</tt> and <tt>--to</tt>, following each with a
different SNP (they must be in the correct order and be on the same chromosome).
Follow <a href="dataman.shtml#extract">this link</a> for more details.
</p>
<a name="t6"></a>
<b><font color="green"><em>Basic association analysis</em></font></b></p>
Let's now perform a basic association analysis on the disease trait
for all single SNPs. The basic command is
<h5>
plink --bfile hapmap1 --assoc --out as1
</h5></p>
which generates an output file <tt>as1.assoc</tt> which contains the
following fields
<pre><font size="-1">
CHR SNP A1 F_A F_U A2 CHISQ P OR
1 rs6681049 1 0.1591 0.2667 2 3.067 0.07991 0.5203
1 rs4074137 1 0.07955 0.07778 2 0.001919 0.9651 1.025
1 rs1891905 1 0.4091 0.4 2 0.01527 0.9017 1.038
1 rs9729550 1 0.1705 0.08889 2 2.631 0.1048 2.106
1 rs3813196 1 0.03409 0.02222 2 0.2296 0.6318 1.553
1 rs12044597 1 0.5 0.4889 2 0.02198 0.8822 1.045
1 rs10907185 1 0.3068 0.2667 2 0.3509 0.5536 1.217
1 rs11260616 1 0.2326 0.2 2 0.2754 0.5998 1.212
1 rs745910 1 0.1395 0.1932 2 0.9013 0.3424 0.6773
...
</font></pre>
where each row is a single SNP association result. The fields are:
<ul>
<li> Chromosome
<li> SNP identifier
<li> Code for allele 1 (the minor, rare allele based on the entire sample frequencies)
<li> The frequency of this variant in cases
<li> The frequency of this variant in controls
<li> Code for the other allele
<li> The chi-squared statistic for this test (1 df)