Module 0 · Prepare your computer · step 8 of 8
0.8Run the setup check
Commands tested on Windows
In short
We run the setup check to test the R packages, data files and PLINK 2. PLINK reads 20 DNA positions and writes a report, including a test in a folder whose name contains spaces and non-English letters.
Do this
- Paste in the RStudio ConsoleThe R command in the Command section below
You should see: Preflight passed.
Command
R command
Type or paste into the RStudio console.
1settings <- new.env(parent = baseenv())2sys.source("config.R", settings)3settings$course_settings$tested_plink_version4source("scripts/preflight.R")- Note 1: Create a separate place in R to hold the course settings.
- Note 2: Read the course settings from config.R.
- Note 3: Show the PLINK version used to test the course.
- Note 4: Run the setup checks, including the small PLINK test.
You need
The executable from step 0.6 and the verified data from step 0.7. The standard guided data folder is data/course/. Some people use an existing external installation. For them, the environment variable COURSE_DATA_DIR can name the extracted data, and COURSE_OUTPUT_DIR can name a separate output folder. These optional variables contain paths and never passwords.
What we do
Run the setup check. It tests the R packages, the locale (opens in a new tab) (your computer's language and number settings), the integrity of the genotype files, and a small PLINK read and write operation. This test uses 20 variants (opens in a new tab), which are DNA positions that differ between people. At the end you should see the message Preflight passed.
Why
A program can print its version and still fail to read data. It can also fail to write results in a folder path that has spaces or non-English letters. A test with a real operation finds these failures before a long analysis.
Illustration in preparation
Illustration in preparation
What each option does
| Option or modifier | What it does |
|---|---|
| --bfile | Reads the BED, BIM and FAM input files named sim2026_lab in data/course/lab_export/. |
| --autosome | Keeps only DNA positions on chromosomes 1 to 22. |
| --thin-count | Selects 20 DNA positions at random for this small test. |
| --seed | Uses 20261111 as the starting number for the random selection so it can be repeated. |
| --freq | Writes a report showing how common each version of a DNA letter is at the selected positions. |
| --out | Starts the report file names with results/guided/s0-8_probe in the standard project layout; the helper also tests a folder name with spaces and non-English letters. |
Every command also uses --threads 2 (PLINK runs at most two tasks at the same time) and --memory 2048 (PLINK uses at most about 2 GB of memory).
PLINK terminal equivalent. Optional: you do not need it for the course.
Blue: PLINK option · Orange: value you can change · Green: file name
Terminal equivalent: plain PLINK 2
Select any option to see what it does. Do not paste terminal commands into the R console.
bin/plink2
No option selected. Each underlined part of the command is an option you can open.
Expected result
Show the expected result
The setup check prints one short line per check, with PASS or the problem. It keeps the full PLINK output in results/guided/preflight.txt (or the folder selected by COURSE_OUTPUT_DIR). The tested PLINK version is printed before the checks.
Preflight passed.
The guided starting data have 2,016 sample wells and 299,523 variants, representing 2,000 simulated people. PLINK finishes the frequency test on 20 variants. The report can show sex as "ambiguous". This is normal at this stage: the starting FAM has no recorded sex. The probe reads autosomal variants and does not perform the sex check from step 3.3. A path such as PATHCH~1 in the report is the safe form of a folder with non-English letters.
Verification: the same package, genotype and PLINK read/write checks passed on Windows before this output change.
If something goes wrong
If something goes wrong
Stop at the first error. Do not run later analysis steps until the setup check succeeds. The setup check explains which package is unavailable or whether the PLINK program is missing. On Windows, the script clears locale requests that R cannot use. This change lasts for the current session only, and your Windows language stays unchanged. Startup warnings can appear before the script has a chance to run. On Linux, the package preparation chooses matching ready-made Posit packages where they exist. If a package must be built from source code, the script explains which development libraries you need. If the course data are missing (step 0.7 is not done), the setup check prints a warning, skips the data check and ends with Preflight passed with a warning: course data are missing. Finish step 0.7 and run it again.
Quick check
Why does the setup check write a frequency report rather than only print a version?
Show the answer
It tests actual data reading and file writing, including a path containing spaces and non-English characters.
Files created
results/guided/software_versions.txt, results/guided/preflight.txt and PLINK test reports in its path check/ folder. If COURSE_OUTPUT_DIR is set, the same files go there instead. No source input is changed.