Connect variant records to allele dosage
A genotype value needs a person, a variant, and an allele convention. The value
2 means two copies of a specified allele in a diploid additive model. It does
not identify that allele on its own, and changing the counted allele changes
the interpretation of a regression coefficient.
Read the three files together
Section titled “Read the three files together”PLINK’s PGEN format documentation requires the genotype table and its accompanying variant and sample records.
| File | Content |
|---|---|
| PGEN | The file stores genotype calls and their encoded phase information. |
| PVAR | The records define chromosome, position, identifier, reference allele, and alternate allele in genotype row order. |
| PSAM | The records define sample identifiers and accompanying metadata in genotype column order. |
The selected archive uses the GRCh38 full analysis reference with decoy and HLA sequences. The tutorial restricts its calculations to biallelic autosomal SNPs. That restriction is an analysis choice; the source archive also contains records outside the selected class.
The compressed .pgen.zst file must be decompressed before PLINK reads its
genotypes. PLINK can read the compressed .pvar.zst directly. The
primary execution record preserves
the exact input names and commands.
Give a variant an unambiguous key
Section titled “Give a variant an unambiguous key”The workflow preserves every original rs identifier and assigns each eligible SNP a key with chromosome, position, reference allele, and alternate allele. Two records with the same coordinate can describe different alleles. An rs identifier alone therefore cannot establish that two dosage columns describe the same variant.
The key does not change the chromosome position or the allele sequences. The
workflow preserves PVAR row order while it assigns identifiers, then asks PLINK
to compare duplicate keys with --rm-dup error. An inconsistent duplicate
stops preparation. Identical duplicate records contribute one retained marker.
Reference metadata identifies the assembly used by the source. These checks do not realign reads, normalize every original structural variant, or verify each reference base against a separately downloaded genome sequence.
Count the alternate allele explicitly
Section titled “Count the alternate allele explicitly”PLINK’s additive text export and association command do not share an automatic
promise to count the same allele. The workflow supplies an explicit ALT list
to --export-allele and uses --glm omit-ref for the scans. It checks the
exported column names against the variant table and checks every association
A1 field against the declared ALT allele.
The R and Python refits use those exported ALT dosages. Their regression checks compare the complete sample list, model matrix, coefficient, standard error, test statistic, and p-value. Numerical agreement follows the identity checks; it cannot repair an incorrect allele join.
Preserve phase without confusing the estimand
Section titled “Preserve phase without confusing the estimand”The archived genotypes are phased. The teaching regression uses additive
dosages, and the LD figures use squared correlations between those dosage
vectors. PLINK calls that statistic --r2-unphased to distinguish it from
haplotype-frequency LD.
The analysis retains phase in its working PGEN files, but its dosage correlation does not use haplotype phase. A result from this calculation should not be reported as a phase-based LD estimate.
Further reading
Section titled “Further reading”-
The manual defines PGEN, PVAR, and PSAM and explains how genotype, variant, and sample records fit together. Use it to check identifiers and alleles before joining a result table to genotype metadata.
-
The association manual defines the tested allele and the regression output fields. It helps prevent an effect estimate from being assigned to the wrong allele after a format conversion.