Debian Codegraph @

plink2_help.cc

raw
1 // This file is part of PLINK 2.0, copyright (C) 2005-2025 Shaun Purcell,
2 // Christopher Chang.
3 //
4 // This program is free software: you can redistribute it and/or modify it
5 // under the terms of the GNU General Public License as published by the Free
6 // Software Foundation, either version 3 of the License, or (at your option)
7 // any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT
10 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 // more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17
18 // necessary to include this instead of plink2_common so kCmdlineFormatStr[]
19 // is known to have external linkage
20 #include "plink2_help.h"
21
22 #ifdef __cplusplus
23 namespace plink2 {
24 #endif
25
26 const char kCmdlineFormatStr[] = "\n plink2 <input flag(s)...> [command flag(s)...] [other flag(s)...]\n plink2 --help [flag name(s)...]\n\n";
27
28 PglErr DispHelp(const char* const* argvk, uint32_t param_ct) {
29 // yes, this is overkill. But it should be a good template for other
30 // command-line programs to use.
31 uint32_t param_ctl = BitCtToWordCt(param_ct);
32 PglErr reterr = kPglRetSuccess;
33 const char** new_argv = nullptr;
34 HelpCtrl help_ctrl;
35 uint32_t arg_uidx;
36 uint32_t arg_idx;
37 uint32_t net_unmatched_ct;
38 int32_t col_num;
39 int32_t leading_dashes;
40 help_ctrl.iters_left = param_ct? 2 : 0;
41 help_ctrl.param_ct = param_ct;
42 help_ctrl.unmatched_ct = param_ct;
43 help_ctrl.param_slens = nullptr;
44 help_ctrl.all_match_arr = nullptr;
45 help_ctrl.argv = nullptr;
46 if (param_ct) {
47 if (unlikely(pgl_malloc(param_ct * sizeof(int32_t), &help_ctrl.param_slens) ||
48 pgl_malloc(param_ctl * 3 * sizeof(intptr_t), &help_ctrl.all_match_arr))) {
49 goto DispHelp_ret_NOMEM;
50 }
51 leading_dashes = 0;
52 for (arg_uidx = 0; arg_uidx != param_ct; ++arg_uidx) {
53 if (argvk[arg_uidx][0] == '-') {
54 leading_dashes = 1;
55 break;
56 }
57 }
58 if (leading_dashes) {
59 if (unlikely(pgl_malloc(param_ct * sizeof(intptr_t), &new_argv))) {
60 goto DispHelp_ret_NOMEM;
61 }
62 for (arg_uidx = 0; arg_uidx != param_ct; ++arg_uidx) {
63 if (argvk[arg_uidx][0] == '-') {
64 if (argvk[arg_uidx][1] == '-') {
65 new_argv[arg_uidx] = &(argvk[arg_uidx][2]);
66 } else {
67 new_argv[arg_uidx] = &(argvk[arg_uidx][1]);
68 }
69 } else {
70 new_argv[arg_uidx] = argvk[arg_uidx];
71 }
72 }
73 help_ctrl.argv = new_argv;
74 } else {
75 help_ctrl.argv = argvk;
76 }
77 for (arg_idx = 0; arg_idx != param_ct; ++arg_idx) {
78 help_ctrl.param_slens[arg_idx] = strlen(help_ctrl.argv[arg_idx]);
79 }
80 ZeroWArr(param_ctl * 3, help_ctrl.all_match_arr);
81 help_ctrl.prefix_match_arr = &(help_ctrl.all_match_arr[param_ctl]);
82 help_ctrl.perfect_match_arr = &(help_ctrl.all_match_arr[param_ctl * 2]);
83 help_ctrl.preprint_newline = 1;
84 } else {
85 help_ctrl.argv = nullptr;
86 fputs(
87 "\nIn the command line flag definitions that follow,\n"
88 " * <angle brackets> denote a required parameter, where the text between the\n"
89 " angle brackets describes its nature.\n"
90 " * ['square brackets + single-quotes'] denotes an optional modifier. Use the\n"
91 " EXACT text in the quotes.\n"
92 " * [{bar|separated|braced|bracketed|values}] denotes a collection of mutually\n"
93 " exclusive optional modifiers (again, the exact text must be used). When\n"
94 " there are no outer square brackets, one of the choices must be selected.\n"
95 " * ['quoted_text='<description of value>] denotes an optional modifier that\n"
96 " must begin with the quoted text, and be followed by a value with no\n"
97 " whitespace in between. '|' may also be used here to indicate mutually\n"
98 " exclusive options.\n"
99 " * [square brackets without quotes or braces] denote an optional parameter,\n"
100 " where the text between the brackets describes its nature.\n"
101 " * An ellipsis (...) indicates that you may enter multiple arguments of the\n"
102 " specified type.\n"
103 " * A \"column set descriptor\" is either\n"
104 " 1. a comma-separated sequence of column set names; this is interpreted as\n"
105 " the full list of column sets to include.\n"
106 " 2. a comma-separated sequence of column set names, all preceded by '+' or\n"
107 " '-'; this is interpreted as a list of changes to the default.\n"
108 , stdout);
109 fputs(kCmdlineFormatStr, stdout);
110 fputs(
111 "Most PLINK runs require exactly one main input fileset. The following flags\n"
112 "are available for defining its form and location:\n\n"
113 , stdout);
114 }
115 do {
116 // explicit gzipped .pvar/.bim support was tried, and then rejected since
117 // decompression was too slow
118 // Zstd should have the necessary x86 performance characteristics, though
119 HelpPrint("pfile\0pgen\0pgi\0bfile\0bed\0", &help_ctrl, 1,
120 " --pfile <prefix> ['vzs'] : Specify .pgen[ + .pgen.pgi] + .pvar[.zst] +\n"
121 " .psam prefix.\n"
122 " --pgen <filename> : Specify full name of .pgen/.bed file.\n"
123 " --pgi <filename> : Specify full name of .pgen.pgi file.\n"
124 );
125 HelpPrint("pfile\0pgen\0pvar\0psam\0bfile\0bed\0bim\0fam\0dosage\0", &help_ctrl, 1,
126 " --pvar <filename> : Specify full name of .pvar/.bim file.\n"
127 );
128 HelpPrint("pfile\0pgen\0pvar\0psam\0bfile\0bed\0bim\0fam\0import-dosage\0dosage\0vcf\0bcf\0", &help_ctrl, 1,
129 " --psam <filename> : Specify full name of .psam/.fam file.\n\n"
130 );
131 HelpPrint("bfile\0bpfile\0bed\0bim\0fam\0", &help_ctrl, 1,
132 " --bfile <prefix> ['vzs'] : Specify .bed + .bim[.zst] + .fam prefix.\n"
133 " --bpfile <prefix> ['vzs'] : Specify .pgen + .bim[.zst] + .fam prefix.\n\n"
134 );
135 HelpPrint("vcf\0bcf\0keep-autoconv\0", &help_ctrl, 1,
136 " --keep-autoconv ['vzs'] : When importing non-PLINK-binary data, don't\n"
137 " delete autogenerated fileset at end of run.\n\n"
138 );
139 HelpPrint("bfile\0fam\0no-fid\0no-parents\0no-sex\0", &help_ctrl, 1,
140 " --no-fid : .fam file does not contain column 1 (family ID).\n"
141 " --no-parents : .fam file does not contain columns 3-4 (parents).\n"
142 " --no-sex : .fam file does not contain column 5 (sex).\n\n"
143 );
144 // probable todo: dosage=AD mode.
145 HelpPrint("vcf\0bcf\0psam\0fam\0", &help_ctrl, 1,
146 " --vcf <filename> ['dosage='<field>]\n"
147 " --bcf <filename> ['dosage='<field>] :\n"
148 " Specify full name of .vcf{|.gz|.zst} or BCF2 file to import.\n"
149 " * These can be used with --psam/--fam.\n"
150 " * By default, dosage information is not imported. To import the GP field\n"
151 " (must be VCFv4.3-style 0..1, one probability per possible genotype), add\n"
152 " 'dosage=GP' (or 'dosage=GP-force', see below). To import Minimac3-style\n"
153 " DS+HDS phased dosage, add 'dosage=HDS'. 'dosage=DS' (or anything else\n"
154 " for now) causes the named field to be interpreted as a Minimac3-style\n"
155 " dosage.\n"
156 " Note that, in the dosage=GP case, PLINK 2 collapses the probabilities\n"
157 " down to dosages; you cannot use PLINK 2 to losslessly convert VCF\n"
158 " FORMAT/GP data to e.g. BGEN format. To make this more obvious, PLINK 2\n"
159 " now errors out when dosage=GP is used on a file with a FORMAT/DS header\n"
160 " line and --import-dosage-certainty wasn't specified, since dosage=DS\n"
161 " extracts the same information more quickly in this situation. You can\n"
162 " suppress this error with 'dosage=GP-force'.\n"
163 " In all of these cases, hardcalls are regenerated from scratch from the\n"
164 " dosages. As a consequence, variants with no GT field can now be\n"
165 " imported; they will be assumed to contain only diploid calls when HDS is\n"
166 " also absent.\n\n"
167 );
168 HelpPrint("data\0gen\0bgen\0sample\0haps\0legend\0", &help_ctrl, 1,
169 " --data <filename prefix> <REF/ALT mode> ['gzs']\n"
170 " --bgen <filename> <REF/ALT mode> ['snpid-chr']\n"
171 " --gen <filename> <REF/ALT mode>\n"
172 " --sample <filename> :\n"
173 " Specify an Oxford-format dataset to import. --data specifies a .gen[.zst]\n"
174 " + .sample pair, while --bgen specifies a BGEN v1.1+ file.\n"
175 " * If a BGEN v1.2+ file contains sample IDs, it may be imported without a\n"
176 " companion .sample file.\n"
177 " * With 'snpid-chr', chromosome codes are read from the 'SNP ID' field\n"
178 " instead of the usual chromosome field.\n"
179 " * The following REF/ALT modes are supported:\n"
180 " 'ref-first': The first allele for each variant is REF.\n"
181 " 'ref-last': The last allele for each variant is REF.\n"
182 " 'ref-unknown': The last allele for each variant is treated as\n"
183 " provisional-REF.\n\n"
184 );
185 // todo: make 'per' prefix modifiable
186 HelpPrint("haps\0legend\0", &help_ctrl, 1,
187 " --haps <filename> [{ref-first | ref-last}]\n"
188 " --legend <filename> <chr code> :\n"
189 " Specify .haps [+ .legend] file(s) to import.\n"
190 " * When --legend is specified, it's assumed that the --haps file doesn't\n"
191 " contain header columns.\n"
192 " * On chrX, the second male column may contain dummy '-' entries. (However,\n"
193 " PLINK 2 currently cannot handle omitted male columns.)\n"
194 " * If not used with --sample, new sample IDs are of the form 'per#/per#'.\n\n"
195 );
196 HelpPrint("pedmap\0ped\0map\0file\0", &help_ctrl, 0,
197 " --pedmap <prefix> : Specify .ped + .map filename prefix.\n"
198 " --ped <filename> : Specify full name of .ped file.\n"
199 );
200 HelpPrint("pedmap\0map\0import-dosage\0dosage\0file\0", &help_ctrl, 1,
201 " --map <filename> : Specify full name of .map file.\n\n"
202 );
203 HelpPrint("tfile\0tped\0tfam\0", &help_ctrl, 1,
204 " --tfile <prefix> : Specify .tped + .tfam filename prefix.\n"
205 " --tped <filename> : Specify full name of .tped file.\n"
206 " --tfam <filename> : Specify full name of .tfam file.\n\n"
207 );
208 HelpPrint("import-dosage\0dosage\0map\0", &help_ctrl, 1,
209 " --import-dosage <allele dosage file> ['noheader'] ['id-delim='<char>]\n"
210 " ['skip0='<i>] ['skip1='<j>] ['skip2='<k>] ['dose1']\n"
211 " ['format='<m>] [{ref-first | ref-last}]\n"
212 " ['single-chr='<code>] ['chr-col-num='<#>]\n"
213 " ['pos-col-num='<#>] :\n"
214 " Specify PLINK 1.x-style dosage file to import.\n"
215 " * You must also specify a companion .psam/.fam file.\n"
216 " * By default, PLINK assumes that the file contains a header line, which has\n"
217 " 'SNP' in (1-based) column i+1, 'A1' in column i+j+2, 'A2' in column\n"
218 " i+j+3, and sample FID/IIDs starting from column i+j+k+4. (i/j/k are\n"
219 " normally zero, but can be changed with 'skip0', 'skip1', and 'skip2'\n"
220 " respectively. FID/IID are normally assumed to be separate tokens, but if\n"
221 " they're merged into a single token you can specify the delimiter with\n"
222 " 'id-delim='.) If such a header line is not present, use the 'noheader'\n"
223 " modifier; samples will then be assumed to appear in the same order as\n"
224 " they do in the .psam/.fam file.\n"
225 " * You may specify a companion .map file. If you do not,\n"
226 " * 'single-chr=' can be used to specify that all variants are on the named\n"
227 " chromosome. Otherwise, you can use 'chr-col-num=' to read chromosome\n"
228 " codes from the given (1-based) column number.\n"
229 " * 'pos-col-num=' causes bp coordinates to be read from the given column\n"
230 " number.\n"
231 " * The 'format=' modifier lets you specify the number of values used to\n"
232 " represent each dosage. 'format=1' normally indicates a single 0..2 A1\n"
233 " expected count; 'dose1' modifies this to a 0..1 frequency. 'format=2'\n"
234 " indicates a 0..1 homozygous A1 likelihood followed by a 0..1 het\n"
235 " likelihood. 'format=3' indicates 0..1 hom A1, 0..1 het, 0..1 hom A2.\n"
236 " 'format=infer' (the default) infers the format from the number of columns\n"
237 " in the first nonheader line.\n\n"
238 );
239 // todo: triallelic rate
240 HelpPrint("dummy\0", &help_ctrl, 1,
241 " --dummy <sample ct> <SNP ct> [missing dosage freq(s)] [missing pheno freq]\n"
242 " [{acgt | 1234 | 12}] ['pheno-ct='<count>] ['scalar-pheno']\n"
243 " ['phase-freq='<rate>] ['dosage-freq='<rate>]\n"
244 " This generates a fake input dataset with the specified number of samples\n"
245 " and SNPs.\n"
246 " * By default, the missing dosage frequency is zero. This can be changed by\n"
247 " providing a comma-separated list of possible frequencies (one frequency\n"
248 " in the list is selected for each variant).\n"
249 " * By default, the missing phenotype frequency is zero. This can be changed\n"
250 " by providing both a dosage-frequency and a 4th numeric argument; the 4th\n"
251 " argument is then interpreted as the missing phenotype frequency.\n"
252 " * By default, allele codes are As and Bs; this can be changed with the\n"
253 " 'acgt', '1234', or '12' modifier.\n"
254 " * By default, one binary phenotype is generated. 'pheno-ct=' can be used\n"
255 " to change the number of phenotypes, and 'scalar-pheno' causes these\n"
256 " phenotypes to be normally distributed scalars.\n"
257 " * By default, all genotypes/dosages are unphased. To phase some of them,\n"
258 " use 'phase-freq='.\n"
259 " * By default, all dosages are in {0,1,2}. To make some of them take on\n"
260 " decimal values, use 'dosage-freq='. (These dosages are affected by\n"
261 " --hard-call-threshold and --dosage-erase-threshold.)\n\n"
262 );
263 HelpPrint("fa\0normalize\0ref-from-fa\0", &help_ctrl, 1,
264 " --fa <filename> : Specify full name of reference FASTA file.\n\n"
265 );
266 if (!param_ct) {
267 fputs(
268 "Output files have names of the form 'plink2.<extension>' by default. You can\n"
269 "change the 'plink2' prefix with\n\n"
270 , stdout);
271 }
272 HelpPrint("out\0", &help_ctrl, 1,
273 " --out <prefix> : Specify prefix for output files.\n\n"
274 );
275 if (!param_ct) {
276 fputs(
277 "Most runs also require at least one of the following commands:\n\n"
278 , stdout);
279 }
280 HelpPrint("rm-dup\0list-duplicate-vars\0", &help_ctrl, 1,
281 " --rm-dup [mode] ['list']\n"
282 " Remove all but one instance of each duplicate-ID variant (ignoring the\n"
283 " missing ID), and (with the 'list' modifier) write a list of duplicated IDs\n"
284 " to <output prefix>.rmdup.list.\n"
285 " The following modes of operation are supported:\n"
286 " * 'error' (default) causes this to error out when there's a genotype data\n"
287 " or other mismatch between the records. A list of affected IDs is written\n"
288 " to <output prefix>.rmdup.mismatch.\n"
289 " * 'retain-mismatch' causes all instances of a duplicate-ID variant to be\n"
290 " retained when there's a genotype data or variant info mismatch; otherwise\n"
291 " one instance is kept. The .rmdup.mismatch file is also written.\n"
292 " * 'exclude-mismatch' removes all instances of duplicate-ID mismatched\n"
293 " variants instead.\n"
294 " * 'exclude-all' causes all instances of duplicate-ID variants to be\n"
295 " removed, even when the actual records are identical.\n"
296 " * 'force-first' causes only the first instance of duplicate-ID variants to\n"
297 " be kept, under all circumstances.\n\n"
298 );
299 HelpPrint("make-pgen\0make-bpgen\0make-bed\0make-just-pvar\0make-just-psam\0make-pfile\0make-bpfile\0make-bfile\0", &help_ctrl, 1,
300 " --make-pgen ['vzs'] ['format='<code>] ['trim-alts'] ['erase-phase']\n"
301 " ['erase-dosage'] ['fill-missing-from-dosage']\n"
302 " ['pvar-cols='<col set desc>] ['psam-cols='<col set desc>]\n"
303 " --make-bpgen ['vzs'] ['format='<code>] ['trim-alts'] ['erase-phase']\n"
304 " ['erase-dosage'] ['fill-missing-from-dosage']\n"
305 " --make-bed ['vzs'] ['trim-alts']\n"
306 /*
307 " --make-pgen ['vzs'] ['format='<code>] [{trim-alts | erase-alt2+}]\n"
308 " ['erase-phase'] ['erase-dosage'] ['fill-missing-from-dosage']\n"
309 " ['writer-ver'] ['multiallelics='<mode>]\n"
310 " [{varid-split | varid-split-dup | varid-dup | varid-join}]\n"
311 " ['pvar-cols='<col set desc>] ['psam-cols='<col set desc>]\n"
312 " --make-bpgen ['vzs'] ['format='<code>] [{trim-alts | erase-alt2+}]\n"
313 " ['erase-phase'] ['erase-dosage'] ['fill-missing-from-dosage']\n"
314 " ['writer-ver'] ['multiallelics='<mode>]\n"
315 " [{varid-split | varid-split-dup | varid-dup | varid-join}]\n"
316 " --make-bed ['vzs'] [{trim-alts | erase-alt2+}]\n"
317 " ['multiallelics='<split mode>]\n"
318 */
319 " Create a new PLINK 2 binary fileset (--make-pgen = .pgen + .pvar[.zst] +\n"
320 " .psam, --make-bpgen = .pgen + .bim[.zst] + .fam).\n"
321 " * Unlike the automatic text-to-binary converters (which only heed\n"
322 " chromosome filters), this supports all of PLINK's filtering flags.\n"
323 " * The 'vzs' modifier causes the variant file (.pvar/.bim) to be\n"
324 " Zstd-compressed.\n"
325 " * The 'format' modifier requests an uncompressed fixed-variant-width .pgen\n"
326 " file. (These do not directly support multiallelic variants.) The\n"
327 " following format code is currently supported:\n"
328 " 2: just like .bed, except with an extended (12-byte instead of 3-byte)\n"
329 " header containing variant/sample counts, and rotated genotype codes\n"
330 " (00 = hom ref, 01 = het, 10 = hom alt, 11 = missing).\n"
331 /*
332 " 3: unphased dosage data\n"
333 " 4: phased dosage data\n"
334 " * The 'trim-alts' modifier causes alternate alleles not present in the\n"
335 " dataset after sample filtering to be removed. (This occurs before any\n"
336 " genotype/dosage erasure performed by --make-[b]pgen/--make-bed.)\n"
337 */
338 // Commented out since, while this is on the roadmap, it isn't fully
339 // implemented yet. (This also applies to other commented-out help text.)
340 " * The 'erase-phase' and 'erase-dosage' modifiers prevent phase and dosage\n"
341 " information from being written to the new .pgen.\n"
342 " * When a hardcall is missing but the corresponding dosage is present,\n"
343 " 'fill-missing-from-dosage' causes the (Euclidean-)nearest hardcall to be\n"
344 " filled in, with ties broken in favor of the lower-index allele.\n"
345 /*
346 " * The 'writer-ver' modifier causes the output .pgen to include this\n"
347 " program's version string. Note that the resulting .pgen is not readable\n"
348 " by plink2 builds from before May 2024.\n"
349 " * The 'multiallelics=' modifier (alias: 'm=') specifies a join or split\n"
350 " mode. The following modes are currently supported:\n"
351 " * '-': Split all multiallelic records.\n"
352 " * '-snps': Split SNP-only multiallelic records.\n"
353 " * '+'/'+both': Adjacent variants with identical CHROM/POS/REF are\n"
354 " classified as SNPs and non-SNPs; SNPs are joined into one\n"
355 " variant, and non-SNPs are joined into another. This\n"
356 " errors out if any preexisting variant is mixed\n"
357 " SNP/non-SNP; split first in that case. (Also see the\n"
358 " remark about symbolic ALT alleles below.)\n"
359 " * '+snps': Similar to '+both', except only SNPs are joined.\n"
360 " * '+any': All variants with identical CHROM/POS/REF and no symbolic ALT\n"
361 " alleles are joined into a single multiallelic variant.\n"
362 " Symbolic ALT alleles are joined separately. Additional conditions apply\n"
363 " to them, and PLINK 2 usually errors out when they aren't met.\n"
364 " When splitting with 'varid-dup', the new variants keep the original\n"
365 " variant\n"
366 " ID. Otherwise, new variant IDs are assigned as follows:\n"
367 " 1. If --set-all-var-ids was specified, that template is applied.\n"
368 " 2. Otherwise, if joining, and all source variant IDs are identical and\n"
369 " nonmissing, that ID is used.\n"
370 " 3. Otherwise, if splitting with the 'varid-split' or 'varid-split-dup'\n"
371 " modifier, the original variant ID is split on the ';' character when\n"
372 " the number of ';'s is correct. (When the post-split ID is the missing\n"
373 " code, --set-missing-var-ids is applied to it.) Similarly, if joining\n"
374 " with the 'varid-join' modifier, the new variant ID is set to the\n"
375 " original IDs joined with the ';' character when all original IDs are\n"
376 " nonmissing and contain exactly one ';' per extra ALT allele.\n"
377 " 4. Otherwise, if splitting with 'varid-split-dup', the original ID is\n"
378 " kept.\n"
379 " 5. Otherwise, if --set-missing-var-ids was specified, that template is\n"
380 " applied.\n"
381 " 6. Otherwise, the variant ID is set to the missing code.\n"
382 " When merging, the new variant gets the lowest QUAL and the union of the\n"
383 " FILTER values.\n"
384 " INFO splitting/merging is under development; for now, 'bcftools norm'\n"
385 " (possibly on a single-sample file) can be used for this.\n"
386 " * The 'erase-alt2+' modifier causes alt alleles past the first to be\n"
387 " removed; substantially affected genotypes/dosages (alt2+ dosage >= 0.5)\n"
388 " are set to missing, and slightly affected dosages are rescaled. This is\n"
389 " applied after 'multiallelics=' merge.\n"
390 " * When the 'trim-alts', 'multiallelics=', and/or 'erase-...' modifier is\n"
391 " present, --make-bed/--make-[b]pgen cannot be combined with other\n"
392 " commands. (They can be combined with other filters.)\n"
393 */
394 " * The first five columns of a .pvar file are always #CHROM/POS/ID/REF/ALT.\n"
395 " Supported optional .pvar column sets are:\n"
396 " xheader: All pre-#CHROM header lines (yeah, this is technically not a\n"
397 " column), except for possibly FILTER/INFO definitions when\n"
398 " those column(s) have been removed. Without this, only the\n"
399 " #CHROM header line is kept.\n"
400 " vcfheader: xheader, with additions to make it a valid VCF header.\n"
401 " maybequal: QUAL. Omitted if all remaining values are missing.\n"
402 " qual: Force QUAL column to be written even when empty.\n"
403 " maybefilter: FILTER. Omitted if all remaining values are missing.\n"
404 " filter: Force FILTER column to be written even when empty.\n"
405 " maybeinfo: INFO. Omitted if all remaining values are missing, or if\n"
406 " INFO/PR is the only subfield.\n"
407 " info: Force INFO column to be written.\n"
408 " maybecm: Centimorgan coordinate. Omitted if all remaining values = 0.\n"
409 " cm: Force CM column to be written even when empty.\n"
410 " The default is xheader,maybequal,maybefilter,maybeinfo,maybecm.\n"
411 " * Supported column sets for the .psam file are:\n"
412 " maybefid: Family ID, '0' = missing. Omitted if all values missing.\n"
413 " fid: Force FID column to be written even when empty.\n"
414 " maybesid: Source ID, '0' = missing. Omitted if all values missing.\n"
415 " sid: Force SID column to be written even when empty.\n"
416 " maybeparents: Father and mother IIDs. Omitted if all values missing.\n"
417 " parents: Force PAT and MAT columns to be written even when empty.\n"
418 " sex: '1' = male, '2' = female, 'NA' = missing.\n"
419 " pheno1: First active phenotype. If none, all column entries are set to\n"
420 " the --output-missing-phenotype string.\n"
421 " phenos: All active phenotypes, if any. (Can be combined with pheno1 to\n"
422 " force at least one phenotype column to be written.)\n"
423 " The default is maybefid,maybesid,maybeparents,sex,phenos.\n\n"
424 );
425 HelpPrint("make-just-pvar\0make-just-psam\0make-just-bim\0make-just-fam\0write-cluster\n\0", &help_ctrl, 1,
426 " --make-just-pvar ['zs'] ['cols='<column set descriptor>]\n"
427 " --make-just-psam ['cols='<column set descriptor>]\n"
428 " --make-just-bim ['zs']\n"
429 " --make-just-fam\n"
430 " Variants of --make-pgen/--make-bed which only write a new variant or sample\n"
431 " file. These don't always require an input genotype file.\n"
432 " USE THESE CAUTIOUSLY. It is very easy to desynchronize your binary\n"
433 " genotype data and your sample/variant indexes if you use these commands\n"
434 " improperly. If you have any doubt, stick with --make-[b]pgen/--make-bed.\n\n"
435 );
436 HelpPrint("export\0recode\0", &help_ctrl, 1,
437 " --export <output format(s)...> [{01 | 12}] ['bgz'] ['id-delim='<char>]\n"
438 " ['id-paste='<column set descriptor>] ['include-alt']\n"
439 " ['omit-nonmale-y'] ['spaces'] ['vcf-dosage='<field>] ['ref-first']\n"
440 " ['bits='<#>] ['sample-v2'] ['bgen-omit-sample-id-block']\n"
441 " Create a new fileset with all filters applied. The following output\n"
442 " formats are supported:\n"
443 " (actually, only A, AD, Av, bcf, bgen-1.x, haps, hapslegend, ind-major-bed,\n"
444 " oxford, ped, phylip, phylip-phased, tped, and vcf are implemented for now)\n"
445 " * '23': 23andMe 4-column format. This can only be used on a single\n"
446 " sample's data (--keep may be handy), and does not support\n"
447 " multicharacter allele codes.\n"
448 " * 'A': Sample-major additive (0/1/2) coding, suitable for loading from R.\n"
449 " If you need uncounted alleles to be named in the header line, add\n"
450 " the 'include-alt' modifier.\n"
451 " * 'AD': Sample-major additive (0/1/2) + dominant (het=1/hom=0) coding.\n"
452 " Also supports 'include-alt'.\n"
453 " * 'Av': Variant-major 0/1/2.\n"
454 " * 'beagle': Unphased per-autosome .dat and .map files, readable by early\n"
455 " BEAGLE versions.\n"
456 " * 'beagle-nomap': Single .beagle.dat file.\n"
457 " * 'bgen-1.x': Oxford-format .bgen + .sample. For v1.2/v1.3, sample\n"
458 " identifiers are stored in the .bgen (with id-delim and\n"
459 " id-paste settings applied), and default precision is 16-bit\n"
460 " (use the 'bits' modifier to reduce this).\n"
461 " * 'bimbam': Regular BIMBAM format.\n"
462 " * 'bimbam-1chr': BIMBAM format, with a two-column .pos.txt file. Does not\n"
463 " support multiple chromosomes.\n"
464 " * 'fastphase': Per-chromosome fastPHASE files, with\n"
465 " .chr-<chr #>.phase.inp filename extensions.\n"
466 " * 'fastphase-1chr': Single .phase.inp file. Does not support\n"
467 " multiple chromosomes.\n"
468 " * 'haps', 'hapslegend': Oxford-format .haps + .sample[ + .legend]. All\n"
469 " data must be biallelic and phased. When the 'bgz'\n"
470 " modifier is present, the .haps file is\n"
471 " block-gzipped.\n"
472 " * 'HV': Per-chromosome Haploview files, with .chr-<chr #>{.ped,.info}\n"
473 " filename extensions.\n"
474 " * 'HV-1chr': Single Haploview .ped + .info file pair. Does not support\n"
475 " multiple chromosomes.\n"
476 " * 'ind-major-bed': PLINK 1 sample-major .bed (+ .bim + .fam).\n"
477 " * 'lgen': PLINK 1 long-format (.lgen + .fam + .map), loadable with --lfile.\n"
478 " * 'lgen-ref': .lgen + .fam + .map + .ref, loadable with --lfile +\n"
479 " --reference.\n"
480 " * 'list': Single genotype-based list, up to 4 lines per variant. To omit\n"
481 " nonmale genotypes on the Y chromosome, add the 'omit-nonmale-y'\n"
482 " modifier.\n"
483 " * 'rlist': .rlist + .fam + .map fileset, where the .rlist file is a\n"
484 " genotype-based list which omits the most common genotype for\n"
485 " each variant. Also supports 'omit-nonmale-y'.\n"
486 " * 'oxford', 'oxford-v2': Oxford-format .gen + .sample. When the 'bgz'\n"
487 " modifier is present, the .gen file is\n"
488 " block-gzipped. 'oxford' requests the original\n"
489 " .gen file format with 5 leading columns\n"
490 " (understood by older PLINK builds); 'oxford-v2'\n"
491 " requests the current 6-leading-column flavor.\n"
492 " * 'ped', 'compound-genotypes': PLINK 1 sample-major (.ped + .map),\n"
493 " loadable with --pedmap.\n"
494 " * 'phylip': Relaxed PHYLIP format, IUPAC ambiguity codes used for hets.\n"
495 " * 'phylip-phased': Relaxed PHYLIP format, but with two alignments per\n"
496 " sample. Input must be fully phased.\n"
497 " * 'structure': Structure-format.\n"
498 " * 'tped': PLINK 1 variant-major (.tped + .tfam), loadable with --tfile.\n"
499 " * 'vcf', : VCF (default version 4.3). If PAR1 and PAR2 are present,\n"
500 " 'vcf-4.2', they are automatically merged with chrX, with proper\n"
501 " 'bcf', handling of chromosome codes and male ploidy.\n"
502 " 'bcf-4.2' When the 'bgz' modifier is present, the VCF file is\n"
503 " block-gzipped. (This always happens with BCF output.)\n"
504 " The 'id-paste' modifier controls which .psam columns are\n"
505 " used to construct sample IDs (choices are maybefid, fid,\n"
506 " iid, maybesid, and sid; default is maybefid,iid,maybesid),\n"
507 " while the 'id-delim' modifier sets the character between the\n"
508 " ID pieces (default '_').\n"
509 " Genotypes are always exported. If you want to export a\n"
510 " sites-only VCF instead, see --make-pgen/--make-just-pvar's\n"
511 " 'vcfheader' column set.\n"
512 " Dosages are not exported unless the 'vcf-dosage=' modifier\n"
513 " is present. The following six dosage export modes are\n"
514 " supported:\n"
515 " 'GP': genotype posterior probabilities (v4.3 only).\n"
516 " 'DS': Minimac3-style dosages, omitted for hardcalls.\n"
517 " 'DS-force': Minimac3-style dosages, never omit.\n"
518 " 'DS-only': Same as DS-force, except GT field is omitted.\n"
519 " 'HDS': Minimac3-style phased dosages, omitted for hardcalls\n"
520 " and unphased calls. Also includes 'DS' output.\n"
521 " 'HDS-force': Always report DS and HDS.\n"
522 // possible todo: pedigree output?
523 " In addition,\n"
524 " * The '12' modifier causes ref alleles to be coded as '1' and alt1 alleles\n"
525 " to be coded as '2', while '01' maps ref -> 0 and alt1 -> 1. Note that\n"
526 " this is essentially the reverse of PLINK 1.x; the reversal was not\n"
527 " properly documented before 7 Mar 2023.\n"
528 " * The 'spaces' modifier makes the output space-delimited instead of\n"
529 " tab-delimited, whenever both are permitted.\n"
530 " * The 'used-sites' modifier causes a .used_sites.tsv file to be included\n"
531 " with PHYLIP-format output.\n"
532 " * For biallelic formats where it's unspecified whether the reference/major\n"
533 " allele should appear first or second, --export defaults to second for\n"
534 " compatibility with PLINK 1.9. Use 'ref-first' to change this.\n"
535 " (Note that this doesn't apply to the 'A', 'AD', and 'Av' formats; use\n"
536 " --export-allele to control which alleles are counted there.)\n"
537 " * 'sample-v2' exports .sample files according to the QCTOOLv2 rather than\n"
538 " the original specification. Only one ID column is exported ('id-paste'\n"
539 " and 'id-delim' settings apply), parental IDs are exported if present, and\n"
540 " category names are preserved rather than converted to positive integers.\n"
541 " * 'bgen-omit-sample-id-block' causes the sample ID block to be omitted from\n"
542 " exported bgen-1.2 and -1.3 files.\n\n"
543 );
544 // don't bother with case/control or cluster-stratification any more, since
545 // user can loop through subgroups and then use Unix cut/paste
546
547 // todo: add optional column for computed MAF (nothing here quite
548 // corresponds to nonmajor_freqs when e.g. --maf-pseudocount is specified).
549 HelpPrint("freq\0mach-r2-filter\0", &help_ctrl, 1,
550 " --freq ['zs'] ['counts'] ['cols='<column set descriptor>] ['bins-only']\n"
551 " ['refbins='<comma-separated bin boundaries> | 'refbins-file='<file>]\n"
552 " ['alt1bins='<comma-separated bin boundaries> | 'alt1bins-file='<file>]\n"
553 " Empirical allele frequency report. By default, only founders are\n"
554 " considered. Dosages are taken into account (e.g. heterozygous haploid\n"
555 " calls count as 0.5).\n"
556 " Supported column sets are:\n"
557 " chrom: Chromosome ID.\n"
558 " pos: Base-pair coordinate.\n"
559 " (ID is always present, and positioned here.)\n"
560 " ref: Reference allele.\n"
561 " alt1: Alternate allele 1.\n"
562 " alt: All alternate alleles, comma-separated.\n"
563 " maybeprovref: Reports whether REF allele is marked as known or\n"
564 " provisional, when at least one of the latter is present in\n"
565 " the main dataset, and the REF column is present.\n"
566 " provref: Force provref column even if all-'N'.\n"
567 " reffreq: Reference allele frequency/dosage.\n"
568 " alt1freq: Alt1 frequency/dosage.\n"
569 " altfreq: Comma-separated frequencies/dosages for all alternate alleles.\n"
570 " freq: Similar to altfreq, except ref is also included at the start.\n"
571 " eq: Comma-separated <allele>=<freq> for all present alleles. (If no\n"
572 " alleles are present, the column contains a single '.'.)\n"
573 " eqz: Same as eq, except zero-counts are included.\n"
574 " alteq/alteqz: Same as eq/eqz, except reference allele is omitted.\n"
575 " numeq: 0=<freq>,1=<freq>, etc. Zero-counts are omitted.\n"
576 " altnumeq: Same as numeq, except reference allele is omitted.\n"
577 " machr2: Unphased MaCH imputation quality metric.\n"
578 " minimac3r2: Phased Minimac3 imputation quality.\n"
579 " nobs: Number of allele observations.\n"
580 " The default is chrom,ref,alt,maybeprovref,altfreq,nobs.\n"
581 " Additional .afreq.{ref,alt1}.bins (or .acount.{ref,alt1}.bins with\n"
582 " 'counts') file(s) are generated when 'refbins='/'refbins-file=' or\n"
583 " 'alt1bins='/'alt1bins-file=' is present; these report the total number of\n"
584 " frequencies or counts in each left-closed, right-open interval. (If you\n"
585 " only want these histogram(s), and not the main report, add 'bins-only'.)\n\n"
586 );
587 // this can't really handle dosages, so we specify "hardcall"
588 HelpPrint("geno-counts\0freq\0freqx\frqx\0", &help_ctrl, 1,
589 " --geno-counts ['zs'] ['cols='<column set descriptor>]\n"
590 " Variant-based hardcall genotype count report (considering both alleles\n"
591 " simultaneously in the diploid case). Nonfounders are now included; use\n"
592 " --keep-founders if this is a problem. Heterozygous haploid calls are\n"
593 " treated as missing.\n"
594 " Supported column sets are:\n"
595 " chrom: Chromosome ID.\n"
596 " pos: Base-pair coordinate.\n"
597 " (ID is always present, and positioned here.)\n"
598 " ref: Reference allele.\n"
599 " alt1: Alternate allele 1.\n"
600 " alt: All alternate alleles, comma-separated.\n"
601 " maybeprovref: Reports whether REF allele is marked as known or\n"
602 " provisional, when at least one of the latter is present,\n"
603 " and the REF column is present.\n"
604 " provref: Force provref column even if all-'N'.\n"
605 " homref: Homozygous-ref count.\n"
606 " refalt1: Heterozygous ref-alt1 count.\n"
607 " refalt: Comma-separated het ref-altx counts.\n"
608 " homalt1: Homozygous-alt1 count.\n"
609 " altxy: Comma-separated altx-alty counts, in (1/1)-(1/2)-(2/2)-(1/3)-...\n"
610 " order.\n"
611 " xy: Similar to altxy, except the reference allele is treated as alt0,\n"
612 " and the sequence starts (0/0)-(0/1)-(1/1)-(0/2)-...\n"
613 " hapref: Haploid-ref count.\n"
614 " hapalt1: Haploid-alt1 count.\n"
615 " hapalt: Comma-separated haploid-altx counts.\n"
616 " hap: Similar to hapalts, except ref is also included at the start.\n"
617 " numeq: 0/0=<hom ref ct>,0/1=<het ref-alt1>,1/1=<hom alt1>,...,0=<hap ref>\n"
618 " etc. Zero-counts are omitted. (If all genotypes are missing, the\n"
619 " column contains a single '.'.)\n"
620 " missing: Number of missing genotypes.\n"
621 " nobs: Number of (nonmissing) genotype observations.\n"
622 " The default is chrom,ref,alt,maybeprovref,homref,refalt,altxy,hapref,\n"
623 " hapalt,missing.\n\n"
624 );
625 // All weirdnesses in the default column-set are for the sake of minimizing
626 // differences from the PSC section of bcftools stats -s.
627 // There's no homsnp or homrefsnp column set since there's no good way to
628 // define their behavior for multiallelic mixed SNP/non-SNP variants, and
629 // --snps-only already exists.
630 HelpPrint("sample-counts\0geno-counts\0", &help_ctrl, 1,
631 " --sample-counts ['zs'] ['cols='<column set descriptor>]\n"
632 " Sample-based hardcall genotype count report.\n"
633 " * Unknown-sex samples are treated as female.\n"
634 " * Heterozygous haploid calls (MT included) are treated as missing.\n"
635 " * As with other PLINK 2 commands, SNPs that have not been left-normalized\n"
636 " are counted as non-SNP non-symbolic. (Use e.g. --normalize when that's a\n"
637 " problem.)\n"
638 " * Supported column sets are:\n"
639 " maybefid: FID, if that column was present in the input.\n"
640 " fid: Force FID column to be written even when absent in the input.\n"
641 " (IID is always present, and positioned here.)\n"
642 " maybesid: SID, if that column was present in the input.\n"
643 " sid: Force SID column to be written even when absent in the input.\n"
644 " sex: '1' = male, '2' = female, 'NA' = missing.\n"
645 " hom: Homozygous genotype count.\n"
646 " homref: Homozygous-ref genotype count.\n"
647 " homalt: Homozygous-alt genotype count.\n"
648 " homaltsnp: Homozygous-alt SNP count.\n"
649 " het: Heterozygous genotype count.\n"
650 " refalt: Heterozygous ref-altx genotype count.\n"
651 " het2alt: Heterozygous altx-alty genotype count.\n"
652 " hetsnp: Heterozygous SNP count.\n"
653 " dipts: Diploid SNP transition count.\n"
654 " ts: SNP transition count (excluding chrY for females).\n"
655 " diptv: Diploid SNP transversion count.\n"
656 " tv: SNP transversion count.\n"
657 " dipnonsnpsymb: Diploid non-SNP, non-symbolic count.\n"
658 " nonsnpsymb: Non-SNP, non-symbolic count.\n"
659 " symbolic: Symbolic variant count.\n"
660 " nonsnp: Non-SNP count.\n"
661 " dipsingle: Number of singletons relative to this dataset, across just\n"
662 " diploid calls. (Note that if the ALT allele in a chrX\n"
663 " biallelic variant appears in exactly one female and one\n"
664 " male, that counts as a singleton for just the female.)\n"
665 " single: Number of singletons relative to this dataset.\n"
666 " haprefwfemaley: Haploid-ref count, counting chrY for everyone.\n"
667 " hapref: Haploid-ref count, excluding chrY for females.\n"
668 " hapaltwfemaley: Haploid-alt count, counting chrY for everyone.\n"
669 " hapalt: Haploid-alt count, excluding chrY for females.\n"
670 " missingwfemaley: Missing call count, counting chrY for everyone.\n"
671 " missing: Missing call count, excluding chrY for females.\n"
672 " The default is maybefid,maybesid,homref,homaltsnp,hetsnp,dipts,diptv,\n"
673 " dipnonsnpsymb,dipsingle,haprefwfemaley,hapaltwfemaley,missingwfemaley.\n"
674 " * The 'hetsnp', 'dipts'/'ts'/'diptv'/'tv', 'dipnonsnpsymb'/'nonsnpsymb',\n"
675 " 'symbolic', and 'nonsnp' columns count each ALT allele in a heterozygous\n"
676 " altx-alty call separately, since they can be of different subtypes.\n"
677 " (I.e. if they are of the same subtype, the corresponding count is\n"
678 " incremented by 2.) As a consequence, these columns are unaffected by\n"
679 " variant split/join.\n\n"
680 );
681 // todo: add cluster-stratification
682 HelpPrint("missing\0", &help_ctrl, 1,
683 " --missing ['zs'] [{sample-only | variant-only}]\n"
684 " ['scols='<column set descriptor>] ['vcols='<column set descriptor>]\n"
685 " Generate sample- and variant-based missing data reports (or just one report\n"
686 " if 'sample-only'/'variant-only' is specified).\n"
687 " Mixed MT hardcalls appear in the heterozygous haploid stats.\n"
688 " Supported column sets in the sample-based report are:\n"
689 " maybefid: FID, if that column was present in the input.\n"
690 " fid: Force FID column to be written even when absent in the input.\n"
691 " (IID is always present, and positioned here.)\n"
692 " maybesid: SID, if that column was present in the input.\n"
693 " sid: Force SID column to be written even when absent in the input.\n"
694 " misspheno1: First active phenotype missing (Y/N)? Always 'Y' if no\n"
695 " phenotypes are loaded.\n"
696 " missphenos: A Y/N column for each loaded phenotype. (Can be combined\n"
697 " with misspheno1 to force at least one such column.)\n"
698 " nmissdosage: Number of missing dosages.\n"
699 " nmiss: Number of missing hardcalls, not counting het haploids.\n"
700 " nmisshh: Number of missing hardcalls, counting het haploids.\n"
701 " hethap: Number of heterozygous haploid hardcalls.\n"
702 " nobs: Denominator (male count on chrY, otherwise total sample count).\n"
703 " fmissdosage: Missing dosage rate.\n"
704 " fmiss: Missing hardcall rate, not counting het haploids.\n"
705 " fmisshh: Missing hardcall rate, counting het haploids.\n"
706 " The default is maybefid,maybesid,missphenos,nmiss,nobs,fmiss.\n"
707 " Supported column sets in the variant-based report are:\n"
708 " chrom: Chromosome ID.\n"
709 " pos: Base-pair coordinate.\n"
710 " (ID is always present, and positioned here.)\n"
711 " ref: Reference allele.\n"
712 " alt1: Alternate allele 1.\n"
713 " alt: All alternate alleles, comma-separated.\n"
714 " maybeprovref: Reports whether REF allele is marked as known or\n"
715 " provisional, when at least one of the latter is present,\n"
716 " and the REF column is present.\n"
717 " provref: Force provref column even if all-'N'.\n"
718 " nmissdosage: Number of missing dosages.\n"
719 " nmiss: Number of missing hardcalls, not counting het haploids.\n"
720 " nmisshh: Number of missing hardcalls, counting het haploids.\n"
721 " hethap: Number of heterozygous haploid calls.\n"
722 " nobs: Number of potentially valid calls.\n"
723 " fmissdosage: Missing dosage rate.\n"
724 " fmiss: Missing hardcall rate, not counting het haploids.\n"
725 " fmisshh: Missing hardcall rate, counting het haploids.\n"
726 " fhethap: Heterozygous haploid rate.\n"
727 " The default is chrom,maybeprovref,nmiss,nobs,fmiss.\n\n"
728 );
729 HelpPrint("hardy\0", &help_ctrl, 1,
730 " --hardy ['zs'] ['midp'] ['log10'] ['redundant'] ['cols='<col set descriptor>]\n"
731 " Hardy-Weinberg exact test p-value report(s).\n"
732 " * By default, only founders are considered; change this with --nonfounders.\n"
733 " * chrX is now omitted from the main <output prefix>.hardy report. Instead,\n"
734 " (if present) it gets its own <output prefix>.hardy.x report based on the\n"
735 " method described in Graffelman J, Weir BS (2016) Hardy-Weinberg\n"
736 " equilibrium and the X chromosome.\n"
737 " * The 'log10' modifier causes p-values to be reported in -log10(p) form.\n"
738 " * For variants with j alleles where j>2, j separate 'biallelic' tests are\n"
739 " performed, each reported on its own line. However, biallelic variants\n"
740 " are normally reported on a single line, since the counts/frequencies\n"
741 " would be mirror-images and the p-values would be the same. You can add\n"
742 " the 'redundant' modifier to force biallelic variant results to be\n"
743 " reported on two lines for parsing convenience.\n"
744 " * There is currently no special handling of case/control phenotypes.\n"
745 " Supported column sets are:\n"
746 " chrom: Chromosome ID.\n"
747 " pos: Base-pair coordinate.\n"
748 " (ID is always present, and positioned here.)\n"
749 " ref: Reference allele.\n"
750 " alt1: Alternate allele 1.\n"
751 " alt: All alternate alleles, comma-separated.\n"
752 " maybeprovref: Reports whether REF allele is marked as known or\n"
753 " provisional, when at least one of the latter is present,\n"
754 " and the REF column is present.\n"
755 " provref: Force provref column even if all-'N'.\n"
756 " (A1 is always present, and positioned here.)\n"
757 " ax: Non-A1 allele(s), comma-separated.\n"
758 " gcounts: Hom-A1 count, total number of het-A1 calls, and total number of\n"
759 " nonmissing calls with no copies of A1. On chrX, these are\n"
760 " followed by male A1 and male non-A1 counts.\n"
761 " gcount1col: gcounts values in a single comma-separated column.\n"
762 " hetfreq: Observed and expected het-A1 frequencies.\n"
763 " sexaf: Female and male A1 observed allele frequencies (chrX only).\n"
764 " femalep: Female-only p/midp-value (chrX only).\n"
765 " p: Hardy-Weinberg equilibrium exact test p/midp-value (or -log10(p)).\n"
766 " The default is chrom,maybeprovref,ax,gcounts,hetfreq,sexaf,p.\n\n"
767 );
768 HelpPrint("het\0", &help_ctrl, 1,
769 " --het ['zs'] ['small-sample'] ['cols='<column set descriptor>]\n"
770 " Inbreeding coefficient report. Supports multiallelic variants.\n"
771 " * This function requires decent MAF estimates. If there are very few\n"
772 " samples in your immediate fileset, --read-freq is practically mandatory\n"
773 " since imputed MAFs are wildly inaccurate in that case.\n"
774 " * It's usually best to perform this calculation on a variant set in\n"
775 " approximate Hardy-Weinberg and linkage equilibrium.\n"
776 " * By default, --het omits the n/(n-1) multiplier in Nei's expected\n"
777 " homozygosity formula. The 'small-sample' modifier causes it to be\n"
778 " included, while forcing --het to use MAFs imputed from founders in the\n"
779 " immediate dataset.\n"
780 " Supported column sets are:\n"
781 " maybefid: FID, if that column was present in the input.\n"
782 " fid: Force FID column to be written even when absent in the input.\n"
783 " (IID is always present, and positioned here.)\n"
784 " maybesid: SID, if that column was present in the input.\n"
785 " sid: Force SID column to be written even when absent in the input.\n"
786 " hom: Observed and expected numbers of homozygous genotypes.\n"
787 " het: Observed and expected numbers of heterozygous genotypes.\n"
788 " nobs: Number of (nonmissing) genotype observations.\n"
789 " f: Method-of-moments F coefficient estimate.\n"
790 " The default is maybefid,maybesid,hom,nobs,f.\n\n"
791 );
792 HelpPrint("check-sex\0impute-sex\0update-sex\0sex-check\0", &help_ctrl, 1,
793 " --check-sex ['max-female-xf='<x>] ['min-male-xf='<y>]\n"
794 " ['max-female-ycount='<z>] ['min-male-ycount='<w>]\n"
795 " ['max-female-yrate='<v>] ['min-male-yrate='<u>]\n"
796 " ['cols='<column set descriptor>]\n"
797 " --impute-sex ['max-female-fadj='<x>] ['min-male-fadj='<y>]\n"
798 " ['max-female-ycount='<z>] ['min-male-ycount='<w>]\n"
799 " ['max-female-yrate='<v>] ['min-male-yrate='<u>]\n"
800 " ['cols='<column set descriptor>]\n"
801 " --check-sex compares sex assignments in the input dataset with those\n"
802 " imputed from chrX inbreeding coefficients and/or chrY valid genotype call\n"
803 " count/rate (heterozygous genotype calls are invalid on chrY).\n"
804 " Specifically:\n"
805 " * If max-female-xf= and/or min-male-xf= are specified, chrX is used if\n"
806 " present.\n"
807 " * If at least one of the ycount/yrate thresholds are specified, chrY is\n"
808 " used if present.\n"
809 " * If both chrX and chrY are usable, sex is only called if both conditions\n"
810 " are satisfied. Similarly, if both count and rate are specified for chrY,\n"
811 " the strictest condition must be satisfied.\n"
812 " * If no thresholds are specified at all, a warning is printed, and then\n"
813 " min-male-xf is set to 1 and max-female-yrate is set to 0. In this case,\n"
814 " unless you're just sanity-checking pre-cleaned data, you should look at\n"
815 " the distributions of xf and yrate in the .sexcheck output file, and then\n"
816 " rerun --check-sex with data-derived thresholds.\n"
817 " Other notes:\n"
818 " * Make sure that the chrX pseudo-autosomal region has been split off (with\n"
819 " e.g. --split-par) before using this.\n"
820 " * You also need decent MAF estimates (so, with very few samples in your\n"
821 " immediate fileset, use --read-freq), and it's best for your variants to\n"
822 " be in approximate Hardy-Weinberg and linkage equilibrium.\n"
823 " * For samples which barely fail the max-female-xf threshold, you may want\n"
824 " to check autosomal inbreeding coefficients (--het). When that is also\n"
825 " high, you're probably dealing with a highly-inbred female.\n"
826 " * Supported column sets in the .sexcheck output file are:\n"
827 " maybefid: FID, if that column was present in the input.\n"
828 " fid: Force FID column to be written even when absent in the input.\n"
829 " (IID is always present, and positioned here.)\n"
830 " maybesid: SID, if that column was present in the input.\n"
831 " sid: Force SID column to be written even when absent in the input.\n"
832 " pedsex: Sex code in input file.\n"
833 " (SNPSEX is always present, and positioned here.)\n"
834 " status: 'OK' on non-NA pedsex=snpsex, otherwise 'PROBLEM'.\n"
835 " xf: If chrX used, inbreeding coefficient estimated off chrX.\n"
836 " ycount: If chrY used, number of valid chrY genotypes.\n"
837 " yrate: If chrY used, chrY valid genotype rate.\n"
838 " yobs: If chrY used, number of chrY variants considered.\n"
839 " The default is maybefid,maybesid,pedsex,status,xf,yrate.\n"
840 " --impute-sex changes sex assignments to the imputed values, and is\n"
841 " otherwise identical to --check-sex. It must be used with\n"
842 " --make-[b]pgen/--make-bed/--export/--write-covar and no other commands.\n\n"
843 );
844 // possible todo: Patterson's adjacent-block jackknife tweak
845 // (https://reich.hms.harvard.edu/sites/reich.hms.harvard.edu/files/inline-files/jackcorr2.pdf )
846 HelpPrint("fst\0Fst\0", &help_ctrl, 1,
847 " --fst <categorical or binary phenotype name> ['method='<method name>]\n"
848 " ['blocksize='<jackknife block size>] ['cols='<column set descriptor>]\n"
849 " ['report-variants'] ['zs'] ['vcols='<column set descriptor>]\n"
850 " ['base='<pop. ID> | 'ids='<pop. ID> | 'file='<pop.-ID-pair file>]\n"
851 " [other population ID(s) for base=/ids=...]\n"
852 " Estimate Wright's Fst between pairs of populations.\n"
853 " * Two methods are supported:\n"
854 " * 'hudson': Bhatia G, Patterson N, Sankararaman S, Price AL (2013)\n"
855 " Estimating and interpreting F_{ST}: The impact of rare\n"
856 " variants. This is now the default.\n"
857 " * 'wc': Weir BS, Cockerham CC (1984) Estimating F-statistics for the\n"
858 " analysis of population structure.\n"
859 " In both cases, the final estimate is a ratio-of-averages.\n"
860 " * If chrX is present, its results are written to separate file(s) with \".x\"\n"
861 " in the extension when the Hudson method is used. (chrX is skipped under\n"
862 " the Weir-Cockerham method.)\n"
863 " * To get block-jackknife-based standard error estimates, provide a\n"
864 " blocksize= value.\n"
865 " * There is only one optional column set in the main summary:\n"
866 " (POP1 and POP2 are always present, and positioned here.)\n"
867 " nobs: Number of variants with valid Fst estimates.\n"
868 " (HUDSON_FST or WC_FST is always present, and positioned here.)\n"
869 " (SE is present if blocksize= specified, and positioned here.)\n"
870 " nobs is not included by default.\n"
871 " * You can request per-variant Fst estimates with the 'report-variants'\n"
872 " modifier; this generates a separate output file for each population pair.\n"
873 " Supported per-variant report column sets are:\n"
874 " chrom: Chromosome ID.\n"
875 " pos: Base-pair coordinate.\n"
876 " (ID is always present, and positioned here.)\n"
877 " ref: Reference allele.\n"
878 " alt: All alternate alleles, comma-separated.\n"
879 " maybeprovref: Reports whether REF allele is marked as known or\n"
880 " provisional, when at least one of the latter is present,\n"
881 " and the REF column is present.\n"
882 " provref: Force provref column even if all-'N'.\n"
883 " nobs: Number of (nonmissing) genotype observations across pop pair.\n"
884 " nallele: Number of nonmissing alleles.\n"
885 " fstfrac: Numerator and denominator of Fst estimate.\n"
886 " fst: Fst estimate.\n"
887 " The default is chrom,pos,maybeprovref,nobs,fst.\n"
888 " * By default, all pairs of populations are compared. If you only want to\n"
889 " compare some pairs, there are three ways to do this.\n"
890 " * base= specifies one base population to be compared with all others; or\n"
891 " if you specify more population ID(s) afterward, just the other\n"
892 " populations you've listed.\n"
893 " * ids= specifies an all-vs.-all comparison within the given set of\n"
894 " populations.\n"
895 " * file= specifies a file containing one population pair per line.\n"
896 " Note that 'base='/'ids='/'file=' must be positioned after all modifiers.\n\n"
897 );
898 HelpPrint("indep\0indep-pairwise\0indep-pairphase\0", &help_ctrl, 1,
899 " --indep-pairwise <window size>['kb'] [step size (variant ct)]\n"
900 " <unphased-hardcall-r^2 threshold>\n"
901 " --indep-pairphase <window size>['kb'] [step size (variant ct)]\n"
902 " <haplotype r^2 threshold>\n"
903 " Generate a list of variants in approximate linkage equilibrium.\n"
904 " * --indep-pairphase requires all genotypes to be phased, and performs a\n"
905 " haplotype- instead of genotype-based calculation.\n"
906 " * For multiallelic variants, major allele counts are used in the r^2\n"
907 " computation.\n"
908 " * With the 'kb' modifier, the window size is in kilobase instead of variant\n"
909 " count units. (Pre-'kb' space is optional, i.e.\n"
910 " \"--indep-pairwise 500 kb 0.5\" and \"--indep-pairwise 500kb 0.5\" have the\n"
911 " same effect.)\n"
912 " * The step size now defaults to 1 if it's unspecified, and *must* be 1 if\n"
913 " the window is in kilobase units.\n"
914 " * Note that you need to rerun PLINK using --extract or --exclude on the\n"
915 " .prune.in/.prune.out file to apply the list to another computation... and\n"
916 " as with other applications of --extract/--exclude, duplicate variant IDs\n"
917 " are a problem. --indep-pairwise now errors out when duplicate variant\n"
918 " IDs are present.\n\n"
919 );
920 HelpPrint("r-phased\0r-unphased\0r2-phased\0r2-unphased\0r\0r2\0", &help_ctrl, 1,
921 " --r[2]-[un]phased [{square | square0 | triangle | inter-chr}] ['yes-really']\n"
922 " [{zs | bin | bin4}] ['ref-based']\n"
923 " ['allow-ambiguous-allele'] ['cols='<column set descriptor>]\n"
924 " LD statistic reports.\n"
925 " --r2-phased computes the textbook haplotype-frequency-based r^2, and\n"
926 " corresponds to PLINK 1.9 --r2's behavior when the 'd', 'dprime', or\n"
927 " 'dprime-signed' modifier was present. --r2-unphased computes the simpler\n"
928 " r^2 squared-correlation between (unphased) dosage vectors, and corresponds\n"
929 " to how PLINK 1.x --r2 behaved without a D'-related modifier. You are now\n"
930 " required to explicitly specify which of these r^2 statistics you want.\n"
931 " --r-phased and --r-unphased report signed (and of course unsquared) values,\n"
932 " with positive sign when the two major (or, when 'ref-based' is specified,\n"
933 " REF) alleles are positively correlated with each other.\n"
934 " Dosages are used when present. (In the diploid case, an unphased dosage of\n"
935 " x is interpreted as P(0/0) = 1 - x, P(0/1) = x when x is in 0..1.)\n"
936 " Phase information is used when both variants are on the same chromosome.\n"
937 " By default, tabular output is written to <output prefix>.vcor.\n"
938 " * In this mode, the --ld-... flags filter the output. \"--ld-window-kb\n"
939 " 1000\" and \"--ld-window-r2 0.2\" are active unless explicitly overridden.\n"
940 " * To process inter-chromosomal as well as intra-chromosomal variant-pairs,\n"
941 " use the 'inter-chr' modifier.\n"
942 " * Supported column sets are:\n"
943 " chrom: Two chromosome ID columns.\n"
944 " pos: Two base-pair coordinate columns.\n"
945 " id: Two variant ID columns.\n"
946 " ref: Two reference-allele columns.\n"
947 " alt1: Two alternate-allele-1 columns.\n"
948 " alt: Two comma-separated-alternate-alleles columns.\n"
949 " maybeprovref: Reports whether REF alleles are marked as known or\n"
950 " provisional, when at least one of the latter is present,\n"
951 " and the REF column-set is present.\n"
952 " provref: Force provref columns even if all-'N'.\n"
953 " maj: Two major-allele columns.\n"
954 " nonmaj: Two comma-separated-nonmajor-alleles columns.\n"
955 " freq: Two (1 - <major allele frequency>) columns.\n"
956 " (r or r^2 is always present, and positioned here.)\n"
957 " d: Coefficient of linkage disequilibrium (phased only).\n"
958 " dprime: Lewontin's D' (phased only).\n"
959 " dprimeabs: Absolute value of Lewontin's D' (phased only).\n"
960 " The default is chrom,pos,id,maybeprovref for --r2-[un]phased; maj is also\n"
961 " included for --r-[un]phased.\n"
962 " * By default, when multiallelic variants are present, --r2-[un]phased will\n"
963 " error out when the 'maj' and 'nonmaj' (or, if 'ref-based' is specified,\n"
964 " 'ref' and 'alt') column-sets are absent. Similarly, --r-[un]phased will\n"
965 " error out in these cases regardless of whether multiallelic variants are\n"
966 " present. The 'allow-ambiguous-allele' modifier overrides this behavior.\n"
967 " To request all-pairs matrix output instead, specify a matrix shape\n"
968 " ('square', 'square0', 'triangle') and/or encoding ('bin', 'bin4') modifier.\n"
969 " * As with --make-rel and similar commands, if a shape is specified without\n"
970 " an encoding, encoding defaults to text; and if an encoding is specified\n"
971 " without a shape, shape defaults to square.\n"
972 " * Since there is no header line specifying phased vs. unphased, r vs. r^2,\n"
973 " or text vs. binary vs. Zstd-compressed-text, this information is embedded\n"
974 " in the main matrix filename's extension.\n"
975 " \".[un]phased.vcor{1,2}{|.bin|.zst}\" summarizes the twelve possibilities.\n"
976 " * Since the resulting file can easily be huge, you're required to add the\n"
977 " 'yes-really' modifier when requesting an unfiltered, non-distributed\n"
978 " all-pairs computation on more than 400k variants.\n"
979 " With either output type, the computation can be subdivided with --parallel.\n\n"
980 );
981 HelpPrint("ld\0", &help_ctrl, 1,
982 " --ld <variant ID> <variant ID> ['hwe-midp']\n"
983 " This displays diplotype frequencies, haplotype-based r^2, and D' for a\n"
984 " single pair of variants. (The latter two values are calculated in the same\n"
985 " manner as they are for --r2-phased.)\n"
986 " When there is at least one sample with unphased het calls for both\n"
987 " variants, diplotype frequencies are estimated using the Hill equation. If\n"
988 " there are multiple biologically possible local maxima, all are displayed,\n"
989 " along with HWE exact test statistics.\n\n"
990 );
991 HelpPrint("sample-diff\0sdiff\0", &help_ctrl, 1,
992 " --sample-diff ['id-delim='<char>] ['dosage' | 'dosage='<tolerance>]\n"
993 " ['include-missing'] [{pairwise | counts-only}]\n"
994 " ['fname-id-delim='<c>] ['zs'] ['cols='<column set descriptor>]\n"
995 " ['counts-cols='<column set descriptor>]\n"
996 " {base= | ids=}<sample ID> <other sample ID(s)...>\n"
997 " --sample-diff ['id-delim='<char>] ['dosage' | 'dosage='<tolerance>]\n"
998 " ['include-missing'] [{pairwise | counts-only}]\n"
999 " ['fname-id-delim='<c>] ['zs'] ['cols='<column set descriptor>]\n"
1000 " ['counts-cols='<column set descriptor>] file=<ID-pair file>\n"
1001 " (alias: --sdiff)\n"
1002 " Report discordances and discordance-counts between pairs of samples. If\n"
1003 " chrX or chrY is present, sex must be defined and consistent.\n"
1004 " * There are three ways to specify which sample pairs to compare. To\n"
1005 " compare a single baseline sample against some others, start the\n"
1006 " (space-delimited) sample ID list with 'base='. To perform an all-vs.-all\n"
1007 " comparison, start it with 'ids=' instead. To compare sample pairs listed\n"
1008 " in a file, use 'file='.\n"
1009 " Note that 'base='/'ids='/'file=' must be positioned after all modifiers.\n"
1010 " * Sample IDs are interpreted as if they were in a VCF header line, with\n"
1011 " 'id-delim=' having the usual effect.\n"
1012 " * By default, comparisons are based on hardcalls. Use 'dosage' to compare\n"
1013 " dosages instead; you can combine this with a tolerance in [0, 0.5).\n"
1014 " * By default, if one genotype is missing and the other isn't, that doesn't\n"
1015 " count as a difference; this can be changed with 'include-missing'.\n"
1016 " * By default, a single main report is written to\n"
1017 " <output prefix>[.<base ID>].sdiff. To write separate pairwise\n"
1018 " <output prefix>.<ID1>.<ID2>.sdiff reports for each compared ID pair, add\n"
1019 " the 'pairwise' modifier. To omit the main report, add the 'counts-only'\n"
1020 " modifier. (Note that, if you're only interested in nonmissing autosomal\n"
1021 " biallelic hardcalls, --make-king-table provides a more efficient way to\n"
1022 " compute just counts.)\n"
1023 " * By default, if an output filename has a multipart sample ID, the parts\n"
1024 " will be delimited by '_'; use 'fname-id-delim=' to change this.\n"
1025 " Supported main-report column sets are:\n"
1026 " chrom: Chromosome ID.\n"
1027 " pos: Base-pair coordinate.\n"
1028 " (Variant ID is always present, and positioned here.)\n"
1029 " ref: Reference allele.\n"
1030 " alt: All alternate alleles, comma-separated.\n"
1031 " maybeprovref: Reports whether REF allele is marked as known or\n"
1032 " provisional, when at least one of the latter is present,\n"
1033 " and the REF column is present.\n"
1034 " provref: Force provref column even if all-'N'.\n"
1035 " maybefid: FID1/FID2, if that column was in the input. Requires 'id'.\n"
1036 " fid: Force FID1/FID2 even when FID was absent in the input.\n"
1037 " id: IID1/IID2.\n"
1038 " maybesid: SID1/SID2, if that column was in the input. Requires 'id'.\n"
1039 " sid: Force SID1/SID2 even when SID was absent in the input.\n"
1040 " geno: Unphased GT or DS for the two samples.\n"
1041 " The default is usually chrom,pos,ref,alt,maybeprovref,maybefid,id,maybesid,\n"
1042 " geno; the sample IDs are removed from the default in 'pairwise' mode.\n"
1043 " Supported discordance-count-summary column sets are:\n"
1044 " maybefid: FID1/FID2, if that column was in the input.\n"
1045 " fid: Force FID1/FID2 even when FID was absent in the input.\n"
1046 " (IID1/IID2 are always present.)\n"
1047 " maybesid: SID1/SID2, if that column was in the input.\n"
1048 " sid: Force SID1/SID2 even when SID was absent in the input.\n"
1049 " nobs: Number of variants considered. This includes variants where one or\n"
1050 " both variants are missing iff 'include-missing' was specified.\n"
1051 " nobsibs: ibs0+ibs1+ibs2.\n"
1052 " ibs0: Number of diploid variants with no common hardcall alleles.\n"
1053 " ibs1: Number of diploid variants with exactly 1 common hardcall allele.\n"
1054 " ibs2: Number of diploid variants with both hardcall alleles matching.\n"
1055 " halfmiss: Number of variants with exactly 1 missing genotype/dosage.\n"
1056 " Ignored without 'include-missing'.\n"
1057 " diff: Total number of differences.\n"
1058 " The default is maybefid,maybesid,nobs,halfmiss,diff.\n\n"
1059 );
1060 // for kinship estimation, LD pruning isn't really advisable (if more speed
1061 // is needed, the humble --bp-space may lead to a better approximation?
1062 // and in practice speed doesn't seem to be an issue any more with
1063 // --make-king.
1064 //
1065 // For multiallelic variants, major allele counts are theoretically
1066 // slightly more informative than REF allele counts, but the advantage is
1067 // far too small to be worth losing allele-frequency-independence.
1068 HelpPrint("make-king\0make-king-table\0", &help_ctrl, 0,
1069 " --make-king [{square | square0 | triangle}] [{zs | bin | bin4}]\n"
1070 " KING-robust kinship estimator, described by Manichaikul A, Mychaleckyj JC,\n"
1071 " Rich SS, Daly K, Sale M, Chen WM (2010) Robust relationship inference in\n"
1072 " genome-wide association studies. By default, this writes a\n"
1073 " lower-triangular tab-delimited table of kinship coefficients to\n"
1074 " <output prefix>.king, and a list of the corresponding sample IDs to\n"
1075 " <output prefix>.king.id. The first row of the .king file contains a single\n"
1076 " <genome 1-genome 2> kinship coefficient, the second row has the\n"
1077 " <genome 1-genome 3> and <genome 2-genome 3> kinship values in that order,\n"
1078 " etc.\n"
1079 " * Only autosomes are currently considered.\n"
1080 " * Pedigree information is currently ignored; the between-family estimator\n"
1081 " is used for all pairs.\n"
1082 " * For multiallelic variants, REF allele counts are used.\n"
1083 " * If the 'square' or 'square0' modifier is present, a square matrix is\n"
1084 " written instead; 'square0' fills the upper right triangle with zeroes.\n"
1085 " * If the 'zs' modifier is present, the .king file is Zstd-compressed.\n"
1086 " * If the 'bin' modifier is present, a binary (square) matrix of\n"
1087 " double-precision floating point values, suitable for loading from R, is\n"
1088 " instead written to <output prefix>.king.bin. ('bin4' specifies\n"
1089 " single-precision numbers instead.) This can be combined with 'square0'\n"
1090 " if you still want the upper right zeroed out, or 'triangle' if you don't\n"
1091 " want to pad the upper right at all.\n"
1092 " * The computation can be subdivided with --parallel.\n"
1093 );
1094 HelpPrint("make-king\0make-king-table\0genome\0", &help_ctrl, 1,
1095 " --make-king-table ['zs'] ['counts'] ['rel-check'] ['cols='<col set descrip.>]\n"
1096 " Similar to --make-king, except results are reported in KING's original\n"
1097 " .kin0 text table format (with minor changes, e.g. row order is more\n"
1098 " friendly to incremental addition of samples), --king-table-filter can be\n"
1099 " used to restrict the report to high kinship values, and the 'rel-check'\n"
1100 " modifier can be used to restrict to same-FID pairs.\n"
1101 " Supported column sets are:\n"
1102 " maybefid: FID1/FID2, if that column was in the input. Requires 'id'.\n"
1103 " fid: Force FID1/FID2 even when FID was absent in the input.\n"
1104 " id: IID1/IID2.\n"
1105 " maybesid: SID1/SID2, if that column was in the input. Requires 'id'.\n"
1106 " sid: Force SID1/SID2 even when SID was absent in the input.\n"
1107 " nsnp: Number of variants considered (autosomal, neither call missing).\n"
1108 " hethet: Proportion/count of considered call pairs which are het-het.\n"
1109 " ibs0: Proportion/count of considered call pairs which are opposite homs.\n"
1110 " ibs1: HET1_HOM2 and HET2_HOM1 proportions/counts.\n"
1111 " kinship: KING-robust between-family kinship estimator.\n"
1112 " The default is maybefid,id,maybesid,nsnp,hethet,ibs0,kinship.\n"
1113 " hethet/ibs0/ibs1 values are proportions unless the 'counts' modifier is\n"
1114 " present. If id is omitted, a .kin0.id file is also written.\n\n"
1115 );
1116 HelpPrint("make-rel\0make-grm\0make-grm-bin\0make-grm-list\0make-grm-gz\0", &help_ctrl, 1,
1117 " --make-rel ['cov'] ['meanimpute'] [{square | square0 | triangle}]\n"
1118 " [{zs | bin | bin4}]\n"
1119 " Write a lower-triangular variance-standardized relationship matrix to\n"
1120 " <output prefix>.rel, and corresponding IDs to <output prefix>.rel.id.\n"
1121 " * This computation assumes that variants do not have very low MAF, or\n"
1122 " deviate greatly from Hardy-Weinberg equilibrium.\n"
1123 // depending on what your original variant set looks like, you can occasionally
1124 // get a better variant-weighting without LD-pruning, but it's the right
1125 // default recommendation
1126 " * Also, it's usually best to perform this calculation on a variant set in\n"
1127 " approximate linkage equilibrium.\n"
1128 " * The 'cov' modifier replaces the variance-standardization step with basic\n"
1129 " mean-centering, causing a covariance matrix to be calculated instead.\n"
1130 " * The computation can be subdivided with --parallel.\n"
1131 " --make-grm-list ['cov'] ['meanimpute'] ['zs'] [{id-header | iid-only}]\n"
1132 " --make-grm-bin ['cov'] ['meanimpute'] [{id-header | iid-only}]\n"
1133 " --make-grm-list causes the relationships to be written to GCTA's original\n"
1134 " list format, which describes one pair per line, while --make-grm-bin writes\n"
1135 " them in GCTA 1.1+'s single-precision triangular binary format. Note that\n"
1136 " these formats explicitly report the number of valid observations (where\n"
1137 " neither sample has a missing call) for each pair, which is useful input for\n"
1138 " some scripts.\n\n"
1139 );
1140 #ifndef NOLAPACK
1141 // GRM, PCA, etc. based on major vs. nonmajor alleles
1142 // possible todo: have an 'approx2' mode which implements the flashpca 2.0
1143 // algorithm, which does not require memory quadratic in the # of PCs.
1144 // but probably not, don't see any real application for that many PCs?
1145 HelpPrint("pca\0", &help_ctrl, 1,
1146 " --pca [count] [{approx | meanimpute}] ['scols='<col set descriptor>]\n"
1147 " --pca [{allele-wts | biallelic-var-wts}] [count] [{approx | meanimpute}]\n"
1148 " ['vzs'] ['scols='<col set descriptor>] ['vcols='<col set descriptor>]\n"
1149 " Extracts top principal components from the variance-standardized\n"
1150 " relationship matrix.\n"
1151 " * It is usually best to perform this calculation on a variant set in\n"
1152 " approximate linkage equilibrium, with no very-low-MAF variants.\n"
1153 " * By default, 10 PCs are extracted; you can adjust this by passing a\n"
1154 " numeric argument. (Note that 10 is lower than the PLINK 1.9 default of\n"
1155 " 20; this is due to the randomized algorithm's memory footprint growing\n"
1156 " quadratically w.r.t. the PC count.)\n"
1157 " * The 'approx' modifier causes the standard deterministic computation to be\n"
1158 " replaced with the randomized algorithm originally implemented for\n"
1159 " Galinsky KJ, Bhatia G, Loh PR, Georgiev S, Mukherjee S, Patterson NJ,\n"
1160 " Price AL (2016) Fast Principal-Component Analysis Reveals Convergent\n"
1161 " Evolution of ADH1B in Europe and East Asia. This can be a good idea when\n"
1162 " you have >5k samples, and is almost required with >50k.\n"
1163 " * The randomized algorithm always uses mean imputation for missing genotype\n"
1164 " calls. For comparison purposes, you can use the 'meanimpute' modifier to\n"
1165 " request this behavior for the standard computation.\n"
1166 " * 'scols=' can be used to customize how sample IDs appear in the .eigenvec\n"
1167 " file. (maybefid, fid, maybesid, and sid supported; default is\n"
1168 " maybefid,maybesid.)\n"
1169 " * The 'allele-wts' modifier requests an additional one-line-per-allele\n"
1170 " .eigenvec.allele file with PCs expressed as allele weights instead of\n"
1171 " sample weights. When it's present, 'vzs' causes the .eigenvec.allele\n"
1172 " file to be Zstd-compressed.\n"
1173 " 'vcols=' can be used to customize the report columns; supported column\n"
1174 " sets are:\n"
1175 " chrom: Chromosome ID.\n"
1176 " pos: Base-pair coordinate.\n"
1177 " (ID is always present, and positioned here.)\n"
1178 " ref: Reference allele.\n"
1179 " alt1: Alternate allele 1.\n"
1180 " alt: All alternate alleles, comma-separated.\n"
1181 " maybeprovref: Reports whether REF allele is marked as known or\n"
1182 " provisional, when at least one of the latter is present,\n"
1183 " and the REF column is present.\n"
1184 " provref: Force provref column even if all-'N'.\n"
1185 " (A1 is always present, and positioned here.)\n"
1186 " ax: Non-A1 alleles, comma-separated.\n"
1187 " (PCs are always present, and positioned here.)\n"
1188 " Default is chrom,ref,alt,maybeprovref.\n"
1189 " * For datasets with no multiallelic variants, the 'biallelic-var-wts'\n"
1190 " modifier requests the old .eigenvec.var format, which only reports\n"
1191 " weights for major alleles. (These weights are 2x the corresponding\n"
1192 " .eigenvec.allele weights.) Supported column sets are:\n"
1193 " chrom: Chromosome ID.\n"
1194 " pos: Base-pair coordinate.\n"
1195 " (ID is always present, and positioned here.)\n"
1196 " ref: Reference allele.\n"
1197 " alt1: Alternate allele 1.\n"
1198 " alt: All alternate alleles, comma-separated.\n"
1199 " maybeprovref: Reports whether REF allele is marked as known or\n"
1200 " provisional, when at least one of the latter is present,\n"
1201 " and the REF column is present.\n"
1202 " provref: Force provref column even if all-'N'.\n"
1203 " maj: Major allele.\n"
1204 " nonmaj: Minor allele.\n"
1205 " (PCs are always present, and positioned here. Signs are w.r.t. the\n"
1206 " major, not necessarily reference, allele.)\n"
1207 " Default is chrom,maybeprovref,maj,nonmaj.\n\n"
1208 );
1209 #endif
1210 HelpPrint("king-cutoff\0king-cutoff-table\0make-king\0make-king-table\0rel-cutoff\0grm-cutoff\0", &help_ctrl, 1,
1211 " --king-cutoff [.king.bin + .king.id fileset prefix] <threshold>\n"
1212 " --king-cutoff-table <.kin0 filename> <threshold>\n"
1213 " Exclude one member of each pair of samples with KING-robust kinship greater\n"
1214 " than the given threshold. Remaining/excluded sample IDs are written to\n"
1215 " <output prefix>.king.cutoff.in.id + .king.cutoff.out.id.\n"
1216 " * If a .king.bin file is provided to --king-cutoff, it must be triangular\n"
1217 " (either precision is ok).\n"
1218 " * The .kin0 file provided to --king-cutoff-table must contain sample ID\n"
1219 " columns.\n\n"
1220 );
1221 HelpPrint("write-covar\0with-phenotype\0", &help_ctrl, 1,
1222 " --write-covar ['cols='<column set descriptor>]\n"
1223 " If covariates are defined, an updated version (with all filters applied) is\n"
1224 " automatically written to <output prefix>.cov whenever --make-pgen,\n"
1225 " --make-just-psam, --export, or a similar command is present. However, if\n"
1226 " you do not wish to simultaneously generate a new sample file, you can use\n"
1227 " --write-covar to just produce a pruned covariate file.\n"
1228 " Supported column sets are:\n"
1229 " maybefid: FID, if that column was in the input.\n"
1230 " fid: Force FID column to be written even when absent in the input.\n"
1231 " maybesid: SID, if that column was in the input.\n"
1232 " sid: Force SID column to be written even when absent in the input.\n"
1233 " maybeparents: Father/mother IIDs ('0' = missing), if columns in input.\n"
1234 " parents: Force PAT/MAT columns to be written even when absent in input.\n"
1235 " sex: '1' = male, '2' = female, 'NA' = missing.\n"
1236 " pheno1: First active phenotype. If none, all column entries are set to\n"
1237 " the --output-missing-phenotype string.\n"
1238 " phenos: All active phenotypes, if any. (Can be combined with pheno1 to\n"
1239 " force at least one phenotype column to be written.)\n"
1240 " (Covariates are always present, and positioned here.)\n"
1241 " The default is maybefid,maybesid.\n\n"
1242 );
1243 HelpPrint("pmerge\0pmerge-list\0merge\0merge-list\0bmerge\0", &help_ctrl, 1,
1244 " --pmerge <.pgen/.bed filename> <.pvar/.bim> <.psam/.fam>\n"
1245 " --pmerge <.pgen + .pvar + .psam fileset prefix> ['vzs']\n"
1246 " Merge the given fileset with the initially loaded fileset, writing the\n"
1247 " result to <output prefix>.pgen + .pvar + .psam.\n"
1248 " --pmerge-list <filename> [mode]\n"
1249 " Merge all filesets named in the text file. Also merge with the initially\n"
1250 " loaded fileset if one was specified.\n"
1251 " When a line in the text file contains three entries, they are interpreted\n"
1252 " as full filenames for a binary fileset (.pgen/.bed, then .pvar/.bim, then\n"
1253 " .psam/.fam). If it contains exactly one entry, its interpretation depends\n"
1254 " on the mode:\n"
1255 " * 'bfile': Prefix for .bed + .bim + .fam fileset.\n"
1256 " * 'bpfile': Prefix for .pgen + .bim + .fam fileset.\n"
1257 " * 'pfile' (default): Prefix for .pgen + .pvar + .psam fileset.\n"
1258 " * 'pfile-vzs': Prefix for .pgen + .pvar.zst + .psam fileset.\n"
1259 " For both --pmerge and --pmerge-list:\n"
1260 " * All input filesets must be sorted by position, and have the same\n"
1261 " chromosome order. (When this isn't true, use --make-pgen + --sort-vars\n"
1262 " on each fileset first.)\n"
1263 " * Variants are only merged if their IDs AND positions match. (This is a\n"
1264 " change from PLINK 1.x.)\n\n"
1265 );
1266 HelpPrint("pgen-diff\0merge-mode\0", &help_ctrl, 1,
1267 " --pgen-diff <.pgen/.bed filename> <.pvar/.bim> <.psam/.fam>\n"
1268 " ['include-missing'] ['zs'] ['dosage' | 'dosage='<tolerance>]\n"
1269 " ['cols='<column set descriptor>]\n"
1270 " --pgen-diff <.pgen + .pvar + .psam prefix> ['vzs'] ['include-missing'] ['zs']\n"
1271 " ['dosage' | 'dosage='<tolerance>] ['cols='<col set descriptor>]\n"
1272 " Report unphased genotype/dosage differences in the intersection of two\n"
1273 " filesets. (Sample and variant filters are also applied.)\n"
1274 " * If chrX or chrY is present, sex must be defined and consistent.\n"
1275 " * Variants are only compared if their IDs AND positions match. An error\n"
1276 " is reported if any such match is not unique.\n"
1277 " * By default, comparisons are based on hardcalls. Use 'dosage' to compare\n"
1278 " dosages instead; you can combine this with a tolerance in [0, 0.5).\n"
1279 " * By default, if one genotype is missing and the other isn't, that doesn't\n"
1280 " count as a difference; this can be changed with 'include-missing'.\n"
1281 " Supported column sets are:\n"
1282 " chrom: Chromosome ID.\n"
1283 " pos: Base-pair coordinate.\n"
1284 " id: Variant ID.\n"
1285 " ref: Reference allele.\n"
1286 " alt: All alternate alleles across both filesets, comma-separated.\n"
1287 " maybeprovref: Reports whether REF allele is marked as known or\n"
1288 " provisional, when at least one of the latter is present,\n"
1289 " and the REF column is present.\n"
1290 " provref: Force provref column even if all-'N'.\n"
1291 " maybefid: FID, if that column was present in the input.\n"
1292 " fid: Force FID column to be written even when absent in the input.\n"
1293 " (IID is always present, and positioned here.)\n"
1294 " maybesid: SID, if that column was present in the input.\n"
1295 " sid: Force SID column to be written even when absent in the input.\n"
1296 " geno: Unphased GT or DS.\n"
1297 " The default is id,maybeprovref,maybefid,maybesid,geno.\n\n"
1298 );
1299 HelpPrint("write-samples\0write-snplist\0", &help_ctrl, 1,
1300 " --write-samples\n"
1301 " Report IDs of all samples which pass your filters/inclusion thresholds.\n\n"
1302 );
1303 HelpPrint("write-snplist\0", &help_ctrl, 1,
1304 " --write-snplist ['zs'] ['allow-dups']\n"
1305 " List all variants which pass your filters/inclusion thresholds. Unless the\n"
1306 " 'allow-dups' modifier is provided, this now errors out when duplicate\n"
1307 " variant ID(s) remain.\n\n"
1308 );
1309 HelpPrint("glm\0linear\0logistic\0assoc\0", &help_ctrl, 1,
1310 " --glm ['zs'] ['omit-ref'] [{sex | no-x-sex}] ['log10'] ['pheno-ids']\n"
1311 " [{genotypic | hethom | dominant | recessive | hetonly}] ['interaction']\n"
1312 " ['hide-covar'] ['skip-invalid-pheno'] ['allow-no-covars']\n"
1313 " ['qt-residualize'] [{intercept | cc-residualize | firth-residualize}]\n"
1314 " ['single-prec-cc'] [{no-firth | firth-fallback | firth}]\n"
1315 " ['cols='<col set desc>] ['local-covar='<file>] ['local-psam='<file>]\n"
1316 " ['local-pos-cols='<key col #s> | 'local-pvar='<file>] ['local-haps']\n"
1317 " ['local-omit-last' | 'local-cats[0]='<category ct>]\n"
1318 // " ['perm' | 'mperm='<value>] ['perm-count']\n"
1319 " Basic association analysis on quantitative and/or case/control phenotypes.\n"
1320 " For each variant, a linear (for quantitative traits) or logistic (for\n"
1321 " case/control) regression is run with the phenotype as the dependent\n"
1322 " variable, and nonmajor allele dosage(s) and a constant-1 column as\n"
1323 " predictors.\n"
1324 " * There is usually an additive effect line for every nonmajor allele, and\n"
1325 " no such line for the major allele. To omit REF alleles instead of major\n"
1326 " alleles, add the 'omit-ref' modifier. (When performing interaction\n"
1327 " testing, this tends to cause the multicollinearity check to fail for\n"
1328 " low-ref-frequency variants.)\n"
1329 " * By default, sex (male = 1, female = 2; note that this is a change from\n"
1330 " PLINK 1.x) is automatically added as a predictor for X chromosome\n"
1331 " variants, and no others. The 'sex' modifier causes it to be added\n"
1332 " everywhere (except chrY), while 'no-x-sex' excludes it entirely.\n"
1333 " * The 'log10' modifier causes p-values to be reported in -log10(p) form.\n"
1334 " * 'pheno-ids' causes the samples used in each set of regressions to be\n"
1335 " written to an .id file. (When the samples differ on chrX or chrY, .x.id\n"
1336 " and/or .y.id files are also written.)\n"
1337 " * The 'genotypic' modifier adds an additive effect/dominance deviation 2df\n"
1338 " joint test (0-2 and 0..1..0 coding), while 'hethom' uses 0..0..1 and\n"
1339 " 0..1..0 coding instead.\n"
1340 /*
1341 " If permutation is also requested, these\n"
1342 " modifiers cause permutation to be based on the joint test.\n"
1343 */
1344 " * 'dominant' and 'recessive' specify a model assuming full dominance or\n"
1345 " recessiveness, respectively, for the ref allele. I.e. the genotype\n"
1346 " column is recoded as 0..1..1 or 0..0..1, respectively.\n"
1347 " * 'hetonly' replaces the genotype column with a dominance-deviation column.\n"
1348 " * 'interaction' adds genotype x covariate interactions to the model. Note\n"
1349 " that this tends to produce 'NA' results (due to the multicollinearity\n"
1350 " check) when the reference allele is 'wrong'; --maj-ref can be used to\n"
1351 " enable analysis of those variants.\n"
1352 /*
1353 " This cannot be combined with the usual permutation tests; use --tests to\n"
1354 " define the permutation test statistic instead.\n"
1355 */
1356 " * Additional predictors can be added with --covar. By default, association\n"
1357 " statistics are reported for all nonconstant predictors; 'hide-covar'\n"
1358 " suppresses covariate-only results, while 'intercept' causes intercepts\n"
1359 " to be reported.\n"
1360 " Since running --glm without at least e.g. principal component covariates\n"
1361 " is usually an analytical mistake, the 'allow-no-covars' modifier is now\n"
1362 " required when you're intentionally running --glm without a covariate\n"
1363 " file.\n"
1364 " * By default, if the current phenotype and covariates are such that every\n"
1365 " regression on a chromosome will fail, PLINK 2 errors out. To just skip\n"
1366 " the phenotype or chromosome instead, add the 'skip-invalid-pheno'\n"
1367 " modifier.\n"
1368 " * There are now three regression modes for case/control phenotypes:\n"
1369 " * 'no-firth' requests PLINK 1.x's behavior, where a NA result is reported\n"
1370 " when basic logistic regression fails to converge.\n"
1371 " * 'firth-fallback' requests logistic regression, followed by Firth\n"
1372 " regression whenever the logistic regression fails to converge. This is\n"
1373 " now the default.\n"
1374 " * 'firth' requests Firth regression all the time.\n"
1375 " * To trade off some accuracy for speed:\n"
1376 " * You can use the 'single-prec-cc' modifier to request use of\n"
1377 " single-precision instead of double-precision floating-point numbers\n"
1378 " during logistic and Firth regression.\n"
1379 " * You can use the 'firth-residualize' or 'cc-residualize' modifier, which\n"
1380 " implements the shortcut described in Mbatchou J et al. (2021)\n"
1381 " Computationally efficient whole genome regression for quantitative and\n"
1382 " binary traits. Similarly, you can use 'qt-residualize' to regress out\n"
1383 " covariates upfront for quantitative traits. (These must be used with\n"
1384 " 'hide-covar', and disable some other --glm features.)\n"
1385 " * To add covariates which are not constant across all variants, add the\n"
1386 " 'local-covar=' and 'local-psam=' modifiers, use full filenames for each,\n"
1387 " and use either 'local-pvar=' or 'local-pos-cols=' to provide variant ID\n"
1388 " or position information.\n"
1389 " Normally, the local-covar file should have c * n real-valued columns,\n"" where the first c columns correspond to the first sample in the\n"
1390 " local-psam file, columns (c+1) to 2c correspond to the second sample,\n"
1391 " etc.; and the mth line corresponds to the mth nonheader line of the\n"
1392 " local-pvar file when there is one. (Variants outside of the local-pvar\n"
1393 " file are excluded from the regression.) The local covariates are\n"
1394 " assigned the names LOCAL1, LOCAL2, etc.; to exclude the last local\n"
1395 " covariate from the regression (necessary if they are e.g. local ancestry\n"
1396 " coefficients which sum to 1), add 'local-omit-last'.\n"
1397 " Alternatively, with 'local-cats='<k>, the local-covar file is expected to\n"
1398 " have n columns with integer-valued entries in [1, k]. (This range is\n"
1399 " [0, k-1] with 'local-cats0='.) These category assignments are expanded\n"
1400 " into (k-1) local covariates in the usual manner.\n"
1401 " When position information is in the local-covar file, this should be\n"
1402 " indicated by 'local-pos-cols='<number of header rows>,<chrom col #>,<pos\n"
1403 " start col #>,<first covariate col #>.\n"
1404 " 'local-haps' indicates that there's one column or column-group per\n"
1405 " haplotype instead of per sample; they are averaged by --glm.\n"
1406 /*
1407 " * 'perm' normally causes an adaptive permutation test to be performed on\n"
1408 " the main effect, while 'mperm='<value> starts a max(T) permutation test.\n"
1409 " * 'perm-count' causes the permutation test report to include counts instead\n"
1410 " of frequencies.\n"
1411 */
1412 // May want to change or leave out set-based test; punt for now.
1413 " The main report supports the following column sets:\n"
1414 " chrom: Chromosome ID.\n"
1415 " pos: Base-pair coordinate.\n"
1416 " (ID is always present, and positioned here.)\n"
1417 " ref: Reference allele.\n"
1418 " alt1: Alternate allele 1.\n"
1419 " alt: All alternate alleles, comma-separated.\n"
1420 " maybeprovref: Reports whether REF allele is marked as known or\n"
1421 " provisional, when at least one of the latter is present,\n"
1422 " and the REF column is present.\n"
1423 " provref: Force provref column even if all-'N'.\n"
1424 " (A1 is always present, and positioned here. For multiallelic variants,\n"
1425 " this column may contain multiple comma-separated alleles when the result\n"
1426 " doesn't depend on which allele is A1.)\n"
1427 " omitted: Omitted allele. This will be added to the default column set in\n"
1428 " the future.\n"
1429 " ax: Non-A1 alleles, comma-separated. Deprecated (use 'omitted' instead).\n"
1430 " a1count: A1 allele count (can be decimal with dosage data).\n"
1431 " totallele: Allele observation count (can be higher than --freq value, due\n"
1432 " to inclusion of het haploids and chrX model).\n"
1433 " a1countcc: A1 count in cases, then controls (case/control only).\n"
1434 " totallelecc: Case and control allele observation counts.\n"
1435 " gcountcc: Genotype hardcall counts (neither-A1, het-A1, A1-A1) in cases,\n"
1436 " then controls (case/control only).\n"
1437 " a1freq: A1 allele frequency. This will be added to the default column\n"
1438 " set in the future.\n"
1439 " a1freqcc: A1 frequency in cases, then controls (case/control only).\n"
1440 " machr2: Unphased MaCH imputation quality (frequently labeled 'INFO').\n"
1441 " firth: Reports whether Firth regression was used (firth-fallback only).\n"
1442 " test: Test identifier. (Required unless only one test is run.)\n"
1443 " nobs: Number of samples in the regression.\n"
1444 " beta: Regression coefficient (for A1 if additive test).\n"
1445 " orbeta: Odds ratio for case/control, beta for quantitative traits.\n"
1446 " (Ignored if 'beta' column set included.)\n"
1447 " se: Standard error of beta.\n"
1448 " ci: Bounds of symmetric approximate confidence interval (requires --ci).\n"
1449 " tz: T-statistic for linear regression, Wald Z-score for logistic/Firth.\n"
1450 " p: Asymptotic p-value (or -log10(p)) for T/Z-statistic.\n"
1451 " err: Error code for NA results.\n"
1452 " The default is chrom,pos,ref,alt,provref,omitted,a1freq,firth,test,nobs,\n"
1453 " orbeta,se,ci,tz,p,err.\n\n"
1454 );
1455 HelpPrint("gwas-ssf\0glm\0linear\0logistic\0assoc\0", &help_ctrl, 1,
1456 " --gwas-ssf ['zs'] ['delete-orig-glm'] ['a1freq-lower-limit='<bound>]\n"
1457 " ['rsid='<mode>] ['file='<filename>] ['file-list='<filename>]\n"
1458 " [{real-ref-alleles | allow-ambiguous-indels}]\n"
1459 " Reformat PLINK 2 association test results as GWAS-SSF, for the GWAS Catalog\n"
1460 " (https://www.ebi.ac.uk/gwas/ ). Output files have '.ssf.tsv' appended\n"
1461 " to the original filenames.\n"
1462 " * You will need to prepare companion metadata file(s).\n"
1463 " * If --glm was specified, --gwas-ssf will postprocess --glm's results, and\n"
1464 " optionally delete the --glm results afterward ('delete-orig-glm'\n"
1465 " modifier).\n"
1466 " * To postprocess some preexisting file(s), use file= and/or file-list= .\n"
1467 " Note that these files must contain most default column sets, including\n"
1468 " 'a1freq' (so PLINK 1.x --linear/--logistic output is not supported).\n"
1469 " * By default, unless the 'provref' column is present in the input file,\n"
1470 " true REF alleles are assumed to be unknown, since --glm is sometimes\n"
1471 " run on PLINK 1 filesets which don't track that information. Use the\n"
1472 " 'real-ref-alleles' modifier to specify that REF alleles are accurate.\n"
1473 " * For indels, REF alleles are normally *required* to be known, because\n"
1474 " (unlike the case for SNPs) swapping REF/ALT order for an indel actually\n"
1475 " changes the genetic variation that is referred to. If --gwas-ssf errors\n"
1476 " out for this reason, but you have an upstream VCF or similar file from\n"
1477 " which the correct REF/ALT allele labels can be recovered (see the\n"
1478 " --ref-allele flag documentation for details), you are STRONGLY encouraged\n"
1479 " to recover those labels.\n"
1480 " If it's genuinely impossible to recover them, you can use the\n"
1481 " 'allow-ambiguous-indels' modifier to override the error. In this case,\n"
1482 " some of your indel results will probably be unusable.\n"
1483 " * Variants outside {chr1..chr22, chrX, chrY, chrM}, and variants with\n"
1484 " non-ACGT characters in the A1 or OMITTED allele code, are skipped. (The\n"
1485 " PAR1, PAR2, and XY chromosome codes are converted to chrX.)\n"
1486 " * If the 'omitted' column is absent from an input file, --gwas-ssf will\n"
1487 " skip (unsplit) multiallelic variants.\n"
1488 " Conversely, if unsplit multiallelic variants and the 'omitted' column are\n"
1489 " present, the multiallelic variants will be handled properly, and the\n"
1490 " results should be more reliable than what you'd get from splitting the\n"
1491 " variants. Specify \"other minor alleles\" (or \"other ALT alleles\" if you\n"
1492 " ran with 'omit-ref') as part of the \"adjustedCovariates\" metadata entry\n"
1493 " in this case.\n"
1494 " * By default, a 'rsid' column appears in the output iff at least one\n"
1495 " variant in the current dataset has an ID that is a syntactically valid\n"
1496 " rsID (mode='infer'). Modes 'no' and 'yes' do what they say.\n"
1497 " * You can use the 'a1freq-lower-limit=' modifier to mask very low allele\n"
1498 " frequencies, when the raw values would compromise privacy.\n\n"
1499 );
1500 #ifndef NOLAPACK
1501 HelpPrint("pheno-svd\0glm\0", &help_ctrl, 1,
1502 " --pheno-svd <# output phenotypes> ['force'] ['scols='<col set descriptor>]\n"
1503 " ['pcols='<col set descriptor>]\n"
1504 " --pheno-svd variance=<#> ['force'] ['scols='<col set descriptor>]\n"
1505 " ['pcols='<col set descriptor>]\n"
1506 " Perform SVD of full rows (i.e. samples with no missing phenotype values) of\n"
1507 " the phenotype matrix, generate new phenotypes (named 'SVDPHENO1',\n"
1508 " 'SVDPHENO2', etc.) equal to the top left-singular vectors, and save them to\n"
1509 " <output prefix>.svd.pheno. Singular values + input-phenotype weights are\n"
1510 " written to <output prefix>.svd.pheno_wts.\n"
1511 " By default, if less than half of the remaining samples have full phenotype\n"
1512 " rows, this command errors out. In this case, you may want to use a method\n"
1513 " like softImpute (https://cran.r-project.org/web/packages/softImpute/ ) to\n"
1514 " fill in some missing phenotype values, possibly after excluding some\n"
1515 " nonessential phenotypes with an especially large number of missing values.\n"
1516 " Alternatively, you can use 'force' to override the error; this usually\n"
1517 " isn't the best idea.\n"
1518 " Other notes:\n"
1519 " * The first argument determines the number of new phenotypes to generate.\n"
1520 " You can either directly specify a number, or use 'variance=' to specify\n"
1521 " how much variance in the original phenotype matrix they must explain.\n"
1522 " * A mix of binary and quantitative phenotypes is permitted. Binary\n"
1523 " phenotypes are encoded as control=0, case=1 before the SVD is performed.\n"
1524 " * If there are any later commands in the same run (e.g. --glm), they will\n"
1525 " only see the newly-generated phenotypes.\n"
1526 " * 'scols=' can be used to customize how sample IDs appear in the .svd.pheno\n"
1527 " file. (maybefid, fid, maybesid, and sid supported; default is\n"
1528 " maybefid,maybesid.)\n"
1529 " * 'pcols=' can be used to customize the .svd.pheno_wts file; supported\n"
1530 " column sets are:\n"
1531 " id: New phenotype ID.\n"
1532 " sv: Singular value.\n"
1533 " (Old phenotypes are always present, and positioned here.)\n"
1534 " Default is id,sv.\n\n"
1535 );
1536 #endif
1537 HelpPrint("clump\0", &help_ctrl, 1,
1538 " --clump ['zs'] ['cols='<col set desc>] <PLINK report filename(s)...>\n"
1539 " Postprocess --glm and similar association analysis report(s), organizing\n"
1540 " results into LD-based clumps. Multiple filenames can be separated by\n"
1541 " spaces or commas. Dosages are used in the LD computations.\n"
1542 " Supported column sets are:\n"
1543 " chrom: Chromosome ID.\n"
1544 " pos: Base-pair coordinate.\n"
1545 " (ID is always present, and positioned here.)\n"
1546 " ref: Reference allele.\n"
1547 " alt1: Alternate allele 1.\n"
1548 " alt: All alternate alleles, comma-separated.\n"
1549 " maybeprovref: Reports whether REF allele is marked as known or\n"
1550 " provisional, when at least one of the latter is present,\n"
1551 " and the REF column is present.\n"
1552 " provref: Force provref column even if all-'N'.\n"
1553 " maybea1: A1 allele, if at least 1 multiallelic index variant is present.\n"
1554 " a1: Force A1 column even if all index variants are biallelic.\n"
1555 " maybef: 1-based file number, if more than one file is provided.\n"
1556 " f: Force F column (and SP2 entry) even when only one file is provided.\n"
1557 " (P is always present, and positioned here.)\n"
1558 " total: Number of other variants in clump.\n"
1559 " maybebounds: If --clump-range[0] specified, bp range of members with p <\n"
1560 " --clump-p2 threshold (two cols).\n"
1561 " bounds: Force bp range columns even without --clump-range[0].\n"
1562 " bins: Number of clumped variants in each p-value bin.\n"
1563 " sp2: IDs, and possibly A1 allele and/or file number, of members with p <\n"
1564 " --clump-p2 threshold.\n"
1565 " (Overlapping-range names always present and positioned here if\n"
1566 " --clump-range[0] specified)\n"
1567 " The default is chrom,pos,maybeprovref,maybea1,maybef,total,maybebounds,\n"
1568 " bins,sp2.\n\n"
1569 );
1570 HelpPrint("score\0score-list\0", &help_ctrl, 1,
1571 " --score <filename> [i] [j] [k] [{header | header-read}]\n"
1572 " [{center | variance-standardize | dominant | recessive}]\n"
1573 " ['no-mean-imputation'] ['se'] ['zs'] ['ignore-dup-ids']\n"
1574 " [{list-variants | list-variants-zs}]\n"
1575 " ['cols='<col set descriptor>]\n"
1576 " --score-list <fnm> [i] [j] [k] [{header | header-read}]\n"
1577 " [{center | variance-standardize | dominant | recessive}]\n"
1578 " ['no-mean-imputation'] ['se'] ['zs'] ['ignore-dup-ids']\n"
1579 " ['cols='<col set descriptor>]\n"
1580 " Apply linear scoring system(s) to each sample.\n"
1581 " For --score-list, the input file should contain a list of filenames; each\n"
1582 " of those files is then processed as if it were passed to --score, then\n"
1583 " results are merged together.\n"
1584 " The rest of this section describes --score.\n"
1585 " * The input file should have one line per scored (variant, allele) pair.\n"
1586 " Variant IDs are read from column #i and allele codes are read from column\n"
1587 " #j, where i defaults to 1 and j defaults to i+1.\n"
1588 " * By default, a single column of input coefficients is read from column #k,\n"
1589 " where k defaults to j+1. (--score-col-nums can be used to specify\n"
1590 " multiple columns.)\n"
1591 " * 'header-read' causes the first line of the input file to be treated as a\n"
1592 " header line containing score names. Otherwise, score(s) are assigned the\n"
1593 " names 'SCORE1', 'SCORE2', etc.; and 'header' just causes the first line\n"
1594 " to be entirely ignored.\n"
1595 " * By default, copies of unnamed alleles contribute zero to score, while\n"
1596 " missing genotypes contribute an amount proportional to the loaded (via\n"
1597 " --read-freq) or imputed allele frequency. To throw out missing\n"
1598 " observations instead (decreasing the denominator in the final average\n"
1599 " when this happens), use the 'no-mean-imputation' modifier.\n"
1600 " * You can use the 'center' modifier to shift all genotypes to mean zero, or\n"
1601 " 'variance-standardize' to linearly transform the genotypes to mean-0,\n"
1602 " variance-1.\n"
1603 " * The 'dominant' modifier causes dosages greater than 1 to be treated as 1,\n"
1604 " while 'recessive' uses max(dosage - 1, 0) on diploid chromosomes.\n"
1605 " ('dominant', 'recessive', and 'variance-standardize' cannot be used with\n"
1606 " chrX.)\n"
1607 " * The 'se' modifier causes the input coefficients to be treated as\n"
1608 " independent standard errors; in this case, standard errors for the score\n"
1609 " average/sum are reported, under a Gaussian approximation. (Note that\n"
1610 " this will systematically underestimate standard errors when scored\n"
1611 " variants are in LD.)\n"
1612 " * By default, --score errors out if a variant ID in the input file appears\n"
1613 " multiple times in the main dataset. Use the 'ignore-dup-ids' modifier to\n"
1614 " skip them instead (a warning is still printed if such variants are\n"
1615 " present).\n"
1616 " * The 'list-variants[-zs]' modifier causes variant IDs used for scoring to\n"
1617 " be written to <output prefix>.sscore.vars[.zst].\n"
1618 " The main --score report supports the following column sets:\n"
1619 " maybefid: FID, if that column was in the input.\n"
1620 " fid: Force FID column to be written even when absent in the input.\n"
1621 " (IID is always present, and positioned here.)\n"
1622 " maybesid: SID, if that column was in the input.\n"
1623 " sid: Force SID column to be written even when absent in the input.\n"
1624 " pheno1: First active phenotype.\n"
1625 " phenos: All active phenotypes, if any.\n"
1626 " nallele: Number of nonmissing alleles.\n"
1627 " denom: Denominator of score average (equal to nallele value when\n"
1628 " 'no-mean-imputation' specified).\n"
1629 " dosagesum: Sum of named allele dosages.\n"
1630 " scoreavgs: Score averages.\n"
1631 " scoresums: Score sums.\n"
1632 " The default is maybefid,maybesid,phenos,nallele,dosagesum,scoreavgs.\n"
1633 " --score-list is the same, except the nallele/denom/dosagesum column sets\n"
1634 " are unavailable.\n"
1635 " For more sophisticated polygenic risk scoring, we recommend looking at the\n"
1636 " LDpred2 (https://privefl.github.io/bigsnpr/articles/LDpred2.html ) and\n"
1637 " PRSice-2 (https://www.prsice.info/ ) software packages.\n\n"
1638 );
1639 HelpPrint("variant-score\0vscore\0", &help_ctrl, 1,
1640 " --variant-score <filename> ['bin' | 'bin4' | 'cols='<col set descriptor>]\n"
1641 " ['zs'] ['single-prec']\n"
1642 " (alias: --vscore)\n"
1643 " Apply linear scoring system(s) to each variant. Each reported variant\n"
1644 " score is the dot product of a sample-weight vector with the\n"
1645 " total-ALT-dosage vector, with MAF-based mean imputation applied to missing\n"
1646 " dosages.\n"
1647 " Input file format: one line per sample, each starting with an ID and\n"
1648 " followed by scoring weight(s); it can also have a header line with the\n"
1649 " sample ID representation and the score name(s).\n"
1650 " The usual .vscore text report supports the following column sets:\n"
1651 " chrom: Chromosome ID.\n"
1652 " pos: Base-pair coordinate.\n"
1653 " (ID is always present, and positioned here.)\n"
1654 " ref: Reference allele.\n"
1655 " alt1: Alternate allele 1.\n"
1656 " alt: All alternate alleles, comma-separated.\n"
1657 " maybeprovref: Reports whether REF allele is marked as known or\n"
1658 " provisional, when at least one of the latter is present,\n"
1659 " and the REF column is present.\n"
1660 " provref: Force provref column even if all-'N'.\n"
1661 " altfreq: ALT allele frequency used for mean-imputation.\n"
1662 " nmiss: Number of missing (and thus mean-imputed) dosages.\n"
1663 " nobs: Number of (nonmissing) sample observations.\n"
1664 " (Variant scores are always present, and positioned here.)\n"
1665 " Default is chrom,pos,ref,alt,maybeprovref.\n"
1666 " If binary output is requested instead, the main .vscore.bin matrix contains\n"
1667 " floating-point values, column (score) ID(s) are saved to\n"
1668 " <output prefix>.vscore.cols, and variant IDs are saved to\n"
1669 " <output prefix>.vscore.vars[.zst].\n"
1670 " 'single-prec' causes the computation to use single- instead of\n"
1671 " double-precision floating-point values internally.\n\n"
1672 );
1673 HelpPrint("adjust-file\0adjust\0", &help_ctrl, 1,
1674 " --adjust-file <filename> ['zs'] ['gc'] ['cols='<column set descriptor>]\n"
1675 " ['log10'] ['input-log10'] ['test='<test name, case-sensitive>]\n"
1676 " Given a file with unfiltered association test results, report some basic\n"
1677 " multiple-testing corrections, sorted in increasing-p-value order.\n"
1678 " * 'gc' causes genomic-controlled p-values to be used in the formulas.\n"
1679 " (This tends to be overly conservative. We note that LD Score regression\n"
1680 " usually does a better job of calibrating lambda; see Lee JJ, McGue M,\n"
1681 " Iacono WG, Chow CC (2018) The accuracy of LD Score regression as an\n"
1682 " estimator of confounding and genetic correlations in genome-wide\n"
1683 " association studies.)\n"
1684 " * 'log10' causes negative base 10 logs of p-values to be reported, instead\n"
1685 " of raw p-values. 'input-log10' specifies that the input file contains\n"
1686 " -log10(p) values.\n"
1687 " * If the input file contains multiple tests per variant which are\n"
1688 " distinguished by a 'TEST' column (true for --linear/--logistic/--glm),\n"
1689 " you must use 'test=' to select the test to process.\n"
1690 " The following column sets are supported:\n"
1691 " chrom: Chromosome ID.\n"
1692 " pos: Base-pair coordinate.\n"
1693 " (ID is always present, and positioned here.)\n"
1694 " ref: Reference allele.\n"
1695 " alt1: Alternate allele 1.\n"
1696 " alt: All alternate alleles, comma-separated.\n"
1697 " maybeprovref: Reports whether REF allele is marked as known or\n"
1698 " provisional, when at least one of the latter is present,\n"
1699 " and the REF column is present.\n"
1700 " provref: Force provref column even if all-'N'.\n"
1701 " a1: Tested allele. (Omitted if missing from input file.)\n"
1702 " unadj: Unadjusted p-value.\n"
1703 " gc: Devlin & Roeder (1999) genomic control corrected p-value (additive\n"
1704 " models only).\n"
1705 " qq: P-value quantile.\n"
1706 " bonf: Bonferroni correction.\n"
1707 " holm: Holm-Bonferroni (1979) adjusted p-value.\n"
1708 " sidakss: Sidak single-step adjusted p-value.\n"
1709 " sidaksd: Sidak step-down adjusted p-value.\n"
1710 " fdrbh: Benjamini & Hochberg (1995) step-up false discovery control.\n"
1711 " fdrby: Benjamini & Yekutieli (2001) step-up false discovery control.\n"
1712 " Default set is chrom,maybeprovref,a1,unadj,gc,bonf,holm,sidakss,sidaksd,\n"
1713 " fdrbh,fdrby.\n\n"
1714 );
1715 // todo: reimplement most/all of PLINK 1.x's other automatic checks (het
1716 // haploids, missing sex, etc. with corresponding output files) and have a
1717 // flag (--qc1?) which invokes them all.
1718 HelpPrint("genotyping-rate\0", &help_ctrl, 1,
1719 " --genotyping-rate ['dosage']\n"
1720 " Report genotyping rate in log (this was automatic in PLINK 1.x).\n\n"
1721 );
1722 HelpPrint("pgen-info\0", &help_ctrl, 1,
1723 " --pgen-info\n"
1724 " Reports basic information about a .pgen file.\n\n"
1725 );
1726 HelpPrint("validate\0", &help_ctrl, 1,
1727 " --validate\n"
1728 " Validates all variant records in a .pgen file.\n\n"
1729 );
1730 HelpPrint("zst-decompress\0zd\0", &help_ctrl, 1,
1731 " --zst-decompress <.zst file> [output filename]\n"
1732 " (alias: --zd)\n"
1733 " Decompress a Zstd-compressed file. If no output filename is specified, the\n"
1734 " file is decompressed to standard output.\n"
1735 " This cannot be used with any other flags, and does not cause a log file to\n"
1736 " be generated.\n\n"
1737 );
1738 if (!param_ct) {
1739 fputs(
1740 "The following other flags are supported.\n"
1741 // tbd: document order of operations
1742 , stdout);
1743 }
1744 HelpPrint("script\0rerun\0", &help_ctrl, 0,
1745 " --script <fname> : Include command-line options from file.\n"
1746 " --rerun [log] : Rerun commands in log (default 'plink2.log').\n"
1747 );
1748 HelpPrint("version\0", &help_ctrl, 0,
1749 " --version : Display only version number before exiting.\n"
1750 );
1751 HelpPrint("silent\0", &help_ctrl, 0,
1752 " --silent : Suppress regular output to console. (Error-output is\n"
1753 " not suppressed.)\n"
1754 );
1755 HelpPrint("vcf\0bcf\0bgen\0double-id\0const-fid\0id-delim\0", &help_ctrl, 0,
1756 " --double-id : When importing single-part sample IDs, set both FID and\n"
1757 " IID to the original ID.\n"
1758 " --const-fid [ID] : When importing single-part sample IDs, set FID to the\n"
1759 " given constant and IID to the original ID.\n"
1760 " --id-delim [d] : Normally parses single-delimiter sample IDs as\n"
1761 " <FID><d><IID>, and double-delimiter IDs as\n"
1762 " <FID><d><IID><d><SID>; default delimiter is '_'.\n"
1763 " --id-delim can no longer be used with\n"
1764 " --double-id/--const-fid; it will error out if any ID\n"
1765 " lacks the delimiter.\n"
1766 );
1767 HelpPrint("idspace-to\0vcf\0bcf\0bgen\0id-delim\0vcf-idspace-to\0", &help_ctrl, 0,
1768 " --idspace-to <c> : Convert spaces in VCF/.bgen sample IDs to the given\n"
1769 " character.\n"
1770 );
1771 HelpPrint("iid-sid\0id-delim\0sample-diff\0indv\0", &help_ctrl, 0,
1772 " --iid-sid : Make --id-delim, --indv, and --sample-diff interpret\n"
1773 " two-token sample IDs as IID-SID instead of FID-IID.\n"
1774 );
1775 HelpPrint("vcf\0bcf\0vcf-half-call\0vcf-min-gq\0vcf-min-dp\0vcf-max-dp\0vcf-require-gt\0vcf-ploidy\0vcf-ref-n-missing\0", &help_ctrl, 0,
1776 " --vcf-require-gt : Skip variants with no GT field.\n"
1777 " --vcf-min-gq <val> : No-call genotypes when GQ is present and below the\n"
1778 " threshold.\n"
1779 " --vcf-max-dp <val> : No-call genotypes when DP is present and above/below\n"
1780 " --vcf-min-dp <val> the threshold.\n"
1781 " --vcf-half-call <m> : Specify how '0/.' and similar VCF GT values should be\n"
1782 " handled. The following four modes are supported:\n"
1783 " * 'error'/'e' (default) errors out and reports line #.\n"
1784 " * 'haploid'/'h' treats them as haploid calls.\n"
1785 " * 'missing'/'m' treats them as missing.\n"
1786 " * 'reference'/'r' treats the missing value as 0.\n"
1787 " --vcf-ref-n-missing : Import VCF 'N' REF alleles as missing alleles. This\n"
1788 " can be appropriate for .ped-derived VCFs.\n"
1789 );
1790 HelpPrint("vcf\0vcf-allow-no-nonvar\0", &help_ctrl, 0,
1791 " --vcf-allow-no-nonvar : By default, --vcf without dosage= prints a warning\n"
1792 " (to be upgraded to an error in a future build) when\n"
1793 " given a single-sample file with no 0, 0/0, or 0|0 GT\n"
1794 " values among 1000+ scanned variants with non-missing\n"
1795 " GT, since that implies the VCF was not generated\n"
1796 " properly (e.g. GATK GenotypeGVCFs was run without\n"
1797 " --include-non-variant-sites). --vcf-allow-no-nonvar\n"
1798 " suppresses this warning/error.\n"
1799 );
1800 HelpPrint("oxford-single-chr\0data\0gen\0bgen\0", &help_ctrl, 0,
1801 " --oxford-single-chr <chr name> : Specify single-chromosome .gen/.bgen file\n"
1802 " with no useful chromosome info inside.\n"
1803 );
1804 HelpPrint("lax-bgen-import\0bgen\0", &help_ctrl, 0,
1805 " --lax-bgen-import : Do not error out when .bgen header has an\n"
1806 " overstated variant count (possible from\n"
1807 " IMPUTE5).\n"
1808 );
1809 HelpPrint("missing-code\0missing_code\0data\0sample\0", &help_ctrl, 0,
1810 " --missing-code [string list] : Comma-delimited list of missing phenotype\n"
1811 " (alias: --missing_code) values for Oxford-format import (default\n"
1812 " 'NA').\n"
1813 );
1814 // any need to keep --hard-call-threshold random? postpone it for now...
1815 HelpPrint("hard-call-threshold\0gen\0bgen\0data\0import-dosage\0", &help_ctrl, 0,
1816 " --hard-call-threshold <val> : When importing dosage data, a hardcall is\n"
1817 " normally saved when the distance from the\n"
1818 " nearest hardcall, defined as\n"
1819 " 0.5 * sum_i |x_i - round(x_i)|\n"
1820 " (where the x_i's are 0..2 allele dosages),\n"
1821 " is not greater than 0.1. You can adjust\n"
1822 " this threshold by providing a numeric\n"
1823 " argument to --hard-call-threshold.\n"
1824 " You can also use this with --make-[b]pgen\n"
1825 " to alter the saved hardcalls while leaving\n"
1826 " the dosages untouched, or --make-bed to\n"
1827 " tweak hardcall export.\n"
1828 );
1829 HelpPrint("dosage-erase-threshold\0import-dosage-certainty\0gen\0bgen\0data\0vcf\0bcf\0import-dosage\0", &help_ctrl, 0,
1830 " --dosage-erase-threshold <val> : --hard-call-threshold normally preserves\n"
1831 " the original dosages, and several PLINK 2\n"
1832 " commands use them when they're available.\n"
1833 " Use --dosage-erase-threshold to make PLINK\n"
1834 " 2 erase dosages and keep only hardcalls\n"
1835 " when distance-from-hardcall <= the given\n"
1836 " level.\n"
1837 " --import-dosage-certainty <val> : The PLINK 2 file format currently supports\n"
1838 " a single dosage for each allele. Some\n"
1839 " other dosage file formats include a\n"
1840 " separate probability for every possible\n"
1841 " genotype, e.g. {P(0/0)=0.2, P(0/1)=0.52,\n"
1842 " P(1/1)=0.28}, a highly uncertain call that\n"
1843 " is nevertheless treated as a hardcall under\n"
1844 " '--hard-call-threshold 0.1'. To make PLINK\n"
1845 " 2 treat a dosage as missing whenever the\n"
1846 " largest probability is less than a\n"
1847 " threshold, use --import-dosage-certainty.\n"
1848 );
1849 HelpPrint("input-missing-genotype\0missing-genotype\0", &help_ctrl, 0,
1850 " --input-missing-genotype <c> : '.' is always interpreted as a missing\n"
1851 " genotype code in input files. By default, '0'\n"
1852 " also is; you can change this second missing\n"
1853 " code with --input-missing-genotype.\n"
1854 );
1855 // change this for a6
1856 HelpPrint("strict-extra-chr\0allow-extra-chr\0aec\0", &help_ctrl, 0,
1857 " --strict-extra-chr : Prohibit unrecognized chromosome codes, unless\n"
1858 " --allow-extra-chr is also specified.\n"
1859 " --allow-extra-chr ['0'] : Permit unrecognized chromosome codes (alias --aec).\n"
1860 " The '0' modifier causes these codes to be converted\n"
1861 " to \"0\".\n"
1862 );
1863 // possible todo: nonhuman PARs?
1864 HelpPrint("chr-set\0cow\0dog\0horse\0hound\0mouse\0rice\0sheep\0autosome-num\0human\0chr-override\0", &help_ctrl, 0,
1865 " --chr-set <autosome ct> ['no-x'] ['no-y'] ['no-xy'] ['no-mt'] :\n"
1866 " Specify a nonhuman chromosome set. The first parameter sets the number of\n"
1867 " diploid autosome pairs if positive, or haploid chromosomes if negative.\n"
1868 " Given diploid autosomes, the remaining modifiers indicate the absence of\n"
1869 " the named non-autosomal chromosomes.\n"
1870 " --cow/--dog/--horse/--mouse/--rice/--sheep : Shortcuts for those species.\n"
1871 " --autosome-num <val> : Alias for '--chr-set <value> no-y no-xy no-mt'.\n"
1872 " --human : Explicitly specify human chromosome set, and make\n"
1873 " output .pvar/VCF files include a ##chrSet header\n"
1874 " line. (.pvar/VCF output files automatically\n"
1875 " include ##chrSet when a nonhuman set is specified.)\n"
1876 " --chr-override ['file'] : By default, if --chr-set/--autosome-num/--cow/etc.\n"
1877 " conflicts with an input file ##chrSet header line,\n"
1878 " PLINK 2 will error out. --chr-override with no\n"
1879 " argument causes the command line to take\n"
1880 " precedence; '--chr-override file' defers to the\n"
1881 " file.\n"
1882 );
1883 // possible todo: --var-max-qual
1884 HelpPrint("var-min-qual\0var-filter\0vcf-min-qual\0vcf-filter\0qual-scores\0qual-threshold\0qual-max-threshold\0", &help_ctrl, 0,
1885 " --var-min-qual <val> : Skip variants with low/missing QUAL.\n"
1886 " --var-filter [exception(s)...] : Skip variants which have FILTER failures.\n"
1887 );
1888 HelpPrint("extract-if-info\0exclude-if-info\0require-info\0require-no-info\0extract-if\0exclude-if\0keep-if-info\0remove-if-info\0var-min-qual\0var-filter\0vcf-min-qual\0vcf-filter\0", &help_ctrl, 0,
1889 " --extract-if-info <key> <op> <val> : Exclude variants which don't/do satisfy\n"
1890 " --exclude-if-info <key> <op> <val> a comparison predicate on an INFO key,\n"
1891 " (aliases: --extract-if, e.g.\n"
1892 " --exclude-if) --extract-if-info \"VT == SNP\"\n"
1893 " As a special case, val=';' specifies the\n"
1894 " empty-string.\n"
1895 " Unless the operator is !=, the predicate\n"
1896 " always evaluates to false when the key\n"
1897 " is missing.\n"
1898 " --require-info <key(s)...> : Exclude variants based on nonexistence\n"
1899 " --require-no-info <key(s)...> or existence of an INFO key. \"<key>=.\"\n"
1900 " is treated as nonexistence.\n"
1901 );
1902 HelpPrint("extract-col-cond\0extract-col-cond-match\0extract-col-cond-mismatch\0extract-col-cond-substr\0extract-col-cond-min\0extract-col-cond-max\0extract-fcol\0extract-fcol-match\0extract-fcol-mismatch\0extract-fcol-substr\0extract-fcol-min\0extract-fcol-max\0qual-scores\0qual-threshold\0qual-max-threshold\0attrib\0", &help_ctrl, 0,
1903 " --extract-col-cond <f> [valcol] [IDcol] [skip] :\n"
1904 " --extract-col-cond-match <(sub)string(s)...>\n"
1905 " --extract-col-cond-mismatch <(sub)string(s)...>\n"
1906 " --extract-col-cond-substr\n"
1907 " --extract-col-cond-min <min>\n"
1908 " --extract-col-cond-max <max> :\n"
1909 " Exclude all variants without a value-column entry satisfying a condition.\n"
1910 " * By default, values are read from column 2 of the file, and variant IDs\n"
1911 " are read from column 1.\n"
1912 " * Three types of conditions are supported:\n"
1913 " * When --extract-col-cond-match is specified without\n"
1914 " --extract-col-cond-substr, the value is checked for equality with the\n"
1915 " given strings, and kept iff one of them matches. Similarly,\n"
1916 " --extract-col-cond-mismatch without --extract-col-cond-substr causes\n"
1917 " the variant to be kept iff the value matches none of the given strings.\n"
1918 " * When --extract-col-cond-match and/or -mismatch are specified with\n"
1919 " --extract-col-cond-substr, the variant is kept iff none of the\n"
1920 " --extract-col-cond-mismatch substrings are contained in the value, and\n"
1921 " either --extract-col-cond-match was unspecified or at least one of its\n"
1922 " substrings is contained.\n"
1923 " * Otherwise, the value is interpreted as a number, and the variant is\n"
1924 " kept if the number is in [<min>, <max>] (default min=0, max=DBL_MAX).\n"
1925 );
1926 HelpPrint("pheno\0pheno-name\0pheno-col-nums\0not-pheno\0mpheno\0phenoExcludeList\0", &help_ctrl, 0,
1927 " --pheno ['iid-only'] <f> : Specify additional phenotype/covariate file.\n"
1928 " Comma-delimited files with a header line are now\n"
1929 " permitted.\n"
1930 " --pheno-name <name...> : Only load the designated phenotype(s) from the\n"
1931 " --pheno (if one was specified) or .psam (if no\n"
1932 " --pheno) file. Separate multiple names with\n"
1933 " spaces or commas, and use dashes to designate\n"
1934 " ranges.\n"
1935 " --pheno-col-nums <#...> : Only load the phenotype(s) in the designated\n"
1936 " column number(s) from the --pheno file.\n"
1937 " --not-pheno <name...> : Ignore the named phenotype(s).\n"
1938 );
1939 HelpPrint("bfile\0fam\0psam\0no-psam-pheno\0no-fam-pheno\0no-pheno\0pheno\0pheno-name\0", &help_ctrl, 0,
1940 " --no-psam-pheno : Ignore phenotype(s) in .psam/.fam file.\n"
1941 );
1942 HelpPrint("strict-sid0\0", &help_ctrl, 0,
1943 " --strict-sid0 : By default, if there is no SID column in the .psam/.fam\n"
1944 " (or --update-ids) file, but there is one in another\n"
1945 " input file (for e.g. --keep/--remove), the latter SID\n"
1946 " column is ignored; sample IDs are considered matching as\n"
1947 " long as FID and IID are equal (with missing FID treated\n"
1948 " as '0'). If you also want to require SID = '0' for a\n"
1949 " sample ID match in this situation, add --strict-sid0.\n"
1950 );
1951 HelpPrint("no-categorical\0input-missing-phenotype\0no-input-missing-phenotype\0pheno\0covar\0", &help_ctrl, 0,
1952 " --no-categorical : Force all non-numeric phenotype/covariate strings to be\n"
1953 " interpreted as missing values, not category names.\n"
1954 );
1955 // bugfix (27 Feb 2019): "\01" is interpreted as a single character, not a
1956 // null followed by a '1'...
1957 HelpPrint("input-missing-phenotype\0no-input-missing-phenotype\0neg9-pheno-really-missing\0\061\0missing-catname\0missing-phenotype\0", &help_ctrl, 0,
1958 " --input-missing-phenotype <v> : Set nonzero number to treat as a missing\n"
1959 " pheno/covar in input files (default -9).\n"
1960 " --no-input-missing-phenotype : Don't treat any nonzero number as a missing\n"
1961 " pheno/covar. ('NA'/'nan' are still treated\n"
1962 " as missing.)\n"
1963 " --neg9-pheno-really-missing : When neither --input-missing-phenotype nor\n"
1964 " --no-input-missing-phenotype are specified,\n"
1965 " and a pheno/covar value in [-8, -9) or\n"
1966 " (-9, -10] is present, PLINK 2 now errors out\n"
1967 " when -9 is also present: in this context it\n"
1968 " is too likely that -9 does not represent a\n"
1969 " missing value.\n"
1970 " --neg9-pheno-really-missing suppresses the\n"
1971 " error.\n"
1972 " --1 : Expect case/control phenotypes in input files\n"
1973 " to be coded as 0 = control, 1 = case, instead\n"
1974 " of the usual 0 = missing, 1 = ctrl, 2 = case.\n"
1975 " (Unlike PLINK 1.x, this does not force all\n"
1976 " phenotypes to be interpreted as case/ctrl.)\n"
1977 " --missing-catname <str> : Set missing-categorical-phenotype string\n"
1978 " (case-sensitive, default 'NONE').\n"
1979 );
1980 HelpPrint("covar\0covar-name\0covar-col-nums\0not-covar\0covar-number\0covarExcludeList\0", &help_ctrl, 0,
1981 " --covar ['iid-only'] <f> : Specify additional covariate file.\n"
1982 " Comma-delimited files with a header line are now\n"
1983 " permitted.\n"
1984 " --covar-name <name...> : Only load the designated covariate(s) from the\n"
1985 " --covar (if one was specified), --pheno (if no\n"
1986 " --covar), or .psam (if no --covar or --pheno)\n"
1987 " file.\n"
1988 " --covar-col-nums <#...> : Only load the covariate(s) in the designated\n"
1989 " column number(s) from the --covar (if one was\n"
1990 " specified) or --pheno (if no --covar) file.\n"
1991 " --not-covar <name...> : Ignore the named covariate(s).\n"
1992 );
1993 HelpPrint("within\0mwithin\0family\0family-missing-catname\0", &help_ctrl, 0,
1994 " --within <f> [new pheno name] : Import a PLINK 1.x categorical phenotype.\n"
1995 " (Phenotype name defaults to 'CATPHENO'.)\n"
1996 " * If any numeric values are present, ALL\n"
1997 " values must be numeric. In that case, 'C'\n"
1998 " is added in front of all category names.\n"
1999 " * 'NA' is treated as a missing value.\n"
2000 " --mwithin <n> : Load --within categories from column n+2.\n"
2001 " --family [new pheno name] : Create a categorical phenotype from FID.\n"
2002 " Restrictions on and handling of numeric\n"
2003 " values are the same as for --within.\n"
2004 " --family-missing-catname <nm> : Make --family treat the specified FID as\n"
2005 " missing.\n"
2006 );
2007 HelpPrint("keep\0remove\0keep-fam\0remove-fam\0samples-file\0", &help_ctrl, 0,
2008 " --keep <fname...> : Exclude all samples not named in a file.\n"
2009 " --remove <fname...> : Exclude all samples named in a file.\n"
2010 " --keep-fam <fn...> : Exclude all families not named in a file.\n"
2011 " --remove-fam <f...> : Exclude all families named in a file.\n"
2012 );
2013 HelpPrint("extract\0exclude\0range\0extract-intersect\0regions-file\0", &help_ctrl, 0,
2014 " --extract [{bed0 | bed1}] <f...> : Usually excludes all variants (not) named\n"
2015 " --exclude [{bed0 | bed1}] <f...> in the given file(s). When multiple files\n"
2016 " are named, they are concatenated.\n"
2017 " With the 'bed0' or 'bed1' modifier,\n"
2018 " variants outside/inside the positional\n"
2019 " ranges in the interval-BED file(s) are\n"
2020 " excluded instead. 'bed0' tells PLINK 2 to\n"
2021 " assume the interval bounds follow the UCSC\n"
2022 " 0-based half-open convention, while 'bed1'\n"
2023 " (equivalent to PLINK 1.9 'range')\n"
2024 " specifies 1-based fully-closed.\n"
2025 );
2026 HelpPrint("extract-intersect\0extract\0exclude\0", &help_ctrl, 0,
2027 " --extract-intersect [{bed0 | bed1}] <f...> : Just like --extract, except that\n"
2028 " a variant must be in the\n"
2029 " intersection, rather than just\n"
2030 " the union, of the files to\n"
2031 " remain.\n"
2032 );
2033 HelpPrint("bed-border-bp\0bed-border-kb\0make-set-border\0extract\0exclude\0extract-intersect\0range\0", &help_ctrl, 0,
2034 " --bed-border-bp <n> : Stretch BED intervals by the given amount on each\n"
2035 " --bed-border-kb <n> side.\n"
2036 );
2037 HelpPrint("keep-cats\0keep-cat-names\0keep-cat-pheno\0remove-cats\0remove-cat-names\0remove-cat-pheno\0keep-clusters\0keep-cluster-names\0remove-clusters\0remove-cluster-names\0", &help_ctrl, 0,
2038 " --keep-cats <filename> : These can be used individually or in combination\n"
2039 " --keep-cat-names <nm...> to define a list of categories to keep; all\n"
2040 " samples not in one of the named categories are\n"
2041 " excluded. Use spaces to separate category names\n"
2042 " for --keep-cat-names. Use the --missing-catname\n"
2043 " value (default 'NONE') to refer to the group of\n"
2044 " uncategorized samples.\n"
2045 " --keep-cat-pheno <pheno> : If more than one categorical phenotype is loaded,\n"
2046 " or you wish to filter on a categorical covariate,\n"
2047 " --keep-cat-pheno must be used to specify which\n"
2048 " phenotype/covariate --keep-cats and\n"
2049 " --keep-cat-names apply to.\n"
2050 " --remove-cats <filename> : Exclude all categories named in the file.\n"
2051 " --remove-cat-names <...> : Exclude named categories.\n"
2052 " --remove-cat-pheno <phe> : Specify pheno for --remove-cats/remove-cat-names.\n"
2053 );
2054 HelpPrint("split-cat-pheno\0dummy-coding\0", &help_ctrl, 0,
2055 " --split-cat-pheno [{omit-most | omit-last}] ['covar-01']\n"
2056 " [cat. pheno/covar name(s)...] :\n"
2057 " Split n-category phenotype(s) into n (or n-1, with 'omit-most'/'omit-last')\n"
2058 " binary phenotypes, with names of the form <orig. pheno name>=<cat. name>.\n"
2059 " (As a consequence, affected phenotypes and categories are not permitted to\n"
2060 " contain the '=' character.)\n"
2061 " * This happens after all sample filters.\n"
2062 " * If no phenotype or covariate names are provided, all categorical\n"
2063 " phenotypes (but not covariates) are processed.\n"
2064 " * By default, generated covariates are coded as 1=false, 2=true. To code\n"
2065 " them as 0=false, 1=true instead, add the 'covar-01' modifier.\n"
2066 );
2067 HelpPrint("loop-cats\0loop-assoc\0", &help_ctrl, 0,
2068 " --loop-cats <pheno/covar> : Run variant filters and subsequent operations\n"
2069 " on just the samples in the first category; then\n"
2070 " just the samples in the second category; and so\n"
2071 " on, for all categories in the named categorical\n"
2072 " phenotype.\n"
2073 );
2074 HelpPrint("no-id-header\0write-samples\0king-cutoff\0", &help_ctrl, 0,
2075 " --no-id-header ['iid-only'] : Don't include a header line in .id output\n"
2076 " files. This normally forces two-column FID/IID\n"
2077 " output; add 'iid-only' to force just\n"
2078 " single-column IID.\n"
2079 );
2080 HelpPrint("variance-standardize\0covar-variance-standardize\0quantile-normalize\0pheno-quantile-normalize\0covar-quantile-normalize\0standard-beta\0glm\0linear\0logistic\0", &help_ctrl, 0,
2081 " --variance-standardize [pheno/covar name(s)...]\n"
2082 " --covar-variance-standardize [covar name(s)...] :\n"
2083 " Linearly transform named covariates (and quantitative phenotypes, if\n"
2084 " --variance-standardize) to mean-zero, variance 1. If no arguments are\n"
2085 " provided, all possible phenotypes/covariates are affected.\n"
2086 " This is frequently necessary to prevent the multicollinearity check from\n"
2087 " failing when dealing with covariates where abs(mean) is much larger than\n"
2088 " the standard deviation, such as year of birth.\n"
2089 " --quantile-normalize [...] : Force named covariates and quantitative\n"
2090 " --pheno-quantile-normalize [...] phenotypes to a N(0,1) distribution,\n"
2091 " --covar-quantile-normalize [...] preserving only the original rank orders.\n"
2092 );
2093 HelpPrint("chr\0not-chr\0", &help_ctrl, 0,
2094 " --chr <chr(s)...> : Exclude all variants not on the given chromosome(s).\n"
2095 " Valid choices for humans are 0 (unplaced), 1-22, X, Y,\n"
2096 " XY, MT, PAR1, and PAR2. Separate multiple chromosomes\n"
2097 " with spaces and/or commas, and use a dash (no adjacent\n"
2098 " spaces permitted) to denote a range, e.g.\n"
2099 " '--chr 1-4, 22, par1, x, par2'.\n"
2100 " --not-chr <...> : Reverse of --chr (exclude variants on listed\n"
2101 " chromosomes).\n"
2102 );
2103 HelpPrint("autosome\0autosome-par\0autosome-xy\0chr\0not-chr\0", &help_ctrl, 0,
2104 " --autosome : Exclude all non-autosomal variants.\n"
2105 " --autosome-par : Exclude all non-autosomal variants, except those in a\n"
2106 " pseudo-autosomal region.\n"
2107 );
2108 HelpPrint("snps-only\0", &help_ctrl, 0,
2109 " --snps-only ['just-acgt'] : Exclude non-SNP variants. By default, SNP = all\n"
2110 " allele codes are single-character (so\n"
2111 " multiallelic variants with a mix of SNPs and\n"
2112 " non-SNPs are excluded; split your variants first\n"
2113 " if that's a problem).\n"
2114 " The 'just-acgt' modifier restricts SNP codes to\n"
2115 " {A,C,G,T,a,c,g,t,<missing>}.\n"
2116 );
2117 // best to only support --chr with --from-bp/--to-bp/etc., now that
2118 // FinalizeChrset() is deferred
2119 HelpPrint("from\0to\0snp\0window\0from-bp\0to-bp\0from-kb\0to-kb\0from-mb\0to-mb\0exclude-snp\0extract-snp\0", &help_ctrl, 0,
2120 " --from <var ID> : Use ID(s) to specify a variant range to load. When used\n"
2121 " --to <var ID> together, both variants must be on the same chromosome.\n"
2122 " (--snps can be used to specify intervals which cross\n"
2123 " chromosome boundaries.)\n"
2124 " --snp <var ID> : Specify a single variant to load.\n"
2125 " --exclude-snp <ID> : Specify a single variant to exclude.\n"
2126 " --window <kbs> : With --snp/--exclude-snp, loads/excludes all variants\n"
2127 " within half the specified kb distance of the named one.\n"
2128 " --from-bp <pos> : Use base-pair coordinates to define a variant range to\n"
2129 " --to-bp <pos> load.\n"
2130 " --from-kb <pos> * You must use these with --chr, specifying a single\n"
2131 " --to-kb <pos> chromosome.\n"
2132 " --from-mb <pos> * Decimals and negative numbers are permitted.\n"
2133 " --to-mb <pos> * The --to-bp(/-kb/-mb) position is no longer permitted\n"
2134 " to be smaller than the --from-bp position.\n"
2135 );
2136 HelpPrint("snps\0exclude-snps\0ld-snps\0", &help_ctrl, 0,
2137 " --snps <var IDs...> : Use IDs to specify variant range(s) to load or\n"
2138 " --exclude-snps <...> exclude. E.g. '--snps rs1111-rs2222, rs3333, rs4444'.\n"
2139 );
2140 HelpPrint("force-intersect\0extract\0extract-intersect\0from\0to\0snp\0from-bp\0to-bp\0from-kb\0to-kb\0from-mb\0to-mb\0extract-snp\0snps\0", &help_ctrl, 0,
2141 " --force-intersect : PLINK 2 normally errors out when multiple variant\n"
2142 " inclusion filters (--extract, --extract-col-cond,\n"
2143 " --extract-intersect, --from/--to, --from-bp/--to-bp,\n"
2144 " --snp, --snps) are specified. --force-intersect\n"
2145 " allows the run to proceed; the set intersection will\n"
2146 " be taken.\n"
2147 );
2148 HelpPrint("indv\0keep\0samples\0", &help_ctrl, 0,
2149 " --indv <sample ID> : Filter out all samples except for those matching\n"
2150 " the provided sample ID. (Separate the parts of a\n"
2151 " multipart sample ID with spaces.)\n"
2152 );
2153 HelpPrint("thin\0thin-count\0", &help_ctrl, 0,
2154 " --thin <p> : Randomly remove variants, retaining each with prob. p.\n"
2155 " --thin-count <n> : Randomly remove variants until n of them remain.\n"
2156 );
2157 HelpPrint("bp-space\0thin\0", &help_ctrl, 0,
2158 " --bp-space <bps> : Remove variants so that each pair is no closer than\n"
2159 " the given bp distance.\n"
2160 );
2161 HelpPrint("thin-indiv\0thin-indiv-count\0max-indv\0", &help_ctrl, 0,
2162 " --thin-indiv <p> : Randomly remove samples, retaining with prob. p.\n"
2163 " --thin-indiv-count <n> : Randomly remove samples until n of them remain.\n"
2164 );
2165 HelpPrint("keep-col-match\0keep-col-match-name\0keep-col-match-num\0keep-fcol\0keep-fcol-name\0keep-fcol-num\0filter\0mfilter\0", &help_ctrl, 0,
2166 " --keep-col-match <f> <val(s)...> : Exclude all samples without a 3rd column\n"
2167 " entry in the given file exactly matching\n"
2168 " one of the given strings. (Separate\n"
2169 " multiple strings with spaces.)\n"
2170 " --keep-col-match-name <col name> : Check column with given name instead.\n"
2171 " --keep-col-match-num <n> : Check nth column instead.\n"
2172 );
2173 HelpPrint("geno\0mind\0oblig-clusters\0oblig-missing\0", &help_ctrl, 0,
2174 " --geno [val] [{dosage | hh-missing}]\n"
2175 " --mind [val] [{dosage | hh-missing}] : \n"
2176 " Exclude variants (--geno) and/or samples (--mind) with missing call\n"
2177 " frequencies greater than a threshold (default 0.1). (Note that the default\n"
2178 " threshold is only applied if --geno/--mind is invoked without an argument;\n"
2179 " when --geno/--mind is not invoked, no missing call frequency ceiling is\n"" enforced at all. Other inclusion/exclusion default thresholds work the\n"
2180 " same way.)\n"
2181 " By default, when a dosage is present but a hardcall is not, the genotype is\n"
2182 " treated as missing; add the 'dosage' modifier to treat this case as\n"
2183 " nonmissing. Alternatively, you can use 'hh-missing' to also treat\n"
2184 " heterozygous haploid calls as missing.\n"
2185 );
2186 HelpPrint("y-nosex-missing-stats\0genotyping-rate\0missing\0geno\0mind\0", &help_ctrl, 0,
2187 " --y-nosex-missing-stats : On chrY, include unknown-sex samples when computing\n"
2188 " missing-genotype and heterozygous-haploid stats.\n"
2189 );
2190 /*
2191 HelpPrint("oblig-clusters\0oblig-missing\0", &help_ctrl, 0,
2192 " --oblig-missing <f1> <f2> : Specify blocks of missing genotype calls for\n"
2193 " --geno/--mind to ignore. The first file should\n"
2194 " have variant IDs in the first column and block\n"
2195 " IDs in the second, while the second file should\n"
2196 " have FIDs in the first column, IIDs in the\n"
2197 " second, and block IDs in the third.\n"
2198 );
2199 */
2200 HelpPrint("require-pheno\0require-covar\0keep-if\0remove-if\0prune\0", &help_ctrl, 0,
2201 " --require-pheno [name(s)...] : Remove samples missing any of the named\n"
2202 " --require-covar [name(s)...] phenotype(s)/covariate(s). If no arguments\n"
2203 " are provided, all phenotype(s)/covariate(s)\n"
2204 " must be present.\n"
2205 );
2206 // 'major' mode intentionally omitted since it's almost entirely redundant,
2207 // and kind of forces the underlying flag to be renamed
2208 HelpPrint("maf\0min-af\0max-maf\0max-af\0mac\0min-ac\0max-mac\0max-ac\0", &help_ctrl, 0,
2209 " --maf [freq] [mode] : Exclude variants with allele frequency lower than a\n"
2210 " (alias: --min-af) threshold (default 0.01). By default, the nonmajor\n"
2211 " allele frequency is used; the other supported modes\n"
2212 " are 'nref' (non-reference), 'alt1', and 'minor'\n"
2213 " (least frequent). bcftools freq:mode notation is\n"
2214 " permitted.\n"
2215 " --max-maf <freq> [mode] : Exclude variants with MAF greater than the\n"
2216 " (alias: --max-af) threshold.\n"
2217 " --mac <ct> [mode] : Exclude variants with allele dosage lower than the\n"
2218 " (alias: --min-ac) given threshold.\n"
2219 " --max-mac <ct> [mode] : Exclude variants with allele dosage greater than\n"
2220 " (alias: --max-ac) the given threshold.\n"
2221 );
2222 HelpPrint("af-pseudocount\0maf-succ\0", &help_ctrl, 0,
2223 " --af-pseudocount <x> : Given j observations of one allele and k\n"
2224 " observations of the other for a biallelic variant,\n"
2225 " infer allele frequencies of (j+x) / (j+k+2x) and\n"
2226 " (k+x) / (j+k+2x), rather than the default j / (j+k)\n"
2227 " and k / (j+k).\n"
2228 " * For multiallelic variants, note that this makes\n"
2229 " unobserved ALT alleles matter.\n"
2230 " * This does not affect --freq's output.\n"
2231 );
2232 HelpPrint("max-alleles\0min-alleles\0biallelic-only\0", &help_ctrl, 0,
2233 " --min-alleles <ct> : Exclude variants with fewer than the given # of alleles.\n"
2234 " (When a variant has exactly one ALT allele, and it's\n"
2235 " a missing-code, it's excluded by \"--min-alleles 2\".)\n"
2236 " --max-alleles <ct> : Exclude variants with more than the given # of alleles.\n"
2237 );
2238 HelpPrint("import-max-alleles\0max-alleles\0biallelic-only\0vcf\0bcf\0bgen\0data\0", &help_ctrl, 0,
2239 " --import-max-alleles <ct> : Exclude variants with more than the given # of\n"
2240 " alleles during VCF/BCF/BGEN import.\n"
2241 );
2242 HelpPrint("read-freq\0bad-freqs\0", &help_ctrl, 0,
2243 " --read-freq <file> : Load allele frequency estimates from the given --freq or\n"
2244 " --geno-counts (or PLINK 1.9 --freqx) report, instead of\n"
2245 " imputing them from the immediate dataset.\n"
2246 );
2247 // todo: something like <check-ctrls>/<check-ctrl=[case/ctrl phenotype name]>
2248 // and maybe <ctrls-only>/<ctrl-only=[case/ctrl phenotype name]>
2249 HelpPrint("hwe\0", &help_ctrl, 0,
2250 " --hwe <p> [k] ['midp'] ['keep-fewhet'] :\n"
2251 " Exclude variants with Hardy-Weinberg equilibrium exact test p-values less\n"
2252 " than p * 10^{-nk}, where n is the sample size.\n"
2253 " * If unspecified, k is 0. However, because --hwe has frequently been used\n"
2254 " with inappropriately strict thresholds on large datasets, this can now\n"
2255 " result in a warning (to be upgraded to an error in a future build).\n"
2256 " Explicitly specify k=0 to silence the warning.\n"
2257 " * By default, only founders are considered.\n"
2258 " * chrX p-values are now computed using Graffelman and Weir's method.\n"
2259 " * For variants with j alleles where j>2, j one-vs.-rest 'biallelic' tests\n"
2260 " are performed, and the variant is filtered out if any of them fail.\n"
2261 " * With 'keep-fewhet', variants which fail the test in the too-few-hets\n"
2262 " direction are not excluded. On chrX, this uses the ratio between the\n"
2263 " Graffelman/Weir p-value and the female-only p-value.\n"
2264 " * There is currently no special handling of case/control phenotypes.\n"
2265 );
2266 HelpPrint("mach-r2-filter\0minimac3-r2-filter\0", &help_ctrl, 0,
2267 " --mach-r2-filter [min] [max] : Exclude variants with MaCH imputation quality\n"
2268 " metric less than min or greater than max\n"
2269 " (defaults 0.1 and 2.0). (Monomorphic\n"
2270 " variants, with r2 = nan, are not excluded.)\n"
2271 " * This is NOT identical to the R2 metric\n"
2272 " reported by Minimac3 0.1.13+; see below.\n"
2273 " * If a single argument is provided, it is\n"
2274 " treated as the minimum.\n"
2275 " * The metric is not computed on chrX and MT.\n"
2276 " --minimac3-r2-filter <min> [max] : Compute Minimac3 R2 values from scratch,\n"
2277 " and exclude variants with R2 less than min\n"
2278 " or (if max is provided) greater than max.\n"
2279 " * Note that this requires phased-dosage\n"
2280 " data for all samples and variants;\n"
2281 " otherwise this will systematically\n"
2282 " underestimate imputation quality, since\n"
2283 " unphased hardcalls/dosages are treated\n"
2284 " as if they were maximally uncertain.\n"
2285 " (Use --extract-if-info/--exclude-if-info\n"
2286 " to filter on precomputed Minimac3 R2 in\n"
2287 " a VCF/.pvar INFO column.)\n"
2288 );
2289 HelpPrint("keep-females\0keep-males\0keep-nosex\0remove-females\0remove-males\0remove-nosex\0filter-males\0filter-females\0", &help_ctrl, 0,
2290 " --keep-females : Exclude male and unknown-sex samples.\n"
2291 " --keep-males : Exclude female and unknown-sex samples.\n"
2292 " --keep-nosex : Exclude all known-sex samples.\n"
2293 " --remove-females : Exclude female samples.\n"
2294 " --remove-males : Exclude male samples.\n"
2295 " --remove-nosex : Exclude unknown-sex samples.\n"
2296 );
2297 HelpPrint("keep-founders\0keep-nonfounders\0filter-founders\0filter-nonfounders\0geno-counts\0", &help_ctrl, 0,
2298 " --keep-founders : Exclude nonfounder samples.\n"
2299 " --keep-nonfounders : Exclude founder samples.\n"
2300 );
2301 // possible todo: allow or/and of multiple predicates
2302 // best if syntax allows for '=' character inside phenotype/covariate
2303 // names, though...
2304 HelpPrint("keep-if\0remove-if\0filter-cases\0filter-controls\0prune\0", &help_ctrl, 0,
2305 " --keep-if <pheno/covar> <op> <val> : Exclude samples which don't/do satisfy a\n"
2306 " --remove-if <pheno/covar> <op> <v> comparison predicate, e.g.\n"
2307 " --keep-if \"PHENO1 == case\"\n"
2308 " Unless the operator is !=, the predicate\n"
2309 " always evaluates to false when the\n"
2310 " phenotype/covariate is missing.\n"
2311 );
2312 HelpPrint("ac-founders\0nonfounders\0freq\0hardy\0hwe\0bad-freqs\0maf\0min-af\0max-maf\0max-af\0mac\0min-ac\0max-mac\0max-ac\0", &help_ctrl, 0,
2313 " --nonfounders : Include nonfounders in allele freq/count/HWE\n"
2314 " calculations.\n"
2315 );
2316 HelpPrint("ac-founders\0nonfounders\0freq\0mac\0min-ac\0max-mac\0max-ac\0", &help_ctrl, 0,
2317 " --ac-founders : Confirm that nonfounders should be excluded from\n"
2318 " --mac/--max-mac/\"--freq counts\".\n"
2319 );
2320 HelpPrint("make-founders\0", &help_ctrl, 0,
2321 " --make-founders ['require-2-missing'] ['first'] :\n"
2322 " Clear parental IDs for those with 1+ missing parent(s).\n"
2323 );
2324 HelpPrint("bad-freqs\0", &help_ctrl, 0,
2325 " --bad-freqs : When PLINK 2 needs decent allele frequencies, it\n"
2326 " normally errors out if they aren't provided by\n"
2327 " --read-freq and less than 50 founders are available to\n"
2328 " impute them from. Use --bad-freqs to force PLINK 2 to\n"
2329 " proceed in this case.\n"
2330 );
2331 HelpPrint("error-on-freq-calc\0read-freq\0", &help_ctrl, 0,
2332 " --error-on-freq-calc : When working with a very large dataset, the allele\n"
2333 " frequency calculation can be expensive.\n"
2334 " --error-on-freq-calc can help ensure that you aren't\n"
2335 " invoking it unnecessarily.\n"
2336 );
2337 HelpPrint("bad-ld\0", &help_ctrl, 0,
2338 " --bad-ld : PLINK 2 normally errors out when it needs to estimate\n"
2339 " LD between variants, but there are less than 50\n"
2340 " founders to estimate from. Use --bad-ld to force\n"
2341 " PLINK 2 to proceed.\n"
2342 );
2343 HelpPrint("export-allele\0recode-allele\0export\0recode", &help_ctrl, 0,
2344 " --export-allele <file> : With --export A/AD/Av, count alleles named in the\n"
2345 " file, instead of REF alleles.\n"
2346 );
2347 HelpPrint("output-chr\0", &help_ctrl, 0,
2348 " --output-chr <MT code> : Set chromosome coding scheme in output files by\n"
2349 " providing the desired human mitochondrial code.\n"
2350 " Options are '26', 'M', 'MT', '0M', 'chr26', 'chrM',\n"
2351 " and 'chrMT'; default is now 'MT' (note that this is\n"
2352 " a change from PLINK 1.x, which defaulted to '26').\n"
2353 );
2354 HelpPrint("output-missing-genotype\0output-missing-phenotype\0missing-genotype\0missing-phenotype\0", &help_ctrl, 0,
2355 " --output-missing-genotype <ch> : Set the code used to represent missing\n"
2356 " genotypes in PLINK-format files generated by\n"
2357 " --make-[b]pgen/--make-bed/--export (default\n"
2358 " '.' unless that breaks PLINK 1.9, in which\n"
2359 " case it's '0').\n"
2360 " --output-missing-phenotype <s> : Set the string used to represent missing\n"
2361 " phenotypes in PLINK-format files generated\n"
2362 " by --make-[b]pgen/--make-bed/--export\n"
2363 " (default 'NA' for .psam, -9 for older).\n"
2364 );
2365 HelpPrint("sort-vars\0update-chr\0", &help_ctrl, 0,
2366 " --sort-vars [mode] : Sort variants by chromosome, then position, then\n"
2367 " ID. The following string orders are supported:\n"
2368 " * 'natural'/'n': Natural sort (default).\n"
2369 " * 'ascii'/'a': ASCII.\n"
2370 " This must be used with --pmerge[-list],\n"
2371 " --make-[b]pgen/--make-bed, or\n"
2372 " --make-just-{bim,pvar}.\n"
2373 );
2374 HelpPrint("set-invalid-haploid-missing\0set-hh-missing\0set-mixed-mt-missing\0", &help_ctrl, 0,
2375 " --set-invalid-haploid-missing ['keep-dosage'] :\n"
2376 " Make --make-[b]pgen/--make-bed set non-MT heterozygous haploid hardcalls,\n"
2377 " and all female chrY calls, to missing.\n"
2378 " By default, all associated dosages are also erased; use 'keep-dosage' to\n"
2379 " keep them all.\n"
2380 " --set-mixed-mt-missing ['keep-dosage'] : Make --make-[b]pgen/--make-bed set\n"
2381 " mixed MT hardcalls to missing.\n"
2382 );
2383 HelpPrint("split-par\0merge-par\0split-x\0merge-x\0vcf\0bcf\0", &help_ctrl, 0,
2384 " --split-par <bp1> <bp2> : Changes chromosome code of all X chromosome\n"
2385 " --split-par <build> variants with bp position <= bp1 to PAR1, and those\n"
2386 " with position >= bp2 to PAR2. The following build\n"
2387 " codes are supported as shorthand:\n"
2388 " * 'b36'/'hg18' = NCBI 36, 2709521/154584237\n"
2389 " * 'b37'/'hg19' = GRCh37, 2699520/154931044\n"
2390 " * 'b38'/'hg38' = GRCh38, 2781479/155701383\n"
2391 " * 'chm13' = T2T-CHM13, 2394410/153925835\n"
2392 " --merge-par : Merge PAR1/PAR2 back with X. Requires PAR1 to be\n"
2393 " positioned immediately before X, and PAR2 to be\n"
2394 " immediately after X. (Should *not* be used with\n"
2395 " \"--export vcf\", since it causes male\n"
2396 " homozygous/missing calls in PAR1/PAR2 to be\n"
2397 " reported as haploid.)\n"
2398 " --merge-x : Merge XY back with X. This usually has to be\n"
2399 " combined with --sort-vars.\n"
2400 );
2401 HelpPrint("lax-chrx-import\0vcf\0bcf\0gen\0bgen\0data\0haps\0", &help_ctrl, 0,
2402 " --lax-chrx-import : During import of non-PLINK-format data that appears\n"
2403 " to contain chrX, suppress the usual error if\n"
2404 " --split-par, --impute-sex, and/or a\n"
2405 " .fam/.psam/--update-sex file is expected and not\n"
2406 " present.\n"
2407 );
2408 // Probably want a dosage mode, where 0/0/1 gets imported as DS=0.66667,
2409 // etc.
2410 // Do we need a mode that imports 0/1/. as DS=1? ('partial-dosage'?
2411 // Presumably this would force the --vcf-half-call mode to 'haploid'.)
2412 HelpPrint("polyploid-mode\0vcf\0bcf\0bgen\0", &help_ctrl, 0,
2413 " --polyploid-mode <mode> : Specify how ploidy > 2 should be handled during\n"
2414 " import. The following two modes are supported:\n"
2415 " * 'error'/'e' (default) errors out.\n"
2416 " * 'missing'/'m' treats them as missing.\n"
2417 );
2418 HelpPrint("set-all-var-ids\0set-missing-var-ids\0var-id-multi\0var-id-multi-nonsnp\0new-id-max-allele-len\0", &help_ctrl, 0,
2419 " --set-missing-var-ids <t> : Given a template string with a '@' where the\n"
2420 " --set-all-var-ids <t> chromosome code should go and '#' where the bp\n"
2421 " coordinate belongs, --set-missing-var-ids\n"
2422 " assigns chromosome-and-bp-based IDs to unnamed\n"
2423 " variants, while --set-all-var-ids resets all\n"
2424 " IDs.\n"
2425 " You may also use '$r'/'$a' to refer to the\n"
2426 " ref and alt1 alleles, or '$1'/'$2' to refer to\n"
2427 " them in alphabetical order.\n"
2428 " --var-id-multi <t> : Specify alternative templates for multiallelic\n"
2429 " --var-id-multi-nonsnp <t> variants. ('$a' and '$1'/'$2' should be avoided\n"
2430 " here, though they're technically still allowed.)\n"
2431 " --new-id-max-allele-len <len> [{error | missing | truncate}] :\n"
2432 " Specify maximum number of leading characters from allele codes to include\n"
2433 " in new variant IDs, and behavior on longer codes (defaults 23, error).\n"
2434 );
2435 HelpPrint("missing-var-code\0rm-dup\0set-all-var-ids\0set-missing-var-ids\0", &help_ctrl, 0,
2436 " --missing-var-code <str> : Change unnamed variant code for --rm-dup,\n"
2437 " --set-{missing|all}-var-ids, and\n"
2438 " --recover-var-ids (default '.').\n"
2439 );
2440 HelpPrint("update-chr\0update-map\0update-name\0", &help_ctrl, 0,
2441 " --update-chr <f> [chrcol] [IDcol] [skip] : Update variant chromosome codes.\n"
2442 " Now requires --sort-vars.\n"
2443 " --update-map <f> [bpcol] [IDcol] [skip] : Update variant bp positions.\n"
2444 " --update-name <f> [newcol] [oldcol] [skip] : Update variant IDs.\n"
2445 );
2446 HelpPrint("recover-var-ids\0set-all-var-ids\0update-name\0", &help_ctrl, 0,
2447 " --recover-var-ids <file> ['strict-bim-order'] [{rigid | force}] ['partial'] :\n"
2448 " Undo --set-all-var-ids, given the original .pvar/VCF/.bim file. Original\n"
2449 " IDs are looked up by position and allele codes.\n"
2450 " * By default, if the original-ID file is a .bim, allele order is ignored.\n"
2451 " Use 'strict-bim-order' to force A1=ALT, A2=REF.\n"
2452 " * If any variant has multiple matching records in the original-ID file, and\n"
2453 " the IDs conflict, --recover-var-ids writes the affected (current) ID(s)\n"
2454 " to <output prefix>.recoverid.dup, and normally errors out. If the\n"
2455 " original-ID file has the same number of variants in the same order, you\n"
2456 " can still recover the old IDs with the 'rigid' modifier in this case.\n"
2457 " Alternatively, to proceed and assign the missing-ID code to these\n"
2458 " variants, add the 'force' modifier. (The .recoverid.dup file is still\n"
2459 " written when 'rigid' or 'force' is specified.)\n"
2460 " * --recover-var-ids normally expects to replace all variant IDs, and errors\n"
2461 " out if any are left untouched. Add the 'partial' modifier when you\n"
2462 " actually want to update just a proper subset.\n"
2463 );
2464 HelpPrint("update-alleles\0", &help_ctrl, 0,
2465 " --update-alleles ['allow-mismatch'] ['strict-missing'] <filename> :\n"
2466 " Update variant allele codes.\n"
2467 " * Input file can be 3 or 5 columns. If 3-column, variant IDs are expected\n"
2468 " in the first column, comma-separated old allele codes are expected in\n"
2469 " column 2, and comma-separated new allele codes are expected in column 3.\n"
2470 " If 5-column, old allele codes are expected in columns 2-3 and new allele\n"
2471 " codes in columns 4-5.\n"
2472 " * If an entry's old alleles don't line up with the main dataset, it is\n"
2473 " skipped and the variant ID is logged to <output prefix>.allele.no.snp.\n"
2474 " The 'allow-mismatch' modifier relaxes the allele-matching requirement:\n"
2475 " matching alleles are updated even when mismatching allele(s) are present\n"
2476 " (and no .allele.no.snp entry is written when a partial update occurs).\n"
2477 " * By default, if an allele code in the main dataset is missing, it is\n"
2478 " treated as a wildcard. 'strict-missing' causes it to only match missing\n"
2479 " allele codes.\n"
2480 );
2481 HelpPrint("update-ids\0update-parents\0update-sex\0", &help_ctrl, 0,
2482 " --update-ids <fname> : Update sample IDs.\n"
2483 " --update-parents <fname> : Update parental IDs.\n"
2484 " --update-sex <filename> ['col-num='<n>] ['male0'] :\n"
2485 " Update sex information.\n"
2486 " * By default, if there is a header line starting with '#FID'/'#IID', sex is\n"
2487 " loaded from the first column titled 'SEX' (any capitalization);\n"
2488 " otherwise, column 3 is assumed. Use 'col-num=' to force a column number.\n"
2489 " * Only the first character in the sex column is processed. By default,\n"
2490 " '1'/'M'/'m' is interpreted as male, '2'/'F'/'f' is interpreted as female,\n"
2491 " and '0'/'N'/'U'/'u' is interpreted as unknown-sex. To change this to\n"
2492 " '0'/'M'/'m' = male, '1'/'F'/'f' = female, anything else other than '2' =\n"
2493 " unknown-sex, add 'male0'.\n"
2494 );
2495 // don't make --real-ref-alleles apply to e.g. Oxford import, since
2496 // explicit 'ref-first'/'ref-last' modifiers are clearer
2497 HelpPrint("real-ref-alleles\0", &help_ctrl, 0,
2498 " --real-ref-alleles : Treat A2 alleles in a PLINK 1.x fileset as actual REF\n"
2499 " alleles; otherwise they're marked as provisional.\n"
2500 );
2501 HelpPrint("maj-ref\0ref-allele\0alt-allele\0alt1-allele\0a1-allele\0reference-allele\0update-ref-allele\0a2-allele\0keep-allele-order\0", &help_ctrl, 0,
2502 " --ref-allele ['force'] <filename> [refcol] [IDcol] [skip]\n"
2503 " --alt-allele ['force'] <filename> [altcol] [IDcol] [skip]\n"
2504 " --alt1-allele ['force'] <filename> [alt1col] [IDcol] [skip] :\n"
2505 " Set REF/ALT allele order. For each input row, --ref-allele sets the given\n"
2506 " allele to REF, --alt1-allele sets the given allele to ALT1, and\n"
2507 " --alt-allele sets all ALT allele(s).\n"
2508 " * --ref-allele can be used with --alt[1]-allele in the same run.\n"
2509 " * These can only be used in runs with --make-bed/--make-[b]pgen/--export\n"
2510 " and no other commands.\n"
2511 " * \"--ref-allele <VCF filename> 4 3 '#'\", which scrapes reference allele\n"
2512 " assignments from a VCF file, is especially useful.\n"
2513 " * By default, these error out when asked to change a 'known' reference\n"
2514 " allele. Add 'force' to permit that (when e.g. switching to a new\n"
2515 " reference genome).\n"
2516 " * When --alt[1]-allele moves the previous REF allele to an ALT position,\n"
2517 " and the new REF allele isn't explicitly set by --ref-allele, the (first)\n"
2518 " free ALT allele is set to REF and marked as provisional.\n"
2519 " --maj-ref ['force'] :\n"
2520 " Set major alleles to REF, like PLINK 1.x automatically did. (Note that\n"
2521 " this is now opt-in rather than opt-out; --keep-allele-order is no longer\n"
2522 " necessary to prevent allele-swapping.) For multiallelic variants, this\n"
2523 " also sorts ALT alleles by decreasing frequency, with ties going to the\n"
2524 " originally-earlier allele.\n"
2525 " * This is always based on current-dataset allele frequencies. To reduce\n"
2526 " potential for confusion, --maj-ref and --read-freq are no longer allowed to\n"
2527 " be in the same run.\n"
2528 " * This can only be used in runs with --make-bed/--make-[b]pgen/--export and\n"
2529 " no other commands.\n"
2530 " * By default, this only affects variants marked as having 'provisional'\n"
2531 " reference alleles. Add 'force' to apply this to all variants.\n"
2532 " * All new reference alleles are marked as provisional.\n"
2533 );
2534 HelpPrint("ref-from-fa\0maj-ref\0ref-allele\0reference-allele\0update-ref-allele\0a2-allele\0keep-allele-order\0fa\0", &help_ctrl, 0,
2535 " --ref-from-fa ['force'] : This sets reference alleles from the --fa file when\n"
2536 " it can be done unambiguously (note that it's never\n"
2537 " possible for deletions or some insertions).\n"
2538 " By default, it errors out when asked to change a\n"
2539 " 'known' reference allele; add the 'force' modifier\n"
2540 " to permit that.\n"
2541 );
2542 HelpPrint("normalize\0norm\0fa\0", &help_ctrl, 0,
2543 " --normalize ['list'] ['adjust-overlapping-deletions'] :\n"
2544 " (alias: --norm)\n"
2545 " Left-normalize all variants, using the --fa file. (Assumes no differences\n"
2546 " in capitalization.)\n"
2547 " * 'list' causes a list of affected variant IDs to be written to\n"
2548 " <output prefix>.normalized.\n"
2549 " * 'adjust-overlapping-deletions' allows the span of '*'\n"
2550 " overlapping-deletion alleles to be adjusted.\n"
2551 );
2552 HelpPrint("indiv-sort\0pmerge\0pmerge-list\0", &help_ctrl, 0,
2553 " --indiv-sort <mode> [f] : Specify sample ID sort order for merge and\n"
2554 " --make-[b]pgen/--make-bed. The following four\n"
2555 " modes are supported:\n"
2556 " * 'none'/'0' keeps samples in the order they were\n"
2557 " loaded. Default for non-merge.\n"
2558 " * 'natural'/'n' invokes \"natural sort\", e.g.\n"
2559 " 'id2' < 'ID3' < 'id10'. Default when merging.\n"
2560 " * 'ascii'/'a' sorts in ASCII order, e.g.\n"
2561 " 'ID3' < 'id10' < 'id2'.\n"
2562 " * 'file'/'f' uses the order in the given file\n"
2563 " (named in the last argument).\n"
2564 );
2565 HelpPrint("pmerge\0pmerge-list\0delete-pmerge-result\0pmerge-list-dir\0pmerge-output-vzs\0sample-inner-join\0variant-inner-join\0pheno-inner-join\0merge-mode\0merge-parents-mode\0merge-sex-mode\0merge-pheno-mode\0merge-xheader-mode\0merge-qual-mode\0merge-filter-mode\0merge-info-mode\0merge-cm-mode\0", &help_ctrl, 0,
2566 " --pmerge-list-dir <dir> : Specify base dir to join to --pmerge-list entries.\n"
2567 " --pmerge-output-vzs : Compress the .pvar file from --pmerge[-list].\n"
2568 " --delete-pmerge-result : Delete --pmerge[-list] output files at the end of\n"
2569 " the run.\n"
2570 " --sample-inner-join : By default, --pmerge[-list] performs an 'outer\n"
2571 " --variant-inner-join join': the merged fileset contains the union of\n"
2572 " --pheno-inner-join the samples in the input filesets, and ditto for\n"
2573 " variants and phenotypes.\n"
2574 " --{sample,variant,pheno}-inner-join specifies an\n"
2575 " intersection instead.\n"
2576 " --merge-mode <mode> : Set --pmerge[-list] conflict resolution mode for\n"
2577 " --merge-parents-mode <m> genotypes/dosages, parents, sexes, and phenotypes,\n"
2578 " --merge-sex-mode <mode> respectively.\n"
2579 " --merge-pheno-mode <m> * 'nm-match'/'1' = nonmissing values must match\n"
2580 " (default)\n"
2581 " * 'nm-first'/'2' = keep first nonmissing value\n"
2582 " * 'first'/'4' = keep first value, even if missing\n"
2583 " --merge-xheader-mode <m> : Set conflict resolution mode for .pvar header\n"
2584 " entries.\n"
2585 " * 'erase' = remove all\n"
2586 " * 'match' = discard when there's ANY difference in\n"
2587 " the values (even capitalization)\n"
2588 " * 'first' = keep first value (default)\n"
2589 " --merge-qual-mode <mode> : Set conflict resolution mode for\n"
2590 " --merge-filter-mode <m> QUAL/FILTER/INFO/CM entries.\n"
2591 " --merge-info-mode <mode> * 'erase' = remove column\n"
2592 " --merge-cm-mode <mode> * 'nm-match' = nonmissing values must match\n"
2593 " * 'nm-first' = keep first nonmissing (info/CM\n"
2594 " default)\n"
2595 " * 'first' = keep first value, even if missing\n"
2596 " * 'min' = keep minimum value (--merge-qual-mode\n"
2597 " default, not applicable to others)\n"
2598 " * 'np-union' = keep all non-PASS values\n"
2599 " (--merge-filter-mode default, not\n"
2600 " applicable to others)\n"
2601 );
2602 HelpPrint("pmerge\0pmerge-list\0merge-pheno-sort\0merge-info-sort\0", &help_ctrl, 0,
2603 " --merge-pheno-sort <m> : Set sort order for phenotype columns and INFO\n"
2604 " --merge-info-sort <mode> entries when merging.\n"
2605 " * 'none'/'0' = keep in loaded order (default)\n"
2606 " * 'ascii'/'a' = ASCII order\n"
2607 " * 'natural'/'n' = natural sort\n"
2608 );
2609 HelpPrint("pmerge\0pmerge-list\0merge-max-alleles\0merge-max-allele-ct\0", &help_ctrl, 0,
2610 " --merge-max-alleles <ct> : Exclude merged variants with more than the\n"
2611 " specified number of alleles.\n"
2612 );
2613 HelpPrint("pmerge\0pmerge-list\0multiallelics-already-joined\0", &help_ctrl, 0,
2614 " --multiallelics-already-joined : Prevent --pmerge[-list] from erroring out\n"
2615 " when a .pvar file appears to have a 'split'\n"
2616 " multiallelic variant.\n"
2617 );
2618 HelpPrint("indep-preferred\0indep-pairwise\0", &help_ctrl, 0,
2619 " --indep-preferred <filename> : Make LD-pruning commands try to keep the\n"
2620 " variants listed in a file.\n"
2621 );
2622 HelpPrint("indep-order\0indep-pairwise\0", &help_ctrl, 0,
2623 " --indep-order <mode> : Set LD-pruning order.\n"
2624 " * '1' = replicate PLINK 1.x (current default, will be\n"
2625 " changed soon)\n"
2626 " * '2' = within each window, scan backwards (faster)\n"
2627 );
2628 HelpPrint("ld-window\0ld-window-kb\0ld-window-cm\0ld-window-r2\0r-phased\0r-unphased\0r2-phased\0r2-unphased\0r\0r2\0", &help_ctrl, 0,
2629 " --ld-window <#var+1> : Limit --r[2]-[un]phased variant-ct distance.\n"
2630 " --ld-window-kb <#kb> : Change tabular --r[2]-[un]phased max kb distance\n"
2631 " (default 1000).\n"
2632 " --ld-window-cm <#cm> : Limit --r[2]-[un]phased centimorgan distance.\n"
2633 );
2634 HelpPrint("ld-window-r2\0r-phased\0r-unphased\0r2-phased\0r2-unphased\0r\0r2\0", &help_ctrl, 0,
2635 " --ld-window-r2 <min> : Change tabular --r[2]-[un]phased minimum r^2 (default\n"
2636 " 0.2).\n"
2637 );
2638 HelpPrint("ld-snp\0ld-snps\0ld-snp-list\0r-phased\0r-unphased\0r2-phased\0r2-unphased\0r\0r2\0", &help_ctrl, 0,
2639 " --ld-snp <var. ID> : Restrict the first variant in --r[2]-[un]phased\n"
2640 " --ld-snps <varID...> variant-pairs to a limited set. --ld-snp specifies\n"
2641 " --ld-snp-list <file> a single ID, --ld-snps accepts one or more ranges\n"
2642 " (same syntax as --snps), and --ld-snp-list specifies a\n"
2643 " file to load variant IDs from.\n"
2644 );
2645 // todo: add citation for 2018 KING update paper, which should discuss the
2646 // two-stage screen + refine workflow supported by --king-table-subset,
2647 // when it comes out
2648 HelpPrint("make-king\0make-king-table\0king-table-filter\0king-table-subset\0king-table-require\0king-table-require-xor\0", &help_ctrl, 0,
2649 " --king-table-filter <min> : Specify minimum kinship coefficient for\n"
2650 " inclusion in --make-king-table report.\n"
2651 " --king-table-subset <f> [kmin] : Restrict current --make-king-table run to\n"
2652 " sample pairs listed in the given .kin0 file.\n"
2653 " If a second argument is provided, only\n"
2654 " sample pairs with kinship >= that threshold\n"
2655 " (in the input .kin0) are processed.\n"
2656 " --king-table-require <fn...> : Restrict current --make-king-table run to\n"
2657 " sample pairs that include at least one of\n"
2658 " the samples in the given file.\n"
2659 " --king-table-require-xor <...> : Restrict current --make-king-table run to\n"
2660 " sample pairs that include exactly one of the\n"
2661 " samples in the given file.\n"
2662 );
2663 HelpPrint("glm\0linear\0logistic\0condition\0condition-list\0parameters\0tests\0", &help_ctrl, 0,
2664 " --condition <variant ID> [{dominant | recessive}] ['multiallelic']\n"
2665 " --condition-list <fname> [{dominant | recessive}] ['multiallelic'] :\n"
2666 " Add the given variant, or all variants in the given file, as --glm\n"
2667 " covariates.\n"
2668 " By default, this errors out if any of the variants are multiallelic; add\n"
2669 " the 'multiallelic' ('m' for short) modifier to allow them. They'll\n"
2670 " effectively be split against the major allele (unless --glm's 'omit-ref'\n"
2671 " modifier was specified), and all induced covariate names--even for\n"
2672 " biallelic variants--will have an underscore followed by the allele code at\n"
2673 " the end.\n"
2674 " --parameters <...> : Include only the given covariates/interactions in the\n"
2675 " --glm model, identified by a list of 1-based indices\n"
2676 " and/or ranges of them.\n"
2677 " --tests <...> : Perform a (joint) test on the specified term(s) in the\n"
2678 " --tests all --glm model, identified by 1-based indices and/or ranges\n"
2679 " of them.\n"
2680 /*
2681 " of them. If permutation was requested, it is based on\n"
2682 " this test.\n"
2683 */
2684 " * Note that, when --parameters is also present, the\n"
2685 " indices refer to the terms remaining AFTER pruning by\n"
2686 " --parameters.\n"
2687 " * You can use '--tests all' to include all terms.\n"
2688 );
2689 HelpPrint("glm\0linear\0logistic\0vif\0max-corr\0", &help_ctrl, 0,
2690 " --vif <max VIF> : Set VIF threshold for --glm multicollinearity check\n"
2691 " (default 50). (This is no longer skipped for\n"
2692 " case/control phenotypes.)\n"
2693 " --max-corr <val> : Skip --glm regression when the absolute value of the\n"
2694 " correlation between two predictors exceeds this value\n"
2695 " (default 0.999).\n"
2696 );
2697 HelpPrint("xchr-model\0glm\0linear\0logistic\0score\0score-list\0vscore\0", &help_ctrl, 0,
2698 " --xchr-model <m> : Set the chrX model for --glm, --condition[-list],\n"
2699 " --score[-list], and --vscore.\n"
2700 " * '0' = skip chrX.\n"
2701 " * '1' = add sex as a covar on chrX, code males 0..1.\n"
2702 " * '2' (default) = chrX sex covar, code males 0..2.\n"
2703 " (Use the --glm 'interaction' modifier to test for\n"
2704 " interaction between genotype and sex.)\n"
2705 );
2706 HelpPrint("adjust\0", &help_ctrl, 0,
2707 " --adjust ['zs'] ['gc'] ['log10'] ['cols='<column set descriptor>] :\n"
2708 " For each association test in this run, report some basic multiple-testing\n"
2709 " corrections, sorted in increasing-p-value order. Modifiers work the same\n"
2710 " way as they do on --adjust-file.\n"
2711 );
2712 HelpPrint("adjust\0adjust-file\0lambda\0", &help_ctrl, 0,
2713 " --lambda : Set genomic control lambda for --adjust[-file].\n"
2714 );
2715 HelpPrint("adjust-chr-field\0adjust-pos-field\0adjust-id-field\0adjust-ref-field\0adjust-alt-field\0adjust-a1-field\0adjust-test-field\0adjust-p-field\0adjust-file\0", &help_ctrl, 0,
2716 " --adjust-chr-field <n...> : Set --adjust-file input field names. When\n"
2717 " --adjust-pos-field <n...> multiple arguments are given to these flags,\n"
2718 " --adjust-id-field <n...> earlier names take precedence over later\n"
2719 " --adjust-ref-field <n...> ones.\n"
2720 " --adjust-alt-field <n...>\n"
2721 " --adjust-provref-field <n...>\n"
2722 " --adjust-a1-field <n...>\n"
2723 " --adjust-test-field <n...>\n"
2724 " --adjust-p-field <n...>\n"
2725 );
2726 HelpPrint("ci\0linear\0logistic\0", &help_ctrl, 0,
2727 " --ci <size> : Report confidence ratios for odds ratios/betas.\n"
2728 );
2729 HelpPrint("pfilter\0", &help_ctrl, 0,
2730 " --pfilter <val> : Filter out assoc. test results with higher p-values.\n"
2731 );
2732 /*
2733 HelpPrint("aperm\0", &help_ctrl, 0,
2734 " --aperm <min perms - 1> [max perms] [alpha] [beta] [init interval] [slope] :\n"
2735 " Set up to six parameters controlling adaptive permutation tests.\n"
2736 " * The first two control the minimum and maximum number of permutations that\n"
2737 " may be run for each variant; default values are 5 and 1000000.\n"
2738 " * The next two control the early termination condition. A\n"
2739 " 100% * (1 - beta/2T) confidence interval is calculated for each empirical\n"
2740 " p-value, where T is the total number of variants; whenever this\n"
2741 " confidence interval doesn't contain alpha, the variant is exempted from\n"
2742 " further permutation testing. Default values are 0 and 1e-4.\n"
2743 " * The last two control when the early termination condition is checked. If\n"
2744 " a check occurs at permutation #p, the next check occurs after\n"
2745 " [slope]p + [init interval] more permutations (rounded down). Default\n"
2746 " initial interval is 1, and default slope is 0.001.\n"
2747 );
2748 HelpPrint("mperm-save\0mperm-save-all\0", &help_ctrl, 0,
2749 " --mperm-save : Save best max(T) permutation test statistics.\n"
2750 " --mperm-save-all : Save all max(T) permutation test statistics.\n"
2751 );
2752 */
2753 HelpPrint("clump-p1\0clump-p2\0clump-r2\0clump-kb\0clump-unphased\0clump-log10\0clump-range\0clump-range0\0clump-range-border\0clump-bins\0clump-id-field\0clump-p-field\0clump-a1-field\0clump-test-field\0clump-force-a1\0clump-test\0clump-snp-field\0clump-field\0clump\0", &help_ctrl, 0,
2754 " --clump-p1 <pval> : Set --clump index var. p-value ceiling (default 1e-4).\n"
2755 " --clump-p2 <pval> : Set --clump secondary p-value threshold (default 0.01).\n"
2756 " --clump-r2 <r^2> : Set --clump r^2 threshold (default 0.5).\n"
2757 " --clump-kb <# kb> : Set --clump kb radius (default 250).\n"
2758 " --clump-unphased : Make --clump use unphased rather than phased r^2.\n"
2759 " --clump-log10 ['input-only' | 'output-only'] : Read and/or write p-values in\n"
2760 " -log10 form.\n"
2761 " --clump-log10-p1 <-l10(p)> : Alternatives to --clump-p1/--clump-p2 that take\n"
2762 " --clump-log10-p2 <-l10(p)> the p-value argument in -log10 form.\n"
2763 " --clump-range[0] <fname> : Report overlaps between clumps and regions.\n"
2764 " --clump-range0 specifies 0-based input\n"
2765 " coordinates.\n"
2766 " --clump-range-border <kb> : Stretch regions in --clump-range[0] file.\n"
2767 " --clump-bins <bndries...> : Set --clump p-value bin boundaries (default\n"
2768 " 0.0001,0.001,0.01,0.05).\n"
2769 " --clump-id-field <nm...> : Set --clump variant ID (default 'ID SNP'),\n"
2770 " --clump-p-field <nm...> p-value (default 'P', unless -log10), effect\n"
2771 " --clump-a1-field [nm...] allele (default 'A1'), and/or test (default\n"
2772 " --clump-test-field [n...] 'TEST') field name search orders.\n"
2773 " With multiple field names, earlier names take\n"
2774 " precedence over later ones.\n"
2775 " --clump-force-a1 : Force A1 alleles to be included in --clump\n"
2776 " report for biallelic variants.\n"
2777 " --clump-test [test ID...] : When the --clump-test-field column exists, only\n"
2778 " consider these test value(s) (default 'ADD').\n"
2779 );
2780 HelpPrint("clump-allow-overlap\0clump\0", &help_ctrl, 0,
2781 " --clump-allow-overlap : Let --clump non-index variants join multiple\n"
2782 " clumps.\n"
2783 );
2784 HelpPrint("score-col-nums\0score\0score-list\0", &help_ctrl, 0,
2785 " --score-col-nums <...> : Process all the specified coefficient columns in the\n"
2786 " --score[-list] file(s), identified by 1-based\n"
2787 " indexes and/or ranges of them.\n"
2788 );
2789 HelpPrint("q-score-range\0score\0score-list\0", &help_ctrl, 0,
2790 " --q-score-range <range file> <data file> [i] [j] ['header'] ['min'] :\n"
2791 " Apply --score[-list] to subset(s) of variants in the primary score list(s)\n"
2792 " based on e.g. p-value ranges.\n"
2793 " * The first file should have range labels in the first column, p-value\n"
2794 " lower bounds in the second column, and upper bounds in the third column.\n"
2795 " Lines with too few entries, or nonnumeric values in the second or third\n"
2796 " column, are ignored.\n"
2797 " * The second file should contain a variant ID and a p-value on each line\n"
2798 " (except possibly the first). Variant IDs are read from column #i and\n"
2799 " p-values are read from column #j, where i defaults to 1 and j defaults to\n"
2800 " i+1. The 'header' modifier causes the first nonempty line of this file\n"
2801 " to be skipped.\n"
2802 " * By default, --q-score-range errors out when a variant ID appears multiple\n"
2803 " times in the data file (and is also present in the main dataset). To use\n"
2804 " the minimum p-value in this case instead, add the 'min' modifier.\n"
2805 );
2806 HelpPrint("vscore-col-nums\0variant-score\0vscore\0", &help_ctrl, 0,
2807 " --vscore-col-nums <...> : Process all the specified coefficient columns in\n"
2808 " the --variant-score file, identified by 1-based\n"
2809 " indexes and/or ranges of them.\n"
2810 );
2811 HelpPrint("parallel\0", &help_ctrl, 0,
2812 " --parallel <k> <n> : Divide the output matrix into n pieces, and only compute\n"
2813 " the kth piece. The primary output file will have the\n"
2814 " piece number included in its name, e.g. plink2.king.13\n"
2815 " or plink2.king.13.zst if k is 13. Concatenating these\n"
2816 " files in order will yield the full matrix of interest.\n"
2817 " (Yes, this can be done before decompression.)\n"
2818 " N.B. This generally cannot be used to directly write a\n"
2819 " symmetric square matrix. Choose square0 or triangle\n"
2820 " shape instead, and postprocess as necessary.\n"
2821 );
2822 HelpPrint("memory\0seed\0", &help_ctrl, 0,
2823 " --memory <val> ['require'] : Set size, in MiB, of initial workspace malloc\n"
2824 " attempt. To error out instead of reducing the\n"
2825 " request size when the initial attempt fails, add\n"
2826 " the 'require' modifier.\n"
2827 );
2828 HelpPrint("threads\0num_threads\0thread-num\0seed\0", &help_ctrl, 0,
2829 " --threads <val> : Set maximum number of compute threads.\n"
2830 );
2831 HelpPrint("d\0covar-name\0exclude-snps\0pheno-name\0snps", &help_ctrl, 0,
2832 " --d <char> : Change variant/covariate range delimiter (normally '-').\n"
2833 );
2834 HelpPrint("seed\0", &help_ctrl, 0,
2835 " --seed <val...> : Set random number seed(s). Each value must be an\n"
2836 " integer between 0 and 4294967295 inclusive.\n"
2837 " Note that --threads and \"--memory require\" may also be\n"
2838 " needed to reproduce some randomized runs.\n"
2839 );
2840 HelpPrint("native\0", &help_ctrl, 0,
2841 " --native : Allow Intel MKL to use processor-dependent code paths.\n"
2842 );
2843 HelpPrint("output-min-p\0", &help_ctrl, 0,
2844 " --output-min-p <p> : Specify minimum p-value to write to reports. (2.23e-308\n"
2845 " is useful for preventing underflow in some programs.)\n"
2846 );
2847 HelpPrint("debug\0randmem\0", &help_ctrl, 0,
2848 " --debug : Use slower, more crash-resistant logging method.\n"
2849 " --randmem : Randomize initial workspace memory (helps catch\n"
2850 " uninitialized-memory bugs).\n"
2851 );
2852 HelpPrint("warning-errcode\0", &help_ctrl, 0,
2853 " --warning-errcode : Return a nonzero error code to the OS when a run\n"
2854 " completes with warning(s).\n"
2855 );
2856 // possible todo: --zst-block {block size} to generate seekable files
2857 HelpPrint("zst-level\0", &help_ctrl, 0,
2858 " --zst-level <lvl> : Set the Zstd compression level (1-22, default 3).\n"
2859 );
2860 HelpPrint("allow-misleading-out-arg\0out\0", &help_ctrl, 0,
2861 " --allow-misleading-out-arg : Allow --out argument to end in a common\n"
2862 " filename extension, even though that usually\n"
2863 " corresponds to a misunderstanding of how --out\n"
2864 " works.\n"
2865 );
2866 HelpPrint("allow-normalize-with-split\0normalize\0", &help_ctrl, 0,
2867 " --allow-normalize-with-split : Disable the --normalize + variant-split\n"
2868 " order-of-operations warning (which will become\n"
2869 " an error in a future build).\n"
2870 );
2871 if (!param_ct) {
2872 fputs(
2873 "\nPrimary methods paper:\n"
2874 "Chang CC, Chow CC, Tellier LCAM, Vattikuti S, Purcell SM, Lee JJ (2015)\n"
2875 "Second-generation PLINK: rising to the challenge of larger and richer datasets.\n"
2876 "GigaScience, 4.\n"
2877 , stdout);
2878 }
2879 } while (help_ctrl.iters_left--);
2880 if (help_ctrl.unmatched_ct) {
2881 net_unmatched_ct = help_ctrl.unmatched_ct;
2882 printf("\nNo help entr%s for", (help_ctrl.unmatched_ct == 1)? "y" : "ies");
2883 col_num = (help_ctrl.unmatched_ct == 1)? 17 : 19;
2884 arg_uidx = 0;
2885 // er, should replace the \n logic with a WordWrap() call
2886 while (help_ctrl.unmatched_ct) {
2887 arg_uidx = AdvTo0Bit(help_ctrl.all_match_arr, arg_uidx);
2888 help_ctrl.unmatched_ct--;
2889 if (help_ctrl.unmatched_ct) {
2890 if (net_unmatched_ct == 2) {
2891 if (help_ctrl.param_slens[arg_uidx] + col_num > 76) {
2892 putc_unlocked('\n', stdout);
2893 col_num = 2 + help_ctrl.param_slens[arg_uidx];
2894 } else {
2895 putc_unlocked(' ', stdout);
2896 col_num += 3 + help_ctrl.param_slens[arg_uidx];
2897 }
2898 putc_unlocked('\'', stdout);
2899 fputs(argvk[arg_uidx], stdout);
2900 putc_unlocked('\'', stdout);
2901 } else {
2902 if (help_ctrl.param_slens[arg_uidx] + col_num > 75) {
2903 putc_unlocked('\n', stdout);
2904 col_num = 3 + help_ctrl.param_slens[arg_uidx];
2905 } else {
2906 putc_unlocked(' ', stdout);
2907 col_num += 4 + help_ctrl.param_slens[arg_uidx];
2908 }
2909 putc_unlocked('\'', stdout);
2910 fputs(argvk[arg_uidx], stdout);
2911 fputs("',", stdout);
2912 }
2913 if (help_ctrl.unmatched_ct == 1) {
2914 if (col_num > 76) {
2915 fputs("\nor", stdout);
2916 col_num = 2;
2917 } else {
2918 fputs(" or", stdout);
2919 col_num += 3;
2920 }
2921 }
2922 } else {
2923 putc_unlocked((help_ctrl.param_slens[arg_uidx] + col_num > 75)? '\n' : ' ', stdout);
2924 putc_unlocked('\'', stdout);
2925 fputs(argvk[arg_uidx], stdout);
2926 fputs("\'.\n", stdout);
2927 }
2928 arg_uidx++;
2929 }
2930 }
2931 if (param_ct) {
2932 while (0) {
2933 DispHelp_ret_NOMEM:
2934 reterr = kPglRetNomem;
2935 }
2936 free_cond(help_ctrl.param_slens);
2937 free_cond(help_ctrl.all_match_arr);
2938 free_cond(new_argv);
2939 }
2940 return reterr;
2941 }
2942
2943 #ifdef __cplusplus
2944 }
2945 #endif