Bundled utilities
PLINK 2 is currently packaged with 4 other programs, which cover related functions outside PLINK's scope.
ldsc
ldsc (plink-ng) v0.1
LD Score regression (Bulik-Sullivan et al. 2015).
Usage: ldsc --munge <raw sumstats> --out <prefix>
ldsc --h2-cts <sumstats> --ref-ld-chr <baseline>
--ref-ld-chr-cts <cell type file> --w-ld-chr <weights>
--out <prefix>
ldsc --h2 <sumstats> --ref-ld[-chr] <LD Scores>
--w-ld[-chr] <LD Scores> --out <prefix>
ldsc --rg <sumstats1,sumstats2,...> --ref-ld[-chr] <LD Scores>
--w-ld[-chr] <LD Scores> --out <prefix>
--munge Convert a raw GWAS summary statistic file into the
.sumstats format the regressions read, applying the
reference implementation's quality control: INFO,
frequency, p-value range, allele and sample-size
filters, duplicate IDs dropped, and the p-value plus
the signed statistic turned into a signed Z. Columns
are detected case-insensitively, with the same aliases;
--snp/--a1/--a2/--p/--N-col/--N-cas-col/--N-con-col/
--frq/--info/--info-list/--nstudy name them explicitly,
--signed-sumstats <column>,<null value> picks the
signed one, and --ignore <columns> drops some.
Thresholds: --info-min (0.9), --maf-min (0.01),
--n-min (the 90th percentile of N over 1.5),
--nstudy-min. --N/--N-cas/--N-con supply a sample size
the file does not have, --daner reads it from PGC
FRQ_A_/FRQ_U_ column names, --a1-inc says A1 is always
the trait-increasing allele, --no-alleles accepts a
file without them, --keep-maf keeps the frequency
column, and --merge-alleles <file> restricts to a
variant list and puts everything on its alleles.
Writes <prefix>.sumstats, with Z and N to three
decimals as the reference implementation does.
--h2 Estimate SNP-heritability from one summary statistic
file. Columns are detected case-insensitively: an ID
(SNP/ID), Z, and N.
--h2-cts Cell-type-specific analysis: with --ref-ld-chr-cts
<file>, one line per cell type naming it and its LD
Scores, each cell type is regressed alongside the
baseline annotations from --ref-ld[-chr], and its own
coefficient is reported. Writes
<prefix>.cell_type_results.txt, sorted by p-value.
Add --print-all-cts to report every column of a
multi-column cell-type fileset.
--rg Estimate genetic correlation between the first file and
each of the others. A1 and A2 are then required too;
Z is flipped where the effect alleles are swapped, and
strand-ambiguous variants are dropped.
--ref-ld LD Scores for the regression, with SNP (or ID) and L2
columns. plink2 --ld-score output can be used directly,
and so can ldsc's <prefix>.l2.ldscore[.gz]. Every column
other than the ID, the position and MAF/CM is taken as an
annotation, and a comma-separated list of filesets is
concatenated sideways, so a partitioned (stratified)
regression is what you get from partitioned LD Scores.
That needs the .l2.M_5_50 files, and turns the two-step
estimator off in favour of a chi^2 ceiling, as in the
reference implementation.
--ref-ld-chr One LD Score fileset per chromosome; '@' in the
argument is replaced by the chromosome number, and
otherwise it is appended.
--w-ld[-chr] LD Scores for the regression weights: the same sum of
r^2, but taken over only the regression variants.
--M Number of variants the LD Scores were computed from.
Defaults to the .l2.M_5_50 files next to --ref-ld, or,
when those are absent, to the number of LD Scores read.
--not-M-5-50 Use the .l2.M files (all variants) rather than the
.l2.M_5_50 files (common variants only).
--n-blocks Jackknife block count (default 200).
--two-step Cutoff for the two-step estimator; the first step uses
the variants below it. Defaults to 30 when the
intercept is free, and to off when it is constrained.
--chisq-max Drop variants with chi^2 above this. Off by default.
--no-intercept Constrain the h2 intercept to 1 and the genetic
covariance intercept to 0, i.e. assume no confounding
and no sample overlap.
--intercept-h2 Constrain the h2 intercept(s) instead, one value
per phenotype ('N' to leave one free).
--intercept-gencov Constrain the genetic covariance intercept(s).
--samp-prev, --pop-prev Sample and population prevalence per
phenotype; both together convert the observed-scale
estimates to the liability scale.
--overlap-annot Correct the partitioned proportions and
enrichments for annotations that overlap, using the
.annot files next to --ref-ld. Adds an enrichment
standard error and p-value to the .results file.
--frqfile[-chr] Allele frequencies, to restrict the overlap
counts to variants with 5% < MAF < 50%, which is the
band the .l2.M_5_50 counts use.
--print-cov Write the jackknife covariance matrix of the LD
Score coefficients to <prefix>.cov (one file per
regression, for --rg).
--print-delete-vals Write the block jackknife delete values to
<prefix>.delete and <prefix>.part_delete, which is what
a meta-analysis over jackknife blocks needs.
--no-check-alleles Skip the allele-matching step of --rg. Only
safe if both files are known to be on the same strand
with the same effect alleles.
--out Output prefix; writes <prefix>.log plus <prefix>.h2 or
<prefix>.rg with the estimates at full precision, and
<prefix>.results for a partitioned regression.
ldsc is a C++ reimplementation of https://github.com/bulik/ldsc, to address Python 2.7 and 3.9's end-of-life status.
mtag
mtag (plink-ng) v0.1
Multi-Trait Analysis of GWAS (Turley et al. 2018).
Usage: mtag --sumstats <file1,file2,...> --ldscore <file>
--out <prefix> [--m <count>] [--threads <n>]
--sumstats One GWAS summary statistics file per trait, comma
separated. Columns are detected case-insensitively:
an ID (SNP/ID/MarkerName), A1 and A2, an effect
(Z, or BETA and SE, or OR and SE), and a sample size
(N, or N_CAS and N_CON). The traits are inner-joined
on ID and put on a common allele orientation; effect
directions are flipped where A1/A2 are swapped, and
strand-ambiguous A/T and C/G variants are dropped,
since their orientation cannot be recovered.
--n Sample size to use where a file has no N column.
--keep-palindromic Keep strand-ambiguous variants. Only safe
if every input is known to be on the same strand.
--zn Alternative pre-merged input, with a header line
'ID Z1 N1 Z2 N2 ...' and one row per variant.
--ldscore LD Scores, with SNP and L2 columns. Sigma is then
estimated by LD Score regression: univariate intercepts
on the diagonal, bivariate intercepts off it.
--sigma Supply the residual covariance matrix directly instead,
one row per trait.
--m Number of variants the LD Scores were estimated from;
defaults to the number read from --ldscore.
--out Output prefix; writes <prefix>.mtag.
--intervals maxFDR grid resolution per dimension (default 10).
--p-sig Significance threshold for maxFDR (default 5e-8).
--no-maxfdr Skip the maxFDR diagnostic. Not recommended: MTAG
assumes one effect covariance matrix for every
variant, and maxFDR is what bounds the cost of that
assumption being wrong.
mtag is a C++ reimplementation of https://github.com/JonJala/mtag, to address Python 2.7's end-of-life status.
pgen_compress
Usage:
pgen_compress [-i] <input .bed or .pgen> <output filename> [sample_ct]
* sample_ct is required when loading a .bed file
* -i causes the index to be saved to a separate .pgen.pgi file (usually it's
embedded at the front of the .pgen); this is compatible with fully
sequential .pgen writing
pgen_compress is a spartan C/C++ program which primarily serves as a demonstration of how to use PLINK 2's pgenlib library to perform .pgen I/O. It can be used to convert PLINK 1 .bed files to .pgen (no .bim or .fam needed).
vcf_subset
vcf_subset v1.1.0 M1 (16 May 2026) cog-genomics.org/plink/2.0/
(C) 2024-2026 Christopher Chang, Carsten Erickson GNU LGPL v3
Usage: vcf_subset [options...] --in <input VCF path> --out <output VCF path>
Optional flags:
--allow-any-paths : By default, the program errors out if the input and
output paths don't end in '.vcf', '.vcf.gz', or
'.vcf.bgz'. Use this flag to remove the restriction.
--allow-no-samples : By default, the program errors out if --indv and/or
--keep causes no samples to remain. Use this flag to
remove the restriction.
--bgz-level <#> : Set bgzip compression level (1-12, default 6). Note
that compression occurs iff the --out path ends in '.gz'
or '.bgz'.
--erase-info : Remove INFO header lines, set all INFO entries to '.'.
--exclude <fname> : Keep only variants whose ID is NOT in the given file.
--extract <fname> : Keep only variants whose ID is in the given file.
--help : Just display this help text.
--indv <ID> : Keep only the sample with the given ID.
--keep <filename> : Keep only samples with IDs in the given file.
--memory <#> : Set size, in MiB, of initial workspace malloc attempt.
--no-samples : Remove all samples.
--threads <#> : Set maximum number of compute threads.
--version : Just display version string.
PLINK 2's import flags are designed to import full datasets. If you use --vcf with e.g. --keep or --extract to import a small fraction of the samples/variants in a VCF, that's inefficient: under the order of operations, the entire VCF is first converted to a .pgen fileset, and then PLINK 2 proceeds as if you started with that .pgen fileset.
The vcf_subset program lets you filter up-front, and is frequently much more efficient than e.g. bcftools. Since it generates another VCF rather than converting to .pgen, it can come in handy in workflows that don't touch PLINK 2 at all.
Note that this doesn't work on BCF files; contact us if you want that functionality.
Miscellany >>
|