Why Check a Conversion?
A genotype file can be syntactically valid and still represent the wrong analysis data. A sample-order mismatch can attach one person's genotypes to another person's record; an allele-label mismatch can reverse the meaning of a genotype count; and a conversion can omit or recode variants. Checking the files after conversion is therefore part of preparing genetic data, not merely a file-management task.
A common PLINK 1 binary data set is a trio of files with the same base name: .bed, .bim, and .fam. The BED file stores genotype calls in binary form. BIM and FAM are text files that provide the variant and sample information needed to interpret those calls. In a VCF, by contrast, variant records and sample genotypes are presented together in one text-based file. The formats organize related information differently, so comparisons must check both the labels and the order.
What the Three PLINK Files Contain
The .bed file is binary, not a table of readable genotype labels. In the standard PLINK 1 SNP-major layout, a short header identifies the file format and storage mode, followed by two bits per sample-variant genotype. Four genotypes fit in one byte; if the number of samples is not divisible by four, the final byte for a variant includes unused padding bits. The bits are codes, not allele letters. To interpret a call, software uses the corresponding variant's allele labels in BIM.
The .bim file is a tab-delimited text file with six columns, in this order: chromosome, variant ID, genetic distance in centimorgans, base-pair position, allele 1 (A1), and allele 2 (A2). A1 and A2 name the two alleles represented for that variant in the PLINK data. They do not, by themselves, tell you which allele is the reference allele, the alternate allele, or an effect allele. A1/A2 ordering can differ from the REF/ALT ordering in a VCF.
The .fam file has one row per sample, with six fields: family ID (FID), individual ID (IID), father ID, mother ID, sex, and phenotype. Sex is commonly coded 1 for male, 2 for female, and 0 for unknown. A binary phenotype is commonly coded 1 for control and 2 for case; a missing phenotype is often represented by -9. These fields describe sample records, while the genotype data for those samples are stored in BED. If the analysis does not use pedigree or phenotype information, those FAM fields still need to be retained or handled deliberately.
| File | Information it supplies | Order to check |
|---|---|---|
| .bed | Binary genotype calls | Calls follow the variant order in BIM and sample order in FAM |
| .bim | Variant ID, location, and two allele labels | One line per variant, matching BED variant order |
| .fam | Sample identifiers and sample-level fields | One line per sample, matching BED sample order |
The BED header also indicates its storage mode. Standard PLINK 1 binary files use SNP-major storage: successive genotype blocks correspond to successive variants. PLINK supports other storage modes in some contexts, so checks should confirm that the file was written and read as intended rather than assuming that any binary file can be interpreted from its byte sequence alone. In ordinary use, PLINK reads BED together with its matching BIM and FAM files.
How This Differs From a VCF
A VCF has variant records in rows. Each record includes fields such as chromosome, position, ID, REF, ALT, and FORMAT; sample genotype fields follow in columns whose order is given in the VCF header. For a biallelic variant, a GT value such as 0/1 refers to the allele indices in that record: 0 denotes REF and 1 denotes ALT. Thus, 0/1 describes one copy of each listed allele, not a fixed PLINK genotype code.
PLINK separates this information across files. BIM supplies the variant identifiers, positions, and allele labels; FAM supplies sample identifiers; BED supplies calls in the two files' corresponding order. The same biological genotype can therefore have different labels or codes in the two formats. For example, a VCF may list REF=A and ALT=G, while the PLINK BIM line lists A1=G and A2=A. Those labels are not inconsistent if the genotype calls correspond after accounting for the allele order.
Worked Checks After Conversion
A useful validation has several layers. First compare file dimensions and identifiers. Then compare variant locations and allele labels, allowing for an intentional allele-order difference. Finally compare calls for matched samples and variants, translating both formats into allele pairs. A few hand-checked calls can catch errors quickly; a full automated comparison is preferable when the data set is large.
Worked Example: Translating a Biallelic Genotype
Suppose a hypothetical VCF record has chromosome 2, position 1050, ID rsExample1, REF=A, and ALT=G. Three samples, S01, S02, and S03, have GT calls 0/0, 0/1, and 1/1. After conversion, the BIM line for this variant lists A1=G and A2=A. Check whether the calls agree.
Translate the VCF genotypes using its REF/ALT fields. The 0/0 call is A/A, the 0/1 call is A/G, and the 1/1 call is G/G. Now express each genotype as the number of copies of the PLINK A1 allele, G. The counts are 0 for A/A, 1 for A/G, and 2 for G/G.
Thus the expected A1 dosages are \(0,1,2\) for S01, S02, and S03, respectively. If a PLINK-readable genotype summary reports those counts for the matching samples and variant, the calls agree despite the reversed ordering of the BIM allele labels relative to VCF REF and ALT. This check confirms agreement for this record; it does not establish that every record in a large converted data set agrees.
Worked Example: Finding a Sample-Order Mismatch
Consider a hypothetical VCF whose sample columns, from left to right, are S01, S02, and S03. At one biallelic site with REF=C and ALT=T, the calls are S01=0/0, S02=0/1, and S03=1/1. A conversion produces a FAM file ordered S02, S01, S03. Suppose the PLINK calls in that FAM order correspond to T/T, C/C, and T/T.
The VCF calls translated to allele pairs are S01=C/C, S02=C/T, and S03=T/T. To compare correctly, match by sample identifier, not by column position alone. In FAM order, the expected genotypes are therefore S02=C/T, S01=C/C, and S03=T/T.
The converted calls instead report T/T for S02, C/C for S01, and T/T for S03. The first sample does not match: S02 should be C/T, not T/T. The fact that the second and third calls match does not excuse this discrepancy. The check has identified a call-level mismatch for S02 at this site. Before interpreting it as a conversion error, verify that the sample identifiers were mapped correctly and that the comparison uses the intended variant and allele labels.
Worked Example: Checking Variant and Sample Counts
A hypothetical conversion starts with 3 VCF sample columns and 2 biallelic variant records. The resulting FAM file has 3 rows, the BIM file has 2 rows, and the BED file is the standard SNP-major PLINK 1 format. Do the basic counts agree with the expected BED size?
In SNP-major storage, each variant has one two-bit genotype code per sample. For 3 samples, the calls for one variant require \(\lceil 3/4\rceil=1\) byte, because one byte holds four two-bit codes. With 2 variants, the genotype payload therefore requires \(2\times1=2\) bytes. The standard three-byte header adds 3 bytes, so the expected total BED size is \(3+2=5\) bytes.
The count checks also agree: 3 FAM rows match the 3 VCF samples, and 2 BIM rows match the 2 VCF records. These checks are necessary but not sufficient. A five-byte BED file can still contain calls assigned to the wrong samples or variants, so identifiers, order, and selected genotype values must also be checked.
A Practical Conversion-Check Sequence
Make sure the BED, BIM, and FAM files belong together. Compare the number of FAM rows with the number of VCF samples and the number of BIM rows with the number of retained VCF variants. Investigate count differences rather than treating them as harmless.
Compare identifiers and document any mapping between VCF sample names and the FID/IID fields. Do not assume that the first VCF sample corresponds to the first FAM row, or that IID alone is unique across families.
Compare chromosome, base-pair position, and variant identifier where available. Check how missing IDs, duplicate positions, and records removed during conversion were handled. Position alone may not uniquely identify a variant.
For matched records, translate VCF allele indices into allele pairs using REF and ALT, then compare with the PLINK calls using the BIM allele labels. Check missing calls as well as called genotypes.
Check whether multiallelic records, non-diploid calls, genotype likelihoods, or dosage values were split, filtered, or converted to hard calls. Do not assume that every VCF field has an equivalent in the BED/BIM/FAM trio.
Why the Details Matter
A PLINK binary genotype is a compact representation of a diploid call, not a complete copy of all information in a VCF. For example, a VCF can contain genotype quality, read depth, phasing, or likelihood fields alongside GT. The BED/BIM/FAM trio does not preserve all such fields. A conversion may also need a specific choice for how to handle multiallelic sites, missing data, or dosage values. Record the conversion settings and check what was retained, rather than concluding that the files match because they open successfully.
A concise validation report should state the input and output sample and variant counts, how identifiers were matched, whether order was preserved or changed, how allele labels were reconciled, and how many calls were compared or differed. When checking calls programmatically, compare matched sample-variant pairs after translating allele labels; a raw comparison of GT strings and internal PLINK codes is not meaningful.
These checks focus on whether records and calls were transferred consistently. Allele labels alone do not establish strand orientation or biological reference status; those require separate scrutiny. The essential habit is to treat sample order, variant order, and allele coding as explicit parts of the data, rather than assuming that a successful file conversion guarantees their preservation.
Check Your Understanding
Answer each question by referring to the file structure and comparison steps above.
- Which information is stored in BED, BIM, and FAM, respectively?
- A BIM line lists A1=G and A2=A, while a VCF record lists REF=A and ALT=G. What must you do before comparing genotype calls?
- Why should sample identifiers be matched explicitly rather than comparing the first VCF column with the first FAM row?
- For a VCF record with REF=C and ALT=T, translate the genotype 0/1 into an allele pair. What information does the genotype code 0 refer to?
- Why do matching sample and variant counts not by themselves prove that a conversion preserved the genotype calls?