Module 0 · Prepare your computer · step 6 of 8
0.6Put PLINK 2 in bin/
In short
We prepare PLINK 2, the program that analyses the DNA data. The project already contains it, so R copies the right version for your computer into the bin folder and checks it.
Do this
- Paste in the RStudio ConsoleThe R command in the Command section below
You should see: PLINK 2 2.0.0-b.1.4 is ready in bin/
Command
You need
The extracted project from step 0.3 and the R session from step 0.5. Windows 10 or 11 (64-bit Intel or AMD), macOS, or Linux x86_64 with glibc 2.31 or newer. For Windows ARM or Linux ARM, ask support for a compatible version.
What we do
The project package already contains PLINK 2 Beta 1.4 for Windows, macOS (Apple Silicon and Intel) and Linux. A build is a version of the program made for one system and processor. R finds your system, copies the matching build into the bin/ folder and checks that it is the right file. You do not download anything. Follow these actions:
- Keep the project from step 0.4 open in RStudio.
- Run the command below in the console.
- Read the last line it prints. It should say that PLINK 2 is ready in
bin/.
Run only the command of this step. Do not open the programs inside third_party/ by hand. On macOS, the system can block such a file and move it to the Bin. The command copies a clean build into bin/, and that copy is not blocked.
The program is plink2.exe on Windows and plink2 on macOS or Linux. This file is the executable (opens in a new tab), the file your computer can run. The builds are in third_party/plink2/programs/. R never changes a different PLINK 2 file that you put in bin/ yourself. It tells you instead. If you cloned the project with Git, the builds are not in the clone. R then downloads the pinned build and checks it in the same way.
You can still get PLINK 2 from the official page, https://www.cog-genomics.org/plink/2.0/ (opens in a new tab). Use it only if R cannot prepare the program, or if your lecturer asks for a different version. Choose the build whose name matches your system and processor from step 0.1. Extract the ZIP file and copy only plink2.exe (or plink2) into bin/. If you are not sure that your processor supports AVX2 (an instruction set of the processor), choose the 64-bit build without AVX2.
Why
PLINK 2 reads the genotype file formats. It computes quality control (opens in a new tab) (QC) and association statistics. QC means checks that find samples or data that cannot be trusted. PLINK 1.9 is a different program, so it does not replace PLINK 2. The course checks the file against a stored SHA-256 value, a fingerprint of the file. This shows that you have the exact program that the course was tested with. The tested version is stored in one place, the settings file config.R. The setup check at step 0.8 reports your version and warns you if it differs.
Illustration in preparation
Illustration in preparation
Expected result
Show the expected result
R prints one line. On the first run it is PLINK 2 2.0.0-b.1.4 is ready in bin/ (windows-x86_64, from the package). The system name in brackets matches your computer. If the file is already there, R prints The course PLINK 2 program is already in bin/ and has the expected version. The folder bin now holds plink2.exe on Windows, or plink2 on macOS or Linux.
If something goes wrong
If something goes wrong
If R says that your computer cannot use the programs of the course, download PLINK 2 yourself from the official page, as described above. For Windows ARM or Linux ARM, ask support.
On macOS, run only the command of this step, prepare_course_plink(). Do not open the programs inside third_party/ by hand. A browser marks the ZIP file as coming from the internet, and macOS copies this mark to every file inside it. macOS can then block a program that you start yourself and move it to the Bin. The copy in bin/ does not carry the mark.
If macOS shows a warning about bin/plink2, choose "Done". Do not choose "Move to Bin". Then open the Terminal in the project folder and type xattr -d com.apple.quarantine bin/plink2. This command removes the quarantine mark, the mark that macOS adds to files from the internet. Then run the command of step 0.6 again.
If bin/plink2 has disappeared, run the command of step 0.6 again. If the program in third_party/ has disappeared too, extract the project ZIP again and run the command once more.
You can also open System Settings, then Privacy & Security, find the message for plink2 and click "Open Anyway". Follow Apple's instructions (opens in a new tab).
On Linux, PLINK 2 needs glibc 2.31 or newer. If you see the message "Kernel too old" or a glibc error, your system is too old for this build. Ask support. If the file lacks permission to run, type chmod u+x bin/plink2 in the project folder.
On Windows, SmartScreen may show "Windows protected your PC". Review "More info" and use "Run anyway" if your institution permits it. If that option is unavailable, ask support. See Microsoft's SmartScreen guidance (opens in a new tab).
If R says that a SHA-256 value does not match, do not use the file. Download the project package again, or ask the instructor.
Quick check
Does the command at step 0.6 download PLINK 2 from the internet?
Show the answer
No. It copies the build that is already in the project package. Only if the package has no build for your system does it download the pinned build, and it checks the SHA-256 value first.
Files created
bin/plink2.exe or bin/plink2. It stays outside Git (opens in a new tab), the tool that records versions of the project files.