MGHome page

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.

  1. IDATbinary

    Next step: GenomeStudio or DRAGEN Array, with the manifest and the cluster file

  2. Manifestbinary and text

    Next step: used together with the IDAT files and the cluster file

  3. GTCbinary

    Next step: GenomeStudio (Report Wizard)

  4. Next step: Rscript scripts/final_report_to_lgen.R

  5. Next step: plink2 --lfile example --make-bed --out example

  6. Next step: plink2 --pedmap example --make-bed --out example

  7. .bed, .bim and .fambinary and text

    Next step: plink2 --bfile example --make-pgen --out example

  8. .pgen, .pvar and .psambinary and text

    Next step: plink2 --bfile example --export vcf id-paste=iid --out example

  9. 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:

FieldMeaning
IlluminaIDthe probe address (it matches AddressA_ID in the manifest)
Meanaverage intensity of the beads of that type
SDvariability of the intensity across those beads
NBeadshow 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.tsv and ..._Red.tsv: the table you would see after reading one IDAT file in R with illuminaio::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.idat
Download 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	22
Download 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):

ColumnMeaning
IlmnIDIllumina's full identifier: name, strand designation (T/B) and F/R
Namethe variant name that appears in the Final Report
IlmnStrandstrand used to design the probe (TOP/BOT for SNPs)
SNPthe two alleles, on the IlmnStrand, as [A/B]
AddressA_ID, AddressB_IDprobe addresses: the link to IlluminaID in the IDAT
AlleleA_ProbeSeqprobe sequence
GenomeBuildreference genome build of Chr and MapInfo
Chr, MapInfochromosome 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 GenomeBuild before 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:

  1. the two IDAT files (Grn and Red intensities);
  2. the manifest (.bpm), to know which probe measures which variant;
  3. 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-vcf writes 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 scriptRscript 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:

ColumnMeaning
SNP Namevariant name, as in the manifest (here chr:position; often an rsID)
Sample IDthe sample
Allele1 - Plus, Allele2 - Plusthe two alleles read on the Plus strand of the reference genome
Allele1 - Top, Allele2 - Topthe same genotype on Illumina's TOP strand
GC Scoreconfidence of the call (0 to 1)
Chr, Positionlocation, from the manifest
X, Y, B Allele Freq, Log R Ratiointensities 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 seeMeaning
A Gheterozygous
A Ahomozygous
- -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

FileLayoutWhen you meet it
FinalReport_S01.txt ... S04.txtone file per samplethe layout used in the course
FinalReport_all_samples.txtall samples in one long table"Standard" report with all samples
FinalReport_matrix_Plus.txtSNPs 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	10001819
Download 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,control
Download 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 2plink2 --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)

ColumnExampleFrom the Final Report
1 Family IDS01Sample ID (we use the same value as the individual ID)
2 Individual IDS01Sample ID
3 Variant ID1:1000123SNP Name
4 Allele 1AAllele1 - Plus
5 Allele 2GAllele2 - Plus

A no call (-) becomes 0 0 (missing).

.map (variants)

ColumnExampleSource
1 Chromosome1Chr (Final Report or manifest)
2 Variant ID1:1000123SNP Name
3 Genetic distance (cM)0not available: 0 is accepted
4 Base-pair position1000123Position

.fam (samples)

ColumnExampleSource
1 Family IDS01sample sheet
2 Individual IDS01sample sheet
3 Father00 = not in the dataset
4 Mother00 = not in the dataset
5 Sex2sample sheet: 1 male, 2 female, 0 unknown
6 Phenotype2sample 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 C
Download 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	10001819
Download 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 1
Download 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 2plink2 --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 C
Download 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	10001819
Download 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 2plink2 --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)

ColumnExampleMeaning
11chromosome
21:1000123variant ID
30genetic distance (cM), 0 if unknown
41000123base-pair position
5Gallele 1 (A1). In PLINK 2 this is ALT
6Aallele 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 .bim order. Each block has 2 bits per sample, in .fam order:
BitsGenotype
00homozygous for allele 1 (column 5)
01missing
10heterozygous
11homozygous 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	C
Download 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	1
Download 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 ce
Download 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).

ByteHexMeaning
16cmagic number
21bmagic number
301variant-major mode (one block per variant)
48evariant 1:1000123
52bvariant 2:2000456
6cevariant 3:3000789
73avariant 5:5001011
8cevariant 7:7001213
91bvariant 17:17001415
10c6variant 22:22001617
11cevariant 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 codeGenotype
00homozygous for allele 1 of .bim (column 5)
01missing
10heterozygous
11homozygous for allele 2 of .bim (column 6)
VariantA1 (col 5)A2 (col 6)S01S02S03S04Byte (binary, S04..S01)
1:1000123GAAG 10AA 11GG 00AG 1010001110
2:2000456TCCC 11CT 10CT 10TT 0000101011
3:3000789TAAT 10AA 11TT 00AA 1111001110
5:5001011GCCG 10CG 10CC 11GG 0000111010
7:7001213ACAC 10CC 11AA 00CC 1111001110
17:17001415CTTT 11CT 10-- 01CC 0000011011
22:22001617GAAG 10-- 01GG 00AA 1111000110
X:10001819TCCT 10CC 11TT 00CC 1111001110

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 2plink2 --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	T
Download example.pvar
example.psam73 bytes
#FID	IID	SEX	PHENO1
S01	S01	2	2
S02	S02	1	1
S03	S03	1	2
S04	S04	2	1
Download 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 21
Download 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 2plink2 --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.
ColumnExampleMeaning
#CHROM1chromosome
POS1000123position
ID1:1000123variant ID
REFAreference allele (from the genome)
ALTGalternative allele
QUAL, FILTER, INFO.not used here
FORMATGTwhich fields follow for each sample
S01 ...0/1the genotype of each sample

Genotype codes

GTMeaningAt 1:1000123 (REF A, ALT G)
0/0two REF allelesA/A
0/1one REF, one ALTA/G
1/1two ALT allelesG/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/0
Download 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.