Module 2 · 8 steps
Files and formats
Convert the export to PLINK 2 format and check alleles, strand and genome build.
In this module
- Before you start
- You need the course data from step 0.7. The first code chunk checks the files that this module needs.
- Where the module ends
- The checkpoint at step 2.8.
The notebook is a Quarto file (.qmd). Open it in RStudio from the project folder.
At a glance
What you will do. You will check the files that the laboratory sent. You will convert them to the format of PLINK 2 (opens in a new tab), the free program used throughout this course. Then you will correct strand (opens in a new tab) differences, add disease and age information, and save a first checkpoint (opens in a new tab).
What you will learn.
- What the genotype (opens in a new tab) files contain and why they must stay together.
- How to measure missingness (opens in a new tab), the share of genotypes that could not be read.
- Why some variants cannot be oriented to a strand.
- What a genome build (opens in a new tab) is and why GRCh37 and GRCh38 must not be mixed.
- How to join disease and age to the right person.
How long it takes. About 60 minutes. Steps 2.5 and 2.6 take the longest, because they introduce new ideas.
Your progress: 0 of 8 steps done
Saved in this browser only. Nothing is sent anywhere.
Steps
- 2.1The starting filesWe identify the complete set of files exported by the laboratory.
- 2.2Convert to PLINK 2 native formatWe convert the matched BED, BIM and FAM files to PGEN, PVAR and PSAM files.
- 2.3Sample and variant tablesWe read the sample table and the variant table.
- 2.4First overviewWe measure how much data is missing, before we decide which samples or sites to remove.
- 2.5Alleles and strandWe compare the allele pairs from the laboratory with the supplied plus-strand annotation.
- 2.6Genome builds and lift-overWe convert the separate GRCh37 exercise to GRCh38 in R.
- 2.7Add phenotype and covariatesWe join the extra information to each well by its identity.
- 2.8Module 2 checkpointCheckpointWe save the first complete set of native files that you can restart from.
Recap
- You checked that the laboratory export has 2,016 sample wells and 299,523 variant entries.
- You converted the BED, BIM and FAM files to PGEN, PVAR and PSAM without losing any sample or variant.
- You measured missingness for samples and for variants, and removed nothing yet.
- You flipped 400 sites and excluded 3,013 sites, leaving 296,510 variants.
- You lifted a 10,000-site GRCh37 exercise to GRCh38: 9,970 sites stayed on the same chromosome, and eight mapped to the reverse strand.
- You added Disease, age and recorded sex to the 2,016 wells and saved the 2.8 checkpoint.
Next: module 3 cleans the samples: low call rate, sex check, heterozygosity, relatives, duplicates and batch effects.