opts_chunk$set(fig.path = "docs/figures/", comment = NA, tidy = F, message = F, warning = F, echo = F, results = 'verbatim')
library(ggplot2) library(pander)
library(devtools) load_all()
theme_set(theme_light()) panderOptions('table.split.table', Inf) panderOptions('knitr.auto.asis', FALSE)
athaliana
is an R data package for the A. thaliana data set https://github.com/Gregor-Mendel-Institute/atpolydb.
Files to download:
| Data | File name | Url |
|:-----|:------------|:----|
| phen. | athaliana_filename_phen()
| athaliana_url_phen()
|
| SNP | athaliana_filename_snp()
| athaliana_url_snp()
|
R commands to download:
athaliana_download_phen(method = "wget") athaliana_download_snp(method = "wget")
R commands to put data in a proper format:
athaliana_write_snp() athaliana_write_map() snp <- athaliana_snp() relmat <- athaliana_compute_relmat(snp, center = TRUE, scale = TRUE) athaliana_write_relmat(relmat, filename = "relmat_centered.rds")
Here we are inerested to run a polygenic model
(the lme4qtl R package)
for one of the traits (FRI
).
phen <- athaliana_phen(traits = "FRI") relmat <- athaliana_relmat(filename = "relmat_std.rds") library(lme4qtl) (m <- relmatLmer(FRI ~ (1|id), phen, relmat = list(id = relmat)))
Note that the residuals are not OK.
r <- residuals(m) qqnorm(r) qqline(r) hist(r, breaks = 30)
That likely means the trait needs to be transformed.
hist(phen$FRI, breaks = 30)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.