Module 6 · Association · step 5 of 8
6.5Read association output
Commands tested on Windows
In short
We check model failure codes and calculate intervals that describe uncertainty in the estimated effects. We sort valid results by p-value, the chance of a result at least this extreme if the variant had no effect, and save the first 20 with their tested DNA letters and sample counts.
Do this
- Paste in the RStudio ConsoleThe R command in the Command section below
You should see: The leading regions are on chromosomes 9, 3 and 12.
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.
1results <- guided_association(guided_path(cfg, "6.4", "association"))print(table(results$ERRCODE, useNA = "ifany"))2valid <- results[valid_p(results$P), ]valid$CI_LOW <- exp(log(valid$OR) - 1.96 * valid[["LOG(OR)_SE"]])valid$CI_HIGH <- exp(log(valid$OR) + 1.96 * valid[["LOG(OR)_SE"]])3top <- valid[order(valid$P), c("CHROM", "POS", "ID", "A1", "OBS_CT", "OR", "CI_LOW", "CI_HIGH", "P")]print(head(top, 10))4guided_write(head(top, 20), guided_path(cfg, "6.5", "top20.tsv"))# Course bookkeeping: records the counts for the next step. Do not change.guided_artifact_checkpoint(cfg, "6.5", guided_path(cfg, "6.5", "top20.tsv"), parent = "6.4")- Note 1: Read the scan results and count the model status codes.
- Note 2: Keep valid tests and calculate intervals describing uncertainty in their effects.
- Note 3: Sort by p-value and print the first ten results with their tested DNA letters.
- Note 4: Save the first 20 results for later review.
You need
The full association output from 6.4.
What we do
Find the effect allele, the sample count, the uncertainty, the type of test and the fitting status in the output.
Why
A1 is the effect allele (opens in a new tab): the allele whose dosage is tested. It is not automatically the ALT allele, the minor allele or the harmful allele. OR is the odds ratio. It shows how much each copy of A1 multiplies the odds of disease. OBS_CT is the number of samples used at that variant. It can change from variant to variant because of missing calls. ERRCODE describes model failures. A missing p-value must stay missing. A 95% confidence interval (opens in a new tab) is exp(log(OR) +/- 1.96 * SE), where SE is the standard error. This formula is an approximation. The interval shows how uncertain the estimate is, if the assumptions hold. It does not give the chance that this one interval contains the true value.
PLINK terminal equivalent. Optional: you do not need it for the course.
Not applicable. This step needs no PLINK operation. The R chunk is the complete command.
R reads or calculates the values it shows. It does not change the genotype files.
Expected result
Show the expected result
The leading regions are on chromosomes 9, 3 and 12. The table keeps the effect allele and the OBS_CT of each variant. Every p-value and odds ratio refers to the tested A1 allele, whatever the variant ID looks like.
The tested PLINK version is defined in config.R and recorded in
software_versions.txt. Validation: executable chunks passed on Windows; main test counts and significance match the expected values.
If something goes wrong
If something goes wrong
Stop at the first error. Check the input file named in the message and the previous step. Keep the command and the console log. Do not use files from a different version of the dataset. See troubleshooting (opens in a new tab).
Quick check
What should you do with a row that has an ERRCODE for a failure and a missing p-value?
Show the answer
Read the reason for the failure. Keep the p-value as missing. Do not replace it with a number, whether significant or not.
Files created
s6-5_top20.tsv, with the effect estimates and their intervals.