Teaching · Practical course
File formats
Between the genotyping array and PLINK 2 the same data change shape nine times. This page shows each shape with a small example: 4 people and 8 variants, the same in every format. The files are invented. They are public and you can open them, read them and download them.
The route
Each arrow is one conversion. The course works from the PLINK binary format. Open a box to see the example files.
- IDATbinary
Next step: GenomeStudio or DRAGEN Array, with the manifest and the cluster file
- Manifestbinary and text
Next step: used together with the IDAT files and the cluster file
- GTCbinary
Next step: GenomeStudio (Report Wizard)
- Final Reporttext
Next step:
Rscript scripts/final_report_to_lgen.R Next step:
plink2 --lfile example --make-bed --out example- .ped and .maptext
Next step:
plink2 --pedmap example --make-bed --out example - .bed, .bim and .fambinary and text
Next step:
plink2 --bfile example --make-pgen --out example - .pgen, .pvar and .psambinary and text
Next step:
plink2 --bfile example --export vcf id-paste=iid --out example - VCFtext
One genotype in every format
Sample S01 at variant 1:1000123 carries the genotype A/G. Here is where it sits in each format. The marked part is the one to look at.
- IDAT
200000000001_R01C01_Grn.idat
No genotype yet. S01 is in position R01C01 on the chip, and the file holds light only.
- Manifest
1:1000123-0_T_F_2296491777,1:1000123,TOP,[A/G],10600007,GATATAGGCAACGACATGTGCGGCGACCCTTGCGACAGTGACGCTTTCGC,,,38,1,1000123,TOP,+
The manifest names the variant and its position. It holds no genotype.
- Final Report
1:1000123 S01 A G A G 0.8721 1 1000123
The two letters, on the Plus strand.
- .lgen
S01 S01 1:1000123 A G
One line for this person and this variant.
- .ped
S01 S01 0 0 2 2 A G C C A T C G A C T T A G C T
The first pair of letters after the six first columns.
- .bim
1 1:1000123 0 1000123 G A
The variant table. Column 5 is the first allele (ALT), column 6 the second (REF).
- .pvar
1 1000123 1:1000123 A G
The same variant in PLINK 2: REF first, then ALT.
- VCF
1 1000123 1:1000123 A G . . PR GT 0/1 0/0 1/1 0/1
0/1 means one REF (A) and one ALT (G): a heterozygote.
- .bed
byte 4 = 8e = 10001110
The four genotypes of this variant share one byte, two bits each. S01 is the first sample, so its genotype is the last two bits,
10, which means heterozygous. - GTC, .pgen
Binary formats: you read them with a program, not by eye.
Format 1 of 9
IDAT
- What it contains
- Light intensities for each bead type, in two colours (Grn and Red). No genotypes.
- Who makes it
- iScan scanner
- Type
- Binary, extension
.idat - Next
- GTC: GenomeStudio or DRAGEN Array, with the manifest and the cluster file
Produced by: the iScan scanner after the array has been processed. Type: binary. You cannot open it in a text editor.
What it contains
For each sample the scanner writes two IDAT files, one per colour channel: Grn (green) and Red. Each file stores, for every bead type on the array, a summary of the signal measured on the beads that carry that probe:
| Field | Meaning |
|---|---|
IlluminaID | the probe address (it matches AddressA_ID in the manifest) |
Mean | average intensity of the beads of that type |
SD | variability of the intensity across those beads |
NBeads | how many beads of that type were measured |
There are no genotypes in an IDAT file: only light intensities. Genotypes come later, when the intensities are compared with the expected clusters.
The file name
200000000001_R01C01_Grn.idat = BeadChip barcode (12 digits) + position of the sample on the chip (row 01, column 01) + channel. See file_names.txt. The barcode and position are how you link an IDAT file to a person, through the sample sheet (04_final_report/sample_sheet.csv).
Files in this folder
file_names.txt: the 8 IDAT file names of our 4 samples.what_readIDAT_returns_S01_Grn.tsvand..._Red.tsv: the table you would see after reading one IDAT file in R withilluminaio::readIDAT()(illustrative numbers).
How to read a real IDAT file
# install once: BiocManager::install("illuminaio")
library(illuminaio)
idat <- readIDAT("200000000001_R01C01_Grn.idat")
head(idat$Quants) # IlluminaID, Mean, SD, NBeads
Real example IDAT files are distributed with the Bioconductor data package IlluminaDataTestFiles.
Next step
IDAT (Grn + Red) + manifest + cluster file -> genotype calls (GTC), see 03_gtc.
Example files
file_names.txt314 bytes
# One pair of IDAT files per sample: <BeadChip barcode>_<position>_<channel>.idat 200000000001_R01C01_Grn.idat 200000000001_R01C01_Red.idat 200000000001_R02C01_Grn.idat 200000000001_R02C01_Red.idat 200000000001_R03C01_Grn.idat 200000000001_R03C01_Red.idat 200000000001_R04C01_Grn.idat 200000000001_R04C01_Red.idatDownload file_names.txt
what_readIDAT_returns_S01_Grn.tsv335 bytes
# ILLUSTRATIVE values. Not a real IDAT file. # Layout of the 'Quants' table returned by illuminaio::readIDAT() for one channel of one sample. IlluminaID Mean SD NBeads 10600007 10776 194 5 10600020 4806 330 12 10600033 2586 834 8 10600046 11387 838 22 10600059 1724 684 18 10600072 820 110 7 10600085 3882 318 21 10600098 10163 107 22Download what_readIDAT_returns_S01_Grn.tsv
Format 2 of 9
Manifest
- What it contains
- The map of the array: which probe measures which variant, its chromosome, position and strand.
- Who makes it
- Illumina, with each array product
- Type
- Binary and text, extension
.bpm or .csv - Next
- GTC: used together with the IDAT files and the cluster file
Produced by: Illumina, one per array product and version (download from the product support page).
Type: .bpm (binary, used by the software) and .csv (the same information, readable).
The IDAT files only say "probe 10600007 had this intensity". The manifest says which variant that probe targets, on which chromosome and position, and which alleles it can detect.
Structure
The .csv has three sections: [Heading] (array name, number of loci), [Assay] (one row per variant), [Controls] (control probes).
Main columns of [Assay] (our excerpt keeps a subset):
| Column | Meaning |
|---|---|
IlmnID | Illumina's full identifier: name, strand designation (T/B) and F/R |
Name | the variant name that appears in the Final Report |
IlmnStrand | strand used to design the probe (TOP/BOT for SNPs) |
SNP | the two alleles, on the IlmnStrand, as [A/B] |
AddressA_ID, AddressB_ID | probe addresses: the link to IlluminaID in the IDAT |
AlleleA_ProbeSeq | probe sequence |
GenomeBuild | reference genome build of Chr and MapInfo |
Chr, MapInfo | chromosome and position |
RefStrand | + or -: whether the SNP alleles are on the Plus strand |
Why it matters to you
- Genome build. Manifests exist for GRCh37 and GRCh38. Positions in your PLINK files come from here: check
GenomeBuildbefore merging datasets. - Strand. To translate TOP alleles to Plus alleles you need
RefStrand. For A/T and C/G SNPs this is the only safe way.
Files in this folder
manifest_excerpt.csv: 8 rows, illustrative values, random probe sequences.
Example files
manifest_excerpt.csv1.4 KB
# ILLUSTRATIVE excerpt with a subset of columns. Probe sequences are random. [Heading] Descriptor File Name,EXAMPLE-ARRAY_A1.bpm Assay Format,Infinium HTS Date Manufactured,1/1/2026 Loci Count ,8 [Assay] IlmnID,Name,IlmnStrand,SNP,AddressA_ID,AlleleA_ProbeSeq,AddressB_ID,AlleleB_ProbeSeq,GenomeBuild,Chr,MapInfo,SourceStrand,RefStrand 1:1000123-0_T_F_2296491777,1:1000123,TOP,[A/G],10600007,GATATAGGCAACGACATGTGCGGCGACCCTTGCGACAGTGACGCTTTCGC,,,38,1,1000123,TOP,+ 2:2000456-0_T_F_1529628540,2:2000456,TOP,[A/G],10600020,GTTGCCTAAACCTATTTGAAGGAGTCTAGCAGCCGCAGTAAGGCACAATA,,,38,2,2000456,TOP,- 3:3000789-0_T_F_2633380706,3:3000789,TOP,[A/T],10600033,CCTCGTCCGTGTTACCAGACCAAACAAGACGTCCTCTTCAATGTTTAAAT,,,38,3,3000789,TOP,+ 5:5001011-0_T_F_2563826773,5:5001011,TOP,[C/G],10600046,GACCCTCTCGTCATAAAACCTTTCTACTATGTGTTCCGCAAGAATCAACA,,,38,5,5001011,TOP,+ 7:7001213-0_T_F_2277828160,7:7001213,TOP,[A/C],10600059,ACTACAATGGCGCGTCGTGAATAACGCGACGGCTGAGACGAACGGCGCGT,,,38,7,7001213,TOP,+ 17:17001415-0_T_F_1539278776,17:17001415,TOP,[A/G],10600072,AATGAAGCGCTTAAACAGCTCAGGAGCCAGTCCCCTACGTCGCATATCCT,,,38,17,17001415,TOP,- 22:22001617-0_T_F_1750885745,22:22001617,TOP,[A/G],10600085,GCCACTGGAGGTGAAGCGAATGGTATCGATACGTAGGAGGTGTGCCTTCG,,,38,22,22001617,TOP,+ X:10001819-0_T_F_1872039786,X:10001819,TOP,[A/G],10600098,AGGCTGTTTCTCAGGACGCCCAACTATTCTTTCCAATCCTACATCTGTTT,,,38,X,10001819,TOP,- [Controls]Download manifest_excerpt.csv
Format 3 of 9
GTC
- What it contains
- The genotype calls of one sample, with a confidence value (GC Score) for each call.
- Who makes it
- GenomeStudio or DRAGEN Array
- Type
- Binary, extension
.gtc - Next
- Final Report: GenomeStudio (Report Wizard)
Produced by: GenomeStudio or Illumina DRAGEN Array (genotype call).
Type: binary, one file per sample.
From intensities to genotypes
The software takes, for each sample:
- the two IDAT files (Grn and Red intensities);
- the manifest (
.bpm), to know which probe measures which variant; - the cluster file (
.egt), which describes where the AA, AB and BB clusters fall for each SNP. Illumina provides a standard one per product; large projects often build their own in GenomeStudio.
For each SNP it places the sample's two intensities on the cluster plot and assigns a genotype with a confidence value, the GenCall (GC) Score. Calls below the threshold (Illumina's default is 0.15) are left as no calls.
The result is stored in a GTC file: genotypes, GC Scores and normalised intensities. No example file is included here because GTC is binary and not meant to be read directly.
Next step
- GenomeStudio: export a Final Report (
04_final_report). - DRAGEN Array:
genotype gtc-to-vcfwrites a VCF directly (09_vcf).
There is no example file: a GTC file is binary and is not meant to be read directly.
Format 4 of 9
Final Report
- What it contains
- The genotypes as text, one row for each variant and sample, with the GC Score.
- Who makes it
- GenomeStudio
- Type
- Text, extension
.txt - Next
- .lgen: a script
Rscript scripts/final_report_to_lgen.R
Produced by: GenomeStudio (Report Wizard), from the genotype calls. Type: tab-separated text. Open it in a text editor or spreadsheet.
Structure
[Header] information about the export: software version, manifest, numbers of SNPs and samples
[Data] the table: one row per SNP per sample
You choose the columns when you export. Common ones:
| Column | Meaning |
|---|---|
SNP Name | variant name, as in the manifest (here chr:position; often an rsID) |
Sample ID | the sample |
Allele1 - Plus, Allele2 - Plus | the two alleles read on the Plus strand of the reference genome |
Allele1 - Top, Allele2 - Top | the same genotype on Illumina's TOP strand |
GC Score | confidence of the call (0 to 1) |
Chr, Position | location, from the manifest |
X, Y, B Allele Freq, Log R Ratio | intensities and derived values (not included here) |
Allele1 and Allele2 are not REF and ALT. They are simply the two alleles of the genotype, written on the chosen strand.
How to read a row
| What you see | Meaning |
|---|---|
A G | heterozygous |
A A | homozygous |
- - | no call: the genotype could not be assigned (low GC Score) |
Look at FinalReport_S02.txt, variant 2:2000456: Plus = C T, Top = A G. Same genotype, two strands. At 5:5001011 Plus and Top look identical: with C/G (and A/T) SNPs you cannot tell the strand from the alleles alone.
Three layouts
| File | Layout | When you meet it |
|---|---|---|
FinalReport_S01.txt ... S04.txt | one file per sample | the layout used in the course |
FinalReport_all_samples.txt | all samples in one long table | "Standard" report with all samples |
FinalReport_matrix_Plus.txt | SNPs in rows, samples in columns | "Matrix" report, compact |
sample_sheet.csv links each sample to its BeadChip barcode and position (and therefore to its IDAT files), and gives sex and case/control status. The Final Report contains no phenotype: sex and status always come from a separate file.
Why we do not analyse it as it is
With about 730,000 SNPs and one file per sample, 130 samples already produce about 4.5 GB of text in 130 files. PLINK binary files store the same genotypes in a few megabytes.
Next step
Final Report + sample sheet -> .lgen + .map + .fam (05_plink_lgen), with the script in scripts/.
Example files
FinalReport_S01.txt576 bytes
[Header] GSGT Version 2.0.5 Processing Date 11/18/2026 10:00 AM Content EXAMPLE-ARRAY_A1.bpm Num SNPs 8 Total SNPs 8 Num Samples 1 Total Samples 4 [Data] SNP Name Sample ID Allele1 - Plus Allele2 - Plus Allele1 - Top Allele2 - Top GC Score Chr Position 1:1000123 S01 A G A G 0.8721 1 1000123 2:2000456 S01 C C G G 0.9134 2 2000456 3:3000789 S01 A T A T 0.7765 3 3000789 5:5001011 S01 C G C G 0.6912 5 5001011 7:7001213 S01 A C A C 0.9301 7 7001213 17:17001415 S01 T T A A 0.8456 17 17001415 22:22001617 S01 A G A G 0.7012 22 22001617 X:10001819 S01 C T A G 0.8810 X 10001819Download FinalReport_S01.txt
sample_sheet.csv179 bytes
Sample_ID,Sentrix_ID,Sentrix_Position,Sex,Status S01,200000000001,R01C01,F,case S02,200000000001,R02C01,M,control S03,200000000001,R03C01,M,case S04,200000000001,R04C01,F,controlDownload sample_sheet.csv
Format 5 of 9
.lgen, .map and .fam
- What it contains
- PLINK long format: one line for each genotype, with the map and the sample list apart.
- Who makes it
- a script, or you
- Type
- Text, extension
.lgen - Next
- .bed: PLINK 2
plink2 --lfile example --make-bed --out example
Produced by: a script, from the Final Reports and the sample sheet. Type: text, no header line, whitespace-separated.
The long format has the same shape as a Final Report (one line per sample per SNP), which is why it is the easiest bridge from a Final Report to PLINK.
.lgen (genotypes)
| Column | Example | From the Final Report |
|---|---|---|
| 1 Family ID | S01 | Sample ID (we use the same value as the individual ID) |
| 2 Individual ID | S01 | Sample ID |
| 3 Variant ID | 1:1000123 | SNP Name |
| 4 Allele 1 | A | Allele1 - Plus |
| 5 Allele 2 | G | Allele2 - Plus |
A no call (-) becomes 0 0 (missing).
.map (variants)
| Column | Example | Source |
|---|---|---|
| 1 Chromosome | 1 | Chr (Final Report or manifest) |
| 2 Variant ID | 1:1000123 | SNP Name |
| 3 Genetic distance (cM) | 0 | not available: 0 is accepted |
| 4 Base-pair position | 1000123 | Position |
.fam (samples)
| Column | Example | Source |
|---|---|---|
| 1 Family ID | S01 | sample sheet |
| 2 Individual ID | S01 | sample sheet |
| 3 Father | 0 | 0 = not in the dataset |
| 4 Mother | 0 | 0 = not in the dataset |
| 5 Sex | 2 | sample sheet: 1 male, 2 female, 0 unknown |
| 6 Phenotype | 2 | sample sheet: 1 control, 2 case, -9 missing |
Next step
plink2 --lfile example --make-bed --out example
reads example.lgen, example.map and example.fam and writes example.bed, example.bim, example.fam (07_plink_bed).
Example files
example.lgen724 bytes
S01 S01 1:1000123 A G S01 S01 2:2000456 C C S01 S01 3:3000789 A T S01 S01 5:5001011 C G S01 S01 7:7001213 A C S01 S01 17:17001415 T T S01 S01 22:22001617 A G S01 S01 X:10001819 C T S02 S02 1:1000123 A A S02 S02 2:2000456 C T S02 S02 3:3000789 A A S02 S02 5:5001011 C G S02 S02 7:7001213 C C S02 S02 17:17001415 C T S02 S02 22:22001617 0 0 S02 S02 X:10001819 C C S03 S03 1:1000123 G G S03 S03 2:2000456 C T S03 S03 3:3000789 T T S03 S03 5:5001011 C C S03 S03 7:7001213 A A S03 S03 17:17001415 0 0 S03 S03 22:22001617 G G S03 S03 X:10001819 T T S04 S04 1:1000123 A G S04 S04 2:2000456 T T S04 S04 3:3000789 A A S04 S04 5:5001011 G G S04 S04 7:7001213 C C S04 S04 17:17001415 C C S04 S04 22:22001617 A A S04 S04 X:10001819 C CDownload example.lgen
example.map186 bytes
1 1:1000123 0 1000123 2 2:2000456 0 2000456 3 3:3000789 0 3000789 5 5:5001011 0 5001011 7 7:7001213 0 7001213 17 17:17001415 0 17001415 22 22:22001617 0 22001617 X X:10001819 0 10001819Download example.map
example.fam64 bytes
S01 S01 0 0 2 2 S02 S02 0 0 1 1 S03 S03 0 0 1 2 S04 S04 0 0 2 1Download example.fam
Format 6 of 9
.ped and .map
- What it contains
- The older PLINK text format: one line for each person, with all genotypes on the line.
- Who makes it
- PLINK
- Type
- Text, extension
.ped - Next
- .bed: PLINK 2
plink2 --pedmap example --make-bed --out example
Produced by: PLINK (--export ped in PLINK 2, --recode in PLINK 1.9).
Type: text, no header line.
.ped
One line per person. The first 6 columns are exactly the .fam columns (family, individual, father, mother, sex, phenotype). Then come two columns per variant, in the order of the .map file:
S01 S01 0 0 2 2 A G C C A T C G A C T T A G C T
|--| variant 1 (1:1000123) = A/G
Missing genotypes are 0 0.
.map
Same as in 05_plink_lgen: chromosome, variant ID, genetic distance, position.
When to use it
Only to look at genotypes by eye, or with old software. With real data a .ped file becomes enormous (2 characters per allele, per variant, per person). For analysis, use binary files.
Conversions
plink2 --pedmap example --make-bed --out example # .ped/.map -> .bed/.bim/.fam
plink2 --bfile example --export ped --out example # .bed/.bim/.fam -> .ped/.map
PLINK 1.9 equivalents: plink --file example --make-bed --out example and plink --bfile example --recode --out example. Note that --recode writes text files; --make-bed writes binary files.
Example files
example.ped192 bytes
S01 S01 0 0 2 2 A G C C A T C G A C T T A G C T S02 S02 0 0 1 1 A A C T A A C G C C C T 0 0 C C S03 S03 0 0 1 2 G G C T T T C C A A 0 0 G G T T S04 S04 0 0 2 1 A G T T A A G G C C C C A A C CDownload example.ped
example.map186 bytes
1 1:1000123 0 1000123 2 2:2000456 0 2000456 3 3:3000789 0 3000789 5 5:5001011 0 5001011 7 7:7001213 0 7001213 17 17:17001415 0 17001415 22 22:22001617 0 22001617 X X:10001819 0 10001819Download example.map
Format 7 of 9
.bed, .bim and .fam
- What it contains
- PLINK 1 binary format: two bits for each genotype, with the variant and sample tables in text.
- Who makes it
- PLINK
- Type
- Binary and text, extension
.bed - Next
- .pgen: PLINK 2
plink2 --bfile example --make-pgen --out example
Produced by: PLINK (--make-bed).
Type: .bed is binary; .bim and .fam are text. The three files always travel together and share the same name (prefix).
This is the format used in the course for quality control and association testing.
.fam (samples)
Same 6 columns as in 05_plink_lgen. The order of the lines is the order of the samples inside .bed.
.bim (variants)
| Column | Example | Meaning |
|---|---|---|
| 1 | 1 | chromosome |
| 2 | 1:1000123 | variant ID |
| 3 | 0 | genetic distance (cM), 0 if unknown |
| 4 | 1000123 | base-pair position |
| 5 | G | allele 1 (A1). In PLINK 2 this is ALT |
| 6 | A | allele 2 (A2). In PLINK 2 this is REF |
Allele order. PLINK 1.9 puts the minor allele in column 5 by default, so the order can change from one dataset to another. PLINK 2 keeps ALT in column 5 and REF in column 6. In this example column 5 is ALT and column 6 is REF.
.bed (genotypes)
Binary: do not open it with a text editor, and do not confuse it with the BED format of genome browsers, which is unrelated.
- 3 "magic" bytes:
6c 1b 01. - Then one block per variant, in
.bimorder. Each block has 2 bits per sample, in.famorder:
| Bits | Genotype |
|---|---|
00 | homozygous for allele 1 (column 5) |
01 | missing |
10 | heterozygous |
11 | homozygous for allele 2 (column 6) |
Our 4 samples fit in exactly one byte per variant, so the whole file is 11 bytes:
6c 1b 01 8e 2b ce 3a ce 1b c6 ce
bed_byte_by_byte.md decodes every byte.
Next step
plink2 --bfile example --make-pgen --out example # -> .pgen/.pvar/.psam
plink2 --bfile example --export vcf id-paste=iid --out example # -> .vcf
Example files
example.bim226 bytes
1 1:1000123 0 1000123 G A 2 2:2000456 0 2000456 T C 3 3:3000789 0 3000789 T A 5 5:5001011 0 5001011 G C 7 7:7001213 0 7001213 A C 17 17:17001415 0 17001415 C T 22 22:22001617 0 22001617 G A X X:10001819 0 10001819 T CDownload example.bim
example.fam68 bytes
S01 S01 0 0 2 2 S02 S02 0 0 1 1 S03 S03 0 0 1 2 S04 S04 0 0 2 1Download example.fam
example.bedbinary, 11 bytes
The genotypes of 4 people at 8 variants. Each pair of letters and digits below is one byte, written in hexadecimal.
6c 1b 01 8e 2b ce 3a ce 1b c6 ceDownload example.bed
The .bed file, byte by byte
The file has 11 bytes: 3 magic bytes plus one byte per variant (4 samples x 2 bits = 8 bits).
| Byte | Hex | Meaning |
|---|---|---|
| 1 | 6c | magic number |
| 2 | 1b | magic number |
| 3 | 01 | variant-major mode (one block per variant) |
| 4 | 8e | variant 1:1000123 |
| 5 | 2b | variant 2:2000456 |
| 6 | ce | variant 3:3000789 |
| 7 | 3a | variant 5:5001011 |
| 8 | ce | variant 7:7001213 |
| 9 | 1b | variant 17:17001415 |
| 10 | c6 | variant 22:22001617 |
| 11 | ce | variant X:10001819 |
Decoding one byte
Each byte holds 4 genotypes of 2 bits. Read the pairs from the right (low-order bits first): the rightmost pair is the first sample in .fam.
| 2-bit code | Genotype |
|---|---|
00 | homozygous for allele 1 of .bim (column 5) |
01 | missing |
10 | heterozygous |
11 | homozygous for allele 2 of .bim (column 6) |
| Variant | A1 (col 5) | A2 (col 6) | S01 | S02 | S03 | S04 | Byte (binary, S04..S01) |
|---|---|---|---|---|---|---|---|
1:1000123 | G | A | AG 10 | AA 11 | GG 00 | AG 10 | 10001110 |
2:2000456 | T | C | CC 11 | CT 10 | CT 10 | TT 00 | 00101011 |
3:3000789 | T | A | AT 10 | AA 11 | TT 00 | AA 11 | 11001110 |
5:5001011 | G | C | CG 10 | CG 10 | CC 11 | GG 00 | 00111010 |
7:7001213 | A | C | AC 10 | CC 11 | AA 00 | CC 11 | 11001110 |
17:17001415 | C | T | TT 11 | CT 10 | -- 01 | CC 00 | 00011011 |
22:22001617 | G | A | AG 10 | -- 01 | GG 00 | AA 11 | 11000110 |
X:10001819 | T | C | CT 10 | CC 11 | TT 00 | CC 11 | 11001110 |
Format 8 of 9
.pgen, .pvar and .psam
- What it contains
- PLINK 2 binary format. It also holds imputed dosages and variants with more than two alleles.
- Who makes it
- PLINK 2
- Type
- Binary and text, extension
.pgen - Next
- VCF: PLINK 2
plink2 --bfile example --export vcf id-paste=iid --out example
Produced by: PLINK 2 (--make-pgen).
Type: .pgen is binary; .pvar and .psam are text with a header line.
The PLINK 2 counterpart of .bed/.bim/.fam. It can also store multi-allelic variants, phased genotypes and imputed dosages, which .bed cannot.
.psam (samples, replaces .fam)
Has a header line starting with #:
#FID IID SEX PHENO1
S01 S01 2 2
.pvar (variants, replaces .bim)
VCF-style columns, with REF before ALT:
#CHROM POS ID REF ALT
1 1000123 1:1000123 A G
.pgen (genotypes)
Compressed binary. Read it only through PLINK 2 (or libraries such as pgenlib).
Conversions
plink2 --pfile example --make-bed --out example # back to .bed/.bim/.fam
plink2 --pfile example --export vcf id-paste=iid --out example # to VCF
Example files
example.pvar233 bytes
#CHROM POS ID REF ALT 1 1000123 1:1000123 A G 2 2000456 2:2000456 C T 3 3000789 3:3000789 A T 5 5001011 5:5001011 C G 7 7001213 7:7001213 C A 17 17001415 17:17001415 T C 22 22001617 22:22001617 A G X 10001819 X:10001819 C TDownload example.pvar
example.psam73 bytes
#FID IID SEX PHENO1 S01 S01 2 2 S02 S02 1 1 S03 S03 1 2 S04 S04 2 1Download example.psam
example.pgenbinary, 40 bytes
The same genotypes in the PLINK 2 binary format. Each pair of letters and digits below is one byte, written in hexadecimal.
6c 1b 10 08 00 00 00 04 00 00 00 80 20 00 00 00 00 00 00 00 00 00 00 00 01 01 01 01 01 01 01 01 61 94 21 85 21 b4 2d 21Download example.pgen
Format 9 of 9
VCF
- What it contains
- The common text format for variants and genotypes. Imputation servers read it.
- Who makes it
- PLINK 2, bcftools, imputation servers
- Type
- Text, extension
.vcf - Next
- PLINK 2 binary: PLINK 2
plink2 --vcf example.vcf --psam example.psam --make-pgen --out example
Produced by: PLINK 2 (--export vcf), bcftools, DRAGEN Array (gtc-to-vcf), sequencing pipelines, imputation servers.
Type: text (often compressed as .vcf.gz).
The common language between arrays, sequencing and imputation. The imputation servers used in the course expect VCF files.
Structure
- Meta-information lines starting with
##(file format, reference, contigs, field definitions). - One header line starting with
#CHROM. - One line per variant, then one column per sample.
| Column | Example | Meaning |
|---|---|---|
#CHROM | 1 | chromosome |
POS | 1000123 | position |
ID | 1:1000123 | variant ID |
REF | A | reference allele (from the genome) |
ALT | G | alternative allele |
QUAL, FILTER, INFO | . | not used here |
FORMAT | GT | which fields follow for each sample |
S01 ... | 0/1 | the genotype of each sample |
Genotype codes
GT | Meaning | At 1:1000123 (REF A, ALT G) |
|---|---|---|
0/0 | two REF alleles | A/A |
0/1 | one REF, one ALT | A/G |
1/1 | two ALT alleles | G/G |
./. | missing |
/ means unphased; after phasing you will see | (for example 0|1).
Chromosome X. Here males are written as diploid (0/0, 1/1) for simplicity. Many tools write them as haploid (0, 1).
Conversions
plink2 --vcf example.vcf --psam example.psam --make-pgen --out example
plink2 --vcf example.vcf --psam example.psam --make-bed --out example
Example files
example.vcf861 bytes
##fileformat=VCFv4.3 ##fileDate=20261118 ##source=PLINKv2.0 ##contig=<ID=1> ##contig=<ID=2> ##contig=<ID=3> ##contig=<ID=5> ##contig=<ID=7> ##contig=<ID=17> ##contig=<ID=22> ##contig=<ID=X> ##INFO=<ID=PR,Number=0,Type=Flag,Description="Provisional reference allele, may not be based on real reference genome"> ##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype"> #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT S01 S02 S03 S04 1 1000123 1:1000123 A G . . PR GT 0/1 0/0 1/1 0/1 2 2000456 2:2000456 C T . . PR GT 0/0 0/1 0/1 1/1 3 3000789 3:3000789 A T . . PR GT 0/1 0/0 1/1 0/0 5 5001011 5:5001011 C G . . PR GT 0/1 0/1 0/0 1/1 7 7001213 7:7001213 C A . . PR GT 0/1 0/0 1/1 0/0 17 17001415 17:17001415 T C . . PR GT 0/0 0/1 ./. 1/1 22 22001617 22:22001617 A G . . PR GT 0/1 ./. 1/1 0/0 X 10001819 X:10001819 C T . . PR GT 0/1 0 1 0/0Download example.vcf
Text and example files: CC BY-NC-SA 4.0. Code in the scripts folder: MIT. The examples are invented: names, barcodes, positions and intensities belong to no real person.