MGHome page

GWAS course

Course map

0 of 64 steps done

Start with step 0.1Install R

Saved in this browser only.

Step 2.1

Module 2 · Files and formats · step 1 of 8

2.1The starting files

Commands tested on Windows

Related pages: File formats (small example files for every format) and Lecture slides.

In short

We check that the three laboratory files are present and have matching sizes. We also look at the sample identifiers so we can recognise the starting data.

Do this

You should see: You see 2,016 sample wells and 299,523 variant entries before quality control (QC).

Command

Module setup, needed before this step

R: module setup

source("R/guided.R")cfg <- guided_init()

R command

Type or paste into the RStudio console.

1print(check_bed(cfg$input))2head(read_fam(cfg$input))
  1. Note 1: Check the three laboratory files and show their sizes.
  2. Note 2: Show the first rows of sample information.

You need

You need module 0 completed and the export inspection from module 1.

What we do

We identify the complete set of files exported by the laboratory. We keep these input files unchanged.

Why

The laboratory supplied a matched BED/BIM/FAM (opens in a new tab) trio. BED holds the calls, BIM the variants and FAM the samples. Review the format map at 1.9 and the fields at 1.10 if needed. Keep the companions in their original order. Equal counts alone do not prove that identities match.

These are starting files with deliberate quality problems, not a cleaned cohort. Later steps find the poor samples and variants.

PLINK terminal equivalent. Optional: you do not need it for the course.

Not applicable: this step needs no PLINK command. The R code above is the complete command.

R reads the files and shows the values. It does not change the genotype files.

Expected result

Show the expected result

You see 2,016 sample wells and 299,523 variant entries before quality control (QC). Each well has its own FID/IID (opens in a new tab) pair, the two identifiers that name a sample in the files.

The tested PLINK version is defined in config.R and recorded in software_versions.txt. Validation: executable chunks and the expected counts passed on Windows.

If something goes wrong

If something goes wrong

Stop at the first error message. Check the input file named in the message. Check that the previous step finished. Keep the command and the console output (the text printed in R). Do not use files from a different version of the dataset. See troubleshooting (opens in a new tab).

Quick check

Why must the FAM file stay together with the BED and BIM files?

Show the answer

The FAM file gives the sample identities and their order. PLINK needs this information to decode the genotype matrix.

Files created

None.