Skip to content

Commit dec5eee

Browse files
committed
added vignette for comparing GEMMA v 0.96 C++ code results with those of gemma2 0.0.1
1 parent e1ed401 commit dec5eee

File tree

6 files changed

+97
-2
lines changed

6 files changed

+97
-2
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
.RData
44
.Renviron
55

6+
inst/doc

DESCRIPTION

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,8 @@ LazyData: true
1010
URL: https://github.com/fboehm/gemma2
1111
BugReports: https://github.com/fboehm/gemma2/issues
1212
Suggests: covr,
13-
testthat
13+
testthat,
14+
knitr,
15+
rmarkdown
1416
RoxygenNote: 6.0.1
17+
VignetteBuilder: knitr

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
YEAR: 2017
2-
COPYRIGHT HOLDER: Your name goes here
2+
COPYRIGHT HOLDER: Frederick Boehm

NEWS.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# gemma2 0.0.1
2+
3+
* added vignette for comparing mvlmm gemma2 results with those of Zhou's C++ GEMMA code (v 0.96)
4+
15
# gemma2 0.0.0.9000
26

37
* Added a `NEWS.md` file to track changes to the package.

vignettes/compare-with-GEMMAv096.Rmd

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
title: "Comparing gemma2 output with that of Zhou's GEMMA (v0.96)"
3+
author: "Frederick Boehm"
4+
date: "`r lubridate::now()`"
5+
output: rmarkdown::html_vignette
6+
vignette: >
7+
%\VignetteIndexEntry{Vignette Title}
8+
%\VignetteEngine{knitr::rmarkdown}
9+
%\VignetteEncoding{UTF-8}
10+
bibliography: gemma.bib
11+
---
12+
13+
```{r setup, include = FALSE}
14+
knitr::opts_chunk$set(
15+
collapse = TRUE,
16+
comment = "#>"
17+
)
18+
```
19+
20+
# Overview
21+
22+
`gemma2` is an R implementation of an EM algorithm [@zhou2014efficient] to fit a multivariate linear mixed effects model. Specifically, it fits, via restricted maximum likelihood (REML), the model:
23+
24+
$$vec(Y) = X vec(B) + vec(G) + vec(E)$$
25+
26+
where $Y$ is a n by 2 phenotypes matrix, with each row being a single subject and each column a distinct phenotype. $X$ is a 2n by 2f matrix of genotypes, where $n$ is the sample size and $f$ is the number of founder lines. $X$ has a block-diagonal structure, so that it contains, on the diagonal, two $n$ by $f$ blocks of genotype data. The two off-diagonal blocks are all zeros. $B$ is a $f$ by $2$ matrix of founder allele effect sizes.
27+
28+
29+
30+
31+
Vignettes are long form documentation commonly included in packages. Because they are part of the distribution of the package, they need to be as compact as possible. The `html_vignette` output type provides a custom style sheet (and tweaks some options) to ensure that the resulting html is as small as possible. The `html_vignette` format:
32+
33+
- Never uses retina figures
34+
- Has a smaller default figure size
35+
- Uses a custom CSS stylesheet instead of the default Twitter Bootstrap style
36+
37+
## Vignette Info
38+
39+
Note the various macros within the `vignette` section of the metadata block above. These are required in order to instruct R how to build the vignette. Note that you should change the `title` field and the `\VignetteIndexEntry` to match the title of your vignette.
40+
41+
## Styles
42+
43+
The `html_vignette` template includes a basic CSS theme. To override this theme you can specify your own CSS in the document metadata as follows:
44+
45+
output:
46+
rmarkdown::html_vignette:
47+
css: mystyles.css
48+
49+
## Figures
50+
51+
The figure sizes have been customised so that you can easily put two images side-by-side.
52+
53+
```{r, fig.show='hold'}
54+
plot(1:10)
55+
plot(10:1)
56+
```
57+
58+
You can enable figure captions by `fig_caption: yes` in YAML:
59+
60+
output:
61+
rmarkdown::html_vignette:
62+
fig_caption: yes
63+
64+
Then you can use the chunk option `fig.cap = "Your figure caption."` in **knitr**.
65+
66+
## More Examples
67+
68+
You can write math expressions, e.g. $Y = X\beta + \epsilon$, footnotes^[A footnote here.], and tables, e.g. using `knitr::kable()`.
69+
70+
```{r, echo=FALSE, results='asis'}
71+
knitr::kable(head(mtcars, 10))
72+
```
73+
74+
Also a quote using `>`:
75+
76+
> "He who gives up [code] safety for [code] speed deserves neither."
77+
([via](https://twitter.com/hadleywickham/status/504368538874703872))

vignettes/gemma.bib

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@article{zhou2014efficient,
2+
title={Efficient multivariate linear mixed model algorithms for genome-wide association studies},
3+
author={Zhou, Xiang and Stephens, Matthew},
4+
journal={Nature methods},
5+
volume={11},
6+
number={4},
7+
pages={407--409},
8+
year={2014},
9+
publisher={Nature Research}
10+
}

0 commit comments

Comments
 (0)