diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..dd6cb3d Binary files /dev/null and b/.DS_Store differ diff --git a/R/.DS_Store b/R/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/R/.DS_Store differ diff --git a/R/epurate.R b/R/epurate.R index 5be45a5..89a56aa 100644 --- a/R/epurate.R +++ b/R/epurate.R @@ -84,3 +84,86 @@ QIMR <- function(toc = TRUE, code_folding = "hide", number_sections=TRUE) { code_folding = code_folding, ) } + +# Features of ARAMIS Template +ARAMIS <- function(toc = TRUE, code_folding = "hide", number_sections=TRUE) { + + # get the locations of resource files located within the package + css <- system.file("rmarkdown", "templates", "ARAMIS" ,"resources", "style.css", package = "epuRate") + template <- system.file("rmarkdown", "templates", "ARAMIS" ,"resources", "template_aramis.html", package = "epuRate") + + # call the base html_document function + rmarkdown::html_document( theme= "lumen", + template= template, + css= css, + toc= toc, + toc_float = TRUE, + toc_depth = 2, + number_sections= number_sections, + df_print = "paged", + code_folding = code_folding, + ) +} + + +# Features of ARAMIS+PCTG Template +ARAMISPCTG <- function(toc = TRUE, code_folding = "hide", number_sections=TRUE) { + + # get the locations of resource files located within the package + css <- system.file("rmarkdown", "templates", "ARAMISPCTG" ,"resources", "style.css", package = "epuRate") + template <- system.file("rmarkdown", "templates", "ARAMISPCTG" ,"resources", "template_aramispctg.html", package = "epuRate") + + # call the base html_document function + rmarkdown::html_document( theme= "lumen", + template= template, + css= css, + toc= toc, + toc_float = TRUE, + toc_depth = 2, + number_sections= number_sections, + df_print = "paged", + code_folding = code_folding, + ) +} + + +# Features of KCL Template +KCL <- function(toc = TRUE, code_folding = "hide", number_sections=TRUE) { + + # get the locations of resource files located within the package + css <- system.file("rmarkdown", "templates", "KCL" ,"resources", "style.css", package = "epuRate") + template <- system.file("rmarkdown", "templates", "KCL" ,"resources", "template_kcl.html", package = "epuRate") + + # call the base html_document function + rmarkdown::html_document( theme= "lumen", + template= template, + css= css, + toc= toc, + toc_float = TRUE, + toc_depth = 2, + number_sections= number_sections, + df_print = "paged", + code_folding = code_folding, + ) +} + + +# Features of International Statistical Genetics Workshop (Boulder workshop) Template +ISGW <- function(toc = TRUE, code_folding = "hide", number_sections=TRUE) { + + # get the locations of resource files located within the package + css <- system.file("rmarkdown", "templates", "ISGW" ,"resources", "style.css", package = "epuRate") + template <- system.file("rmarkdown", "templates", "ISGW" ,"resources", "template_ISGW.html", package = "epuRate") + + # call the base html_document function + rmarkdown::html_document( theme= "lumen", + template= template, + css= css, + toc= toc, + toc_float = TRUE, + toc_depth = 2, + number_sections= number_sections, + df_print = "paged", + code_folding = code_folding, + ) +} diff --git a/README.md b/README.md index fe0ceb1..aae3244 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,9 @@ Note that a specific version is available for: - members of the [University of Queensland](https://holtzy.github.io/epuRate/uq.html) - members of [PCTG](https://holtzy.github.io/epuRate/pctg.html) - members of [QIMR](https://holtzy.github.io/epuRate/qimr.html) +- members of [ARAMIS] +- members of [KCL (King's College London)] +- members of [ISGW (International Statistical Genetics Workshop)]


@@ -28,7 +31,8 @@ Using it - Install the R package: ``` library(devtools) -install_github("holtzy/epuRate") +install_github("holtzy/epuRate") # For standard, UQ, PCTG and QIMR templates +install_github("baptisteCD/epuRate") # For all of the above as well as ARAMIS lab, KCL (King's College London), ISGW (International Statistical Genetics Workshop) library(epuRate) ``` - Open a new rmd file in Rstudio: File -> New File -> R Markdown -> From Template -> epuRate. @@ -36,9 +40,28 @@ library(epuRate) - Change the Header of your document with your name, email adress, github / twitter / linkedIn details if you want to display them. You can also add a logo over the table of content. +


+Personalised version +-------- +- Fork the repo and pull on your local computer +- Duplicate one of the template folders (**/epuRate/inst/rmarkdown/templates/**) +- Rename the template folder: **MYNEWTEMPLATE** +- Modify the template name in the file **template.yaml** +- Replace the logo file (jpg, png) in **/epuRate/inst/rmarkdown/templates/MYNEWTEMPLATE/resources/** +- Add path to this logo file at line 382 of the **template_MYNEWTEMPLATE.html** file +- The path should correspond to your github link to the logo so typically: **https://github.com/MYGITHUBUSERNAME/epuRate/raw/master/inst/rmarkdown/templates/MYNEWTEMPLATE/resources/MYNEWTEMPLATE.png** +- Choose the personalised color that suits your logo and add the HEX code to the **style.css** file +- I tend to use a color from the logo, which I obtain using free online tool(s) +- You can choose a palette of colours or a single colour for the titles, links, TOCs and buttons +- In the **epuRate/R/epurate.R** add an instance for your new template and select the default options of the RMarkdown +- Commit and push the changes into your forked version in Github +- You should now be able to use your template by running **install_github("MYGITHUBUSERNAME/epuRate")** - + +--> Alternatively email me or send me a message on github with your **logo file**, the **HEX color code** + and the **Name of your wished template**, and I will see what I can do. +


Acknowledgment -------- -Thanks to [Florian Rohart](http://florian.rohart.free.fr/Professional_page/Home.html) for his help on the PCTG template. Thanks to [Rstudio](https://www.rstudio.com) and its team for developing so many awesome tools. +Thanks to [Florian Rohart](http://florian.rohart.free.fr/Professional_page/Home.html) for his help on the PCTG template and [Baptiste Couvy-Duchesne](https://github.com/baptisteCD) for extending the template to ARAMIS, KCL and ISGW. Thanks to [Rstudio](https://www.rstudio.com) and its team for developing so many awesome tools. diff --git a/aramis.html b/aramis.html new file mode 100644 index 0000000..f163520 --- /dev/null +++ b/aramis.html @@ -0,0 +1,439 @@ + + + + + + + + + + + + + + + + + + + +ARAMIS R Markdown template + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+
+
+ logo +
+
+ +
+ + + + + + + +





+
+

Welcome in the ARAMIS R Markdown template. This document describes how the template looks like, building an interactive Manhattan plot.

+
+
+

Loading data

+
+

Let’s load a GWAS summary statistic stored in the qqman library. This library is:

+
    +
  • Made by Stephen Turner
  • +
  • Good to plot a quick Manhattan plot
  • +
+
library(qqman)
+
+
+

Show data in a table

+
+

It’s often handy to keep a trace of the raw data somewhere in your document. The DT library allows to build interactive tables that you can search, filter, highlight and more.

+
library(DT)
+datatable(gwasResults, rownames = FALSE, filter="top", options = list(pageLength = 5, scrollX=T) )
+
+ +
+
+

Manhattan plot

+
+

Using HTML outputs you can embed some interactive graphics. For example, the plotly library can transform any of your ggplot2 graphic in an interactive chart:

+
# Make the plot
+p <- ggplot(don, aes(x=BPcum, y=-log10(P), text=text)) +
+    
+    # Show all points
+    geom_point( aes(color=as.factor(CHR)), alpha=0.8, size=1.3) +
+    scale_color_manual(values = rep(c("grey", "#69b3a2"), 22 )) +
+    
+    # custom X axis:
+    scale_x_continuous( label = axisdf$CHR, breaks= axisdf$center ) +
+    scale_y_continuous(expand = c(0, 0) ) +     # remove space between plot area and x axis
+
+    # Add highlighted points
+    geom_point(data=subset(don, is_highlight=="yes"), color="orange", size=2) +
+  
+    # Custom the theme:
+    theme_bw() +
+    theme( 
+      legend.position="none",
+      panel.border = element_blank(),
+      panel.grid.major.x = element_blank(),
+      panel.grid.minor.x = element_blank()
+    ) +
+    ylim(0, 10)
+
+ggplotly(p, tooltip="text")
+
+ +
+ + + +  +



+
+

A work by Yan Holtz

+

+ + + + + +

+ + + + +

+ +  + + + +
+
+ +
+ + + + + + + + + + diff --git a/aramispctg.html b/aramispctg.html new file mode 100644 index 0000000..6b50a40 --- /dev/null +++ b/aramispctg.html @@ -0,0 +1,439 @@ + + + + + + + + + + + + + + + + + + + +ARAMIS+PCTG R Markdown template + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+
+
+ logo +
+
+ +
+ + + + + + + +





+
+

Welcome in the ARAMIS R Markdown template. This document describes how the template looks like, building an interactive Manhattan plot.

+
+
+

Loading data

+
+

Let’s load a GWAS summary statistic stored in the qqman library. This library is:

+
    +
  • Made by Stephen Turner
  • +
  • Good to plot a quick Manhattan plot
  • +
+
library(qqman)
+
+
+

Show data in a table

+
+

It’s often handy to keep a trace of the raw data somewhere in your document. The DT library allows to build interactive tables that you can search, filter, highlight and more.

+
library(DT)
+datatable(gwasResults, rownames = FALSE, filter="top", options = list(pageLength = 5, scrollX=T) )
+
+ +
+
+

Manhattan plot

+
+

Using HTML outputs you can embed some interactive graphics. For example, the plotly library can transform any of your ggplot2 graphic in an interactive chart:

+
# Make the plot
+p <- ggplot(don, aes(x=BPcum, y=-log10(P), text=text)) +
+    
+    # Show all points
+    geom_point( aes(color=as.factor(CHR)), alpha=0.8, size=1.3) +
+    scale_color_manual(values = rep(c("grey", "#69b3a2"), 22 )) +
+    
+    # custom X axis:
+    scale_x_continuous( label = axisdf$CHR, breaks= axisdf$center ) +
+    scale_y_continuous(expand = c(0, 0) ) +     # remove space between plot area and x axis
+
+    # Add highlighted points
+    geom_point(data=subset(don, is_highlight=="yes"), color="orange", size=2) +
+  
+    # Custom the theme:
+    theme_bw() +
+    theme( 
+      legend.position="none",
+      panel.border = element_blank(),
+      panel.grid.major.x = element_blank(),
+      panel.grid.minor.x = element_blank()
+    ) +
+    ylim(0, 10)
+
+ggplotly(p, tooltip="text")
+
+ +
+ + + +  +



+
+

A work by Yan Holtz

+

+ + + + + +

+ + + + +

+ +  + + + +
+
+ +
+ + + + + + + + + + diff --git a/build.R b/build.R index f407ac0..61152ba 100644 --- a/build.R +++ b/build.R @@ -5,9 +5,14 @@ # Remove previous version just in Case remove.packages("epuRate") -# Install with devtools +# Install with devtools (LOCAL) +#library(devtools) +#devtools::install("../epuRate") + +# Install from github library(devtools) -devtools::install("../epuRate") +devtools::install_github("baptisteCD/epuRate") + # Load to check it is all good library(epuRate) diff --git a/epuRate.Rproj b/epuRate.Rproj index d848a9f..bfa3107 100644 --- a/epuRate.Rproj +++ b/epuRate.Rproj @@ -5,8 +5,13 @@ SaveWorkspace: No AlwaysSaveHistory: Default EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 4 Encoding: UTF-8 +RnwWeave: Sweave +LaTeX: pdfLaTeX + AutoAppendNewline: Yes StripTrailingWhitespace: Yes diff --git a/inst/.DS_Store b/inst/.DS_Store new file mode 100644 index 0000000..40d1417 Binary files /dev/null and b/inst/.DS_Store differ diff --git a/inst/rmarkdown/.DS_Store b/inst/rmarkdown/.DS_Store new file mode 100644 index 0000000..2cc95da Binary files /dev/null and b/inst/rmarkdown/.DS_Store differ diff --git a/inst/rmarkdown/templates/.DS_Store b/inst/rmarkdown/templates/.DS_Store new file mode 100644 index 0000000..f8f7aa8 Binary files /dev/null and b/inst/rmarkdown/templates/.DS_Store differ diff --git a/inst/rmarkdown/templates/ARAMIS/.DS_Store b/inst/rmarkdown/templates/ARAMIS/.DS_Store new file mode 100644 index 0000000..59b094f Binary files /dev/null and b/inst/rmarkdown/templates/ARAMIS/.DS_Store differ diff --git a/inst/rmarkdown/templates/ARAMIS/resources/.DS_Store b/inst/rmarkdown/templates/ARAMIS/resources/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/inst/rmarkdown/templates/ARAMIS/resources/.DS_Store differ diff --git a/inst/rmarkdown/templates/ARAMIS/resources/aramis.png b/inst/rmarkdown/templates/ARAMIS/resources/aramis.png new file mode 100644 index 0000000..7604987 Binary files /dev/null and b/inst/rmarkdown/templates/ARAMIS/resources/aramis.png differ diff --git a/inst/rmarkdown/templates/ARAMIS/resources/style.css b/inst/rmarkdown/templates/ARAMIS/resources/style.css new file mode 100644 index 0000000..760a0aa --- /dev/null +++ b/inst/rmarkdown/templates/ARAMIS/resources/style.css @@ -0,0 +1,87 @@ +h1, .h1, h2, .h2, h3, .h3 { + margin-top: 84px; + color: #6A0888 +} + +h1 { + padding-top: 100px; +} + +h1.title { + text-align: center; +} + +pre { + border: 0px solid #cccccc; + border-radius: 0px; + } + + + + + + + +/* ---------- Links ----------------- */ +a { + color: #6A0888; +} +a:hover { + color: #6A0888; +} + + + + +/* ---------- TOC ----------------- */ +#TOC { + top: 30%; + position: fixed; + width: 210px; +} +.tocify { + border: none; + color: grey; + border-radius: 0px; +} +.list-group-item.active { + color: #6A0888; + background-color: white; + border-left: solid; + border-color: #6A0888; +} +.list-group-item:hover { + color: #6A0888; + background-color: white; + border-left: solid; + border-color: #6A0888; +} +.tocify-extend-page { + display: none; +} + + +/* ------ This is just to fix the bug on Safari where table of content is on top of content */ +.toc-content { + margin-left: 230px +} + + + + +/* ---------- Button ----------------- */ +.btn { + border-width: 0 0px 0px 0px; + font-weight: normal; + text-transform: ; + color: #6A0888; +} +.btn-default { + color: #6A0888; + background-color: #ffffff; + border-color: #ffffff; +} + +.nav-pills > li.active > a, .nav-pills > li.active > a:hover, .nav-pills > li.active > a:focus { + background-color: #6A0888; +} diff --git a/inst/rmarkdown/templates/ARAMIS/resources/template_aramis.html b/inst/rmarkdown/templates/ARAMIS/resources/template_aramis.html new file mode 100644 index 0000000..d39e954 --- /dev/null +++ b/inst/rmarkdown/templates/ARAMIS/resources/template_aramis.html @@ -0,0 +1,547 @@ + + + + + + + + + + + +$if(github)$ + +$endif$ + + +$if(theme)$ +$else$ + +$endif$ + +$for(author-meta)$ + +$endfor$ + +$if(date-meta)$ + +$endif$ + +$if(title-prefix)$$title-prefix$ - $endif$$pagetitle$ + +$for(header-includes)$ +$header-includes$ +$endfor$ + +$if(highlightjs)$ + +$if(theme)$ + +$endif$ + +$endif$ + +$if(highlighting-css)$ + + +$if(theme)$ + +$endif$ +$endif$ + +$if(abstract)$ + +$endif$ + +$if(theme)$ + +$endif$ + +$for(css)$ + +$endfor$ + + + + + +$if(theme)$ + + +$if(kable-scroll)$ + +$endif$ + +$if(navbar)$ + + + + +$endif$ + +
+ + + + + +$if(code_menu)$ + + +$endif$ + + + +$if(toc_float)$ + + + + + + + + +
+
+
+ logo +
+
+ +
+ +$endif$ + +$endif$ + +$for(include-before)$ +$include-before$ +$endfor$ + +$if(theme)$ +
+ +$if(code_menu)$ +
+ + +
+ +$endif$ + +$endif$ + +$if(title)$ +

$title$

+$if(subtitle)$ +

$subtitle$

+$endif$ +$for(author)$ +$if(author.name)$ +

$author.name$

+$if(author.affiliation)$ +
+$author.affiliation$
$endif$ +$if(author.email)$ +$author.email$ +
+$endif$ +$else$ +

$author$ - $date$

+$endif$ +$endfor$ +$if(abstract)$ +
+

Abstract

+$abstract$ +
+$endif$ +$endif$ + +$if(theme)$ +
+$endif$ + +$if(toc_float)$ +$else$ +$if(toc)$ +
+$toc$ +
+$endif$ +$endif$ + +$body$ + +$for(include-after)$ +$include-after$ +$endfor$ + + +  +



+
+

A work by $author$

+

$mail$

+ + + + + +

+ $if(twitter)$ + + $endif$ + $if(linkedin)$ + + $endif$ + $if(github)$ + + $endif$ + $if(home)$ + + $endif$ +

+ +  + + +$if(theme)$ + +$if(toc_float)$ +
+
+$endif$ + +
+ + + + + + +$endif$ + +$if(mathjax-url)$ + + +$endif$ + + + diff --git a/inst/rmarkdown/templates/ARAMIS/skeleton/.DS_Store b/inst/rmarkdown/templates/ARAMIS/skeleton/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/inst/rmarkdown/templates/ARAMIS/skeleton/.DS_Store differ diff --git a/inst/rmarkdown/templates/ARAMIS/skeleton/skeleton.Rmd b/inst/rmarkdown/templates/ARAMIS/skeleton/skeleton.Rmd new file mode 100644 index 0000000..3016c52 --- /dev/null +++ b/inst/rmarkdown/templates/ARAMIS/skeleton/skeleton.Rmd @@ -0,0 +1,128 @@ +--- +title: "ARAMIS R Markdown template" +author: "[Yan Holtz](https://github.com/holtzy)" +date: "`r format(Sys.time(), '%d %B %Y')`" +mail: "yan.holtz.data@gmail.com" +linkedin: "yan-holtz-2477534a" +twitter: "r_graph_gallery" +github: "holtzy" +home: "www.yan-holtz.com" +output: + epuRate::ARAMIS: + toc: TRUE + number_sections: FALSE + code_folding: "hide" +--- + +```{r, echo=FALSE, message=FALSE, warning=FALSE} +# You need these libraries to run this template: +library(rmarkdown) # install.packages("rmarkdown") +library(epuRate) # devtools::install_github("holtzy/epuRate", force=TRUE) + +``` + +



+ +>Welcome in the [ARAMIS R Markdown template](https://github.com/holtzy/epuRate). This document describes how the template looks like, building an interactive Manhattan plot. + + + + + + +# Loading data +*** +Let's load a GWAS summary statistic stored in the [qqman library](https://github.com/stephenturner/qqman). This library is: + +- Made by Stephen Turner +- Good to plot a quick Manhattan plot + +```{r, message=FALSE} +library(qqman) +``` + + + + + + +# Show data in a table +*** +It's often handy to keep a trace of the raw data somewhere in your document. The DT library allows to build interactive tables that you can search, filter, highlight and more. +```{r} +library(DT) +datatable(gwasResults, rownames = FALSE, filter="top", options = list(pageLength = 5, scrollX=T) ) +``` + + + + + +# Manhattan plot +*** +Using `HTML` outputs you can embed some interactive graphics. For example, the plotly library can transform any of your ggplot2 graphic in an interactive chart: +```{r, message=FALSE, warning=FALSE, echo=FALSE} +# Libraries +library(plotly) +library(tidyverse) + +# Prepare the dataset +don <- gwasResults %>% + + # Compute chromosome size + group_by(CHR) %>% + summarise(chr_len=max(BP)) %>% + + # Calculate cumulative position of each chromosome + mutate(tot=cumsum(chr_len)-chr_len) %>% + select(-chr_len) %>% + + # Add this info to the initial dataset + left_join(gwasResults, ., by=c("CHR"="CHR")) %>% + + # Add a cumulative position of each SNP + arrange(CHR, BP) %>% + mutate( BPcum=BP+tot) %>% + + # Add highlight and annotation information + mutate( is_highlight=ifelse(SNP %in% snpsOfInterest, "yes", "no")) %>% + + # Filter SNP to make the plot lighter + filter(-log10(P)>0.5) + +# Prepare X axis +axisdf <- don %>% group_by(CHR) %>% summarize(center=( max(BPcum) + min(BPcum) ) / 2 ) + +# Prepare text description for each SNP: +don$text <- paste("SNP: ", don$SNP, "\nPosition: ", don$BP, "\nChromosome: ", don$CHR, "\nLOD score:", -log10(don$P) %>% round(2), "\nWhat else do you wanna know", sep="") +``` + +```{r, message=FALSE, warning=FALSE, fig.width=9} +# Make the plot +p <- ggplot(don, aes(x=BPcum, y=-log10(P), text=text)) + + + # Show all points + geom_point( aes(color=as.factor(CHR)), alpha=0.8, size=1.3) + + scale_color_manual(values = rep(c("grey", "#69b3a2"), 22 )) + + + # custom X axis: + scale_x_continuous( label = axisdf$CHR, breaks= axisdf$center ) + + scale_y_continuous(expand = c(0, 0) ) + # remove space between plot area and x axis + + # Add highlighted points + geom_point(data=subset(don, is_highlight=="yes"), color="orange", size=2) + + + # Custom the theme: + theme_bw() + + theme( + legend.position="none", + panel.border = element_blank(), + panel.grid.major.x = element_blank(), + panel.grid.minor.x = element_blank() + ) + + ylim(0, 10) + +ggplotly(p, tooltip="text") +``` + + diff --git a/inst/rmarkdown/templates/ARAMIS/template.yaml b/inst/rmarkdown/templates/ARAMIS/template.yaml new file mode 100644 index 0000000..269756d --- /dev/null +++ b/inst/rmarkdown/templates/ARAMIS/template.yaml @@ -0,0 +1,3 @@ +name: ARAMIS +description: ARAMIS R markdown template +create_dir: FALSE diff --git a/inst/rmarkdown/templates/ARAMISPCTG/.DS_Store b/inst/rmarkdown/templates/ARAMISPCTG/.DS_Store new file mode 100644 index 0000000..7f1eb0e Binary files /dev/null and b/inst/rmarkdown/templates/ARAMISPCTG/.DS_Store differ diff --git a/inst/rmarkdown/templates/ARAMISPCTG/resources/.DS_Store b/inst/rmarkdown/templates/ARAMISPCTG/resources/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/inst/rmarkdown/templates/ARAMISPCTG/resources/.DS_Store differ diff --git a/inst/rmarkdown/templates/ARAMISPCTG/resources/aramispctg.png b/inst/rmarkdown/templates/ARAMISPCTG/resources/aramispctg.png new file mode 100644 index 0000000..22097e7 Binary files /dev/null and b/inst/rmarkdown/templates/ARAMISPCTG/resources/aramispctg.png differ diff --git a/inst/rmarkdown/templates/ARAMISPCTG/resources/style.css b/inst/rmarkdown/templates/ARAMISPCTG/resources/style.css new file mode 100644 index 0000000..2b83fe3 --- /dev/null +++ b/inst/rmarkdown/templates/ARAMISPCTG/resources/style.css @@ -0,0 +1,87 @@ +h1, .h1, h2, .h2, h3, .h3 { + margin-top: 84px; + color: #0489B1 +} + +h1 { + padding-top: 100px; +} + +h1.title { + text-align: center; +} + +pre { + border: 0px solid #cccccc; + border-radius: 0px; + } + + + + + + + +/* ---------- Links ----------------- */ +a { + color: #0489B1; +} +a:hover { + color: #0489B1; +} + + + + +/* ---------- TOC ----------------- */ +#TOC { + top: 30%; + position: fixed; + width: 210px; +} +.tocify { + border: none; + color: grey; + border-radius: 0px; +} +.list-group-item.active { + color: #0489B1; + background-color: white; + border-left: solid; + border-color: #0489B1; +} +.list-group-item:hover { + color: #0489B1; + background-color: white; + border-left: solid; + border-color: #0489B1; +} +.tocify-extend-page { + display: none; +} + + +/* ------ This is just to fix the bug on Safari where table of content is on top of content */ +.toc-content { + margin-left: 230px +} + + + + +/* ---------- Button ----------------- */ +.btn { + border-width: 0 0px 0px 0px; + font-weight: normal; + text-transform: ; + color: #0489B1; +} +.btn-default { + color: #0489B1; + background-color: #ffffff; + border-color: #ffffff; +} + +.nav-pills > li.active > a, .nav-pills > li.active > a:hover, .nav-pills > li.active > a:focus { + background-color: #0489B1; +} diff --git a/inst/rmarkdown/templates/ARAMISPCTG/resources/template_aramispctg.html b/inst/rmarkdown/templates/ARAMISPCTG/resources/template_aramispctg.html new file mode 100644 index 0000000..dba944a --- /dev/null +++ b/inst/rmarkdown/templates/ARAMISPCTG/resources/template_aramispctg.html @@ -0,0 +1,547 @@ + + + + + + + + + + + +$if(github)$ + +$endif$ + + +$if(theme)$ +$else$ + +$endif$ + +$for(author-meta)$ + +$endfor$ + +$if(date-meta)$ + +$endif$ + +$if(title-prefix)$$title-prefix$ - $endif$$pagetitle$ + +$for(header-includes)$ +$header-includes$ +$endfor$ + +$if(highlightjs)$ + +$if(theme)$ + +$endif$ + +$endif$ + +$if(highlighting-css)$ + + +$if(theme)$ + +$endif$ +$endif$ + +$if(abstract)$ + +$endif$ + +$if(theme)$ + +$endif$ + +$for(css)$ + +$endfor$ + + + + + +$if(theme)$ + + +$if(kable-scroll)$ + +$endif$ + +$if(navbar)$ + + + + +$endif$ + +
+ + + + + +$if(code_menu)$ + + +$endif$ + + + +$if(toc_float)$ + + + + + + + + +
+
+
+ logo +
+
+ +
+ +$endif$ + +$endif$ + +$for(include-before)$ +$include-before$ +$endfor$ + +$if(theme)$ +
+ +$if(code_menu)$ +
+ + +
+ +$endif$ + +$endif$ + +$if(title)$ +

$title$

+$if(subtitle)$ +

$subtitle$

+$endif$ +$for(author)$ +$if(author.name)$ +

$author.name$

+$if(author.affiliation)$ +
+$author.affiliation$
$endif$ +$if(author.email)$ +$author.email$ +
+$endif$ +$else$ +

$author$ - $date$

+$endif$ +$endfor$ +$if(abstract)$ +
+

Abstract

+$abstract$ +
+$endif$ +$endif$ + +$if(theme)$ +
+$endif$ + +$if(toc_float)$ +$else$ +$if(toc)$ +
+$toc$ +
+$endif$ +$endif$ + +$body$ + +$for(include-after)$ +$include-after$ +$endfor$ + + +  +



+
+

A work by $author$

+

$mail$

+ + + + + +

+ $if(twitter)$ + + $endif$ + $if(linkedin)$ + + $endif$ + $if(github)$ + + $endif$ + $if(home)$ + + $endif$ +

+ +  + + +$if(theme)$ + +$if(toc_float)$ +
+
+$endif$ + +
+ + + + + + +$endif$ + +$if(mathjax-url)$ + + +$endif$ + + + diff --git a/inst/rmarkdown/templates/ARAMISPCTG/skeleton/.DS_Store b/inst/rmarkdown/templates/ARAMISPCTG/skeleton/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/inst/rmarkdown/templates/ARAMISPCTG/skeleton/.DS_Store differ diff --git a/inst/rmarkdown/templates/ARAMISPCTG/skeleton/skeleton.Rmd b/inst/rmarkdown/templates/ARAMISPCTG/skeleton/skeleton.Rmd new file mode 100644 index 0000000..34101e6 --- /dev/null +++ b/inst/rmarkdown/templates/ARAMISPCTG/skeleton/skeleton.Rmd @@ -0,0 +1,128 @@ +--- +title: "ARAMIS+PCTG R Markdown template" +author: "[Yan Holtz](https://github.com/holtzy)" +date: "`r format(Sys.time(), '%d %B %Y')`" +mail: "yan.holtz.data@gmail.com" +linkedin: "yan-holtz-2477534a" +twitter: "r_graph_gallery" +github: "holtzy" +home: "www.yan-holtz.com" +output: + epuRate::ARAMISPCTG: + toc: TRUE + number_sections: FALSE + code_folding: "hide" +--- + +```{r, echo=FALSE, message=FALSE, warning=FALSE} +# You need these libraries to run this template: +library(rmarkdown) # install.packages("rmarkdown") +library(epuRate) # devtools::install_github("holtzy/epuRate", force=TRUE) + +``` + +



+ +>Welcome in the [ARAMIS R Markdown template](https://github.com/holtzy/epuRate). This document describes how the template looks like, building an interactive Manhattan plot. + + + + + + +# Loading data +*** +Let's load a GWAS summary statistic stored in the [qqman library](https://github.com/stephenturner/qqman). This library is: + +- Made by Stephen Turner +- Good to plot a quick Manhattan plot + +```{r, message=FALSE} +library(qqman) +``` + + + + + + +# Show data in a table +*** +It's often handy to keep a trace of the raw data somewhere in your document. The DT library allows to build interactive tables that you can search, filter, highlight and more. +```{r} +library(DT) +datatable(gwasResults, rownames = FALSE, filter="top", options = list(pageLength = 5, scrollX=T) ) +``` + + + + + +# Manhattan plot +*** +Using `HTML` outputs you can embed some interactive graphics. For example, the plotly library can transform any of your ggplot2 graphic in an interactive chart: +```{r, message=FALSE, warning=FALSE, echo=FALSE} +# Libraries +library(plotly) +library(tidyverse) + +# Prepare the dataset +don <- gwasResults %>% + + # Compute chromosome size + group_by(CHR) %>% + summarise(chr_len=max(BP)) %>% + + # Calculate cumulative position of each chromosome + mutate(tot=cumsum(chr_len)-chr_len) %>% + select(-chr_len) %>% + + # Add this info to the initial dataset + left_join(gwasResults, ., by=c("CHR"="CHR")) %>% + + # Add a cumulative position of each SNP + arrange(CHR, BP) %>% + mutate( BPcum=BP+tot) %>% + + # Add highlight and annotation information + mutate( is_highlight=ifelse(SNP %in% snpsOfInterest, "yes", "no")) %>% + + # Filter SNP to make the plot lighter + filter(-log10(P)>0.5) + +# Prepare X axis +axisdf <- don %>% group_by(CHR) %>% summarize(center=( max(BPcum) + min(BPcum) ) / 2 ) + +# Prepare text description for each SNP: +don$text <- paste("SNP: ", don$SNP, "\nPosition: ", don$BP, "\nChromosome: ", don$CHR, "\nLOD score:", -log10(don$P) %>% round(2), "\nWhat else do you wanna know", sep="") +``` + +```{r, message=FALSE, warning=FALSE, fig.width=9} +# Make the plot +p <- ggplot(don, aes(x=BPcum, y=-log10(P), text=text)) + + + # Show all points + geom_point( aes(color=as.factor(CHR)), alpha=0.8, size=1.3) + + scale_color_manual(values = rep(c("grey", "#69b3a2"), 22 )) + + + # custom X axis: + scale_x_continuous( label = axisdf$CHR, breaks= axisdf$center ) + + scale_y_continuous(expand = c(0, 0) ) + # remove space between plot area and x axis + + # Add highlighted points + geom_point(data=subset(don, is_highlight=="yes"), color="orange", size=2) + + + # Custom the theme: + theme_bw() + + theme( + legend.position="none", + panel.border = element_blank(), + panel.grid.major.x = element_blank(), + panel.grid.minor.x = element_blank() + ) + + ylim(0, 10) + +ggplotly(p, tooltip="text") +``` + + diff --git a/inst/rmarkdown/templates/ARAMISPCTG/template.yaml b/inst/rmarkdown/templates/ARAMISPCTG/template.yaml new file mode 100644 index 0000000..71a64bb --- /dev/null +++ b/inst/rmarkdown/templates/ARAMISPCTG/template.yaml @@ -0,0 +1,3 @@ +name: ARAMIS+PCTG +description: ARAMIS + PCTG R markdown template +create_dir: FALSE diff --git a/inst/rmarkdown/templates/ISGW/.DS_Store b/inst/rmarkdown/templates/ISGW/.DS_Store new file mode 100644 index 0000000..c91c934 Binary files /dev/null and b/inst/rmarkdown/templates/ISGW/.DS_Store differ diff --git a/inst/rmarkdown/templates/ISGW/resources/.DS_Store b/inst/rmarkdown/templates/ISGW/resources/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/inst/rmarkdown/templates/ISGW/resources/.DS_Store differ diff --git a/inst/rmarkdown/templates/ISGW/resources/isgw.png b/inst/rmarkdown/templates/ISGW/resources/isgw.png new file mode 100644 index 0000000..c91f034 Binary files /dev/null and b/inst/rmarkdown/templates/ISGW/resources/isgw.png differ diff --git a/inst/rmarkdown/templates/ISGW/resources/style.css b/inst/rmarkdown/templates/ISGW/resources/style.css new file mode 100644 index 0000000..c6eac6f --- /dev/null +++ b/inst/rmarkdown/templates/ISGW/resources/style.css @@ -0,0 +1,87 @@ +h1, .h1, h2, .h2, h3, .h3 { + margin-top: 84px; + color: #b6a45e +} + +h1 { + padding-top: 100px; +} + +h1.title { + text-align: center; +} + +pre { + border: 0px solid #cccccc; + border-radius: 0px; + } + + + + + + + +/* ---------- Links ----------------- */ +a { + color: #b6a45e; +} +a:hover { + color: #b6a45e; +} + + + + +/* ---------- TOC ----------------- */ +#TOC { + top: 30%; + position: fixed; + width: 210px; +} +.tocify { + border: none; + color: grey; + border-radius: 0px; +} +.list-group-item.active { + color: #b6a45e; + background-color: white; + border-left: solid; + border-color: #b6a45e; +} +.list-group-item:hover { + color: #b6a45e; + background-color: white; + border-left: solid; + border-color: #b6a45e; +} +.tocify-extend-page { + display: none; +} + + +/* ------ This is just to fix the bug on Safari where table of content is on top of content */ +.toc-content { + margin-left: 230px +} + + + + +/* ---------- Button ----------------- */ +.btn { + border-width: 0 0px 0px 0px; + font-weight: normal; + text-transform: ; + color: #b6a45e; +} +.btn-default { + color: #b6a45e; + background-color: #ffffff; + border-color: #ffffff; +} + +.nav-pills > li.active > a, .nav-pills > li.active > a:hover, .nav-pills > li.active > a:focus { + background-color: #b6a45e; +} diff --git a/inst/rmarkdown/templates/ISGW/resources/template_isgw.html b/inst/rmarkdown/templates/ISGW/resources/template_isgw.html new file mode 100644 index 0000000..efb0ec7 --- /dev/null +++ b/inst/rmarkdown/templates/ISGW/resources/template_isgw.html @@ -0,0 +1,547 @@ + + + + + + + + + + + +$if(github)$ + +$endif$ + + +$if(theme)$ +$else$ + +$endif$ + +$for(author-meta)$ + +$endfor$ + +$if(date-meta)$ + +$endif$ + +$if(title-prefix)$$title-prefix$ - $endif$$pagetitle$ + +$for(header-includes)$ +$header-includes$ +$endfor$ + +$if(highlightjs)$ + +$if(theme)$ + +$endif$ + +$endif$ + +$if(highlighting-css)$ + + +$if(theme)$ + +$endif$ +$endif$ + +$if(abstract)$ + +$endif$ + +$if(theme)$ + +$endif$ + +$for(css)$ + +$endfor$ + + + + + +$if(theme)$ + + +$if(kable-scroll)$ + +$endif$ + +$if(navbar)$ + + + + +$endif$ + +
+ + + + + +$if(code_menu)$ + + +$endif$ + + + +$if(toc_float)$ + + + + + + + + +
+
+
+ logo +
+
+ +
+ +$endif$ + +$endif$ + +$for(include-before)$ +$include-before$ +$endfor$ + +$if(theme)$ +
+ +$if(code_menu)$ +
+ + +
+ +$endif$ + +$endif$ + +$if(title)$ +

$title$

+$if(subtitle)$ +

$subtitle$

+$endif$ +$for(author)$ +$if(author.name)$ +

$author.name$

+$if(author.affiliation)$ +
+$author.affiliation$
$endif$ +$if(author.email)$ +$author.email$ +
+$endif$ +$else$ +

$author$ - $date$

+$endif$ +$endfor$ +$if(abstract)$ +
+

Abstract

+$abstract$ +
+$endif$ +$endif$ + +$if(theme)$ +
+$endif$ + +$if(toc_float)$ +$else$ +$if(toc)$ +
+$toc$ +
+$endif$ +$endif$ + +$body$ + +$for(include-after)$ +$include-after$ +$endfor$ + + +  +



+
+

A work by $author$

+

$mail$

+ + + + + +

+ $if(twitter)$ + + $endif$ + $if(linkedin)$ + + $endif$ + $if(github)$ + + $endif$ + $if(home)$ + + $endif$ +

+ +  + + +$if(theme)$ + +$if(toc_float)$ +
+
+$endif$ + +
+ + + + + + +$endif$ + +$if(mathjax-url)$ + + +$endif$ + + + diff --git a/inst/rmarkdown/templates/ISGW/skeleton/.DS_Store b/inst/rmarkdown/templates/ISGW/skeleton/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/inst/rmarkdown/templates/ISGW/skeleton/.DS_Store differ diff --git a/inst/rmarkdown/templates/ISGW/skeleton/skeleton.Rmd b/inst/rmarkdown/templates/ISGW/skeleton/skeleton.Rmd new file mode 100644 index 0000000..e1c72e4 --- /dev/null +++ b/inst/rmarkdown/templates/ISGW/skeleton/skeleton.Rmd @@ -0,0 +1,128 @@ +--- +title: "ISGW R Markdown template" +author: "[Yan Holtz](https://github.com/holtzy)" +date: "`r format(Sys.time(), '%d %B %Y')`" +mail: "yan.holtz.data@gmail.com" +linkedin: "yan-holtz-2477534a" +twitter: "r_graph_gallery" +github: "holtzy" +home: "www.yan-holtz.com" +output: + epuRate::ISGW: + toc: TRUE + number_sections: FALSE + code_folding: "hide" +--- + +```{r, echo=FALSE, message=FALSE, warning=FALSE} +# You need these libraries to run this template: +library(rmarkdown) # install.packages("rmarkdown") +library(epuRate) # devtools::install_github("baptisteCD/epuRate", force=TRUE) + +``` + +



+ +>Welcome in the [ISGW R Markdown template](https://github.com/holtzy/epuRate). This document describes how the template looks like, building an interactive Manhattan plot. + + + + + + +# Loading data +*** +Let's load a GWAS summary statistic stored in the [qqman library](https://github.com/stephenturner/qqman). This library is: + +- Made by Stephen Turner +- Good to plot a quick Manhattan plot + +```{r, message=FALSE} +library(qqman) +``` + + + + + + +# Show data in a table +*** +It's often handy to keep a trace of the raw data somewhere in your document. The DT library allows to build interactive tables that you can search, filter, highlight and more. +```{r} +library(DT) +datatable(gwasResults, rownames = FALSE, filter="top", options = list(pageLength = 5, scrollX=T) ) +``` + + + + + +# Manhattan plot +*** +Using `HTML` outputs you can embed some interactive graphics. For example, the plotly library can transform any of your ggplot2 graphic in an interactive chart: +```{r, message=FALSE, warning=FALSE, echo=FALSE} +# Libraries +library(plotly) +library(tidyverse) + +# Prepare the dataset +don <- gwasResults %>% + + # Compute chromosome size + group_by(CHR) %>% + summarise(chr_len=max(BP)) %>% + + # Calculate cumulative position of each chromosome + mutate(tot=cumsum(chr_len)-chr_len) %>% + select(-chr_len) %>% + + # Add this info to the initial dataset + left_join(gwasResults, ., by=c("CHR"="CHR")) %>% + + # Add a cumulative position of each SNP + arrange(CHR, BP) %>% + mutate( BPcum=BP+tot) %>% + + # Add highlight and annotation information + mutate( is_highlight=ifelse(SNP %in% snpsOfInterest, "yes", "no")) %>% + + # Filter SNP to make the plot lighter + filter(-log10(P)>0.5) + +# Prepare X axis +axisdf <- don %>% group_by(CHR) %>% summarize(center=( max(BPcum) + min(BPcum) ) / 2 ) + +# Prepare text description for each SNP: +don$text <- paste("SNP: ", don$SNP, "\nPosition: ", don$BP, "\nChromosome: ", don$CHR, "\nLOD score:", -log10(don$P) %>% round(2), "\nWhat else do you wanna know", sep="") +``` + +```{r, message=FALSE, warning=FALSE, fig.width=9} +# Make the plot +p <- ggplot(don, aes(x=BPcum, y=-log10(P), text=text)) + + + # Show all points + geom_point( aes(color=as.factor(CHR)), alpha=0.8, size=1.3) + + scale_color_manual(values = rep(c("grey", "#69b3a2"), 22 )) + + + # custom X axis: + scale_x_continuous( label = axisdf$CHR, breaks= axisdf$center ) + + scale_y_continuous(expand = c(0, 0) ) + # remove space between plot area and x axis + + # Add highlighted points + geom_point(data=subset(don, is_highlight=="yes"), color="orange", size=2) + + + # Custom the theme: + theme_bw() + + theme( + legend.position="none", + panel.border = element_blank(), + panel.grid.major.x = element_blank(), + panel.grid.minor.x = element_blank() + ) + + ylim(0, 10) + +ggplotly(p, tooltip="text") +``` + + diff --git a/inst/rmarkdown/templates/ISGW/template.yaml b/inst/rmarkdown/templates/ISGW/template.yaml new file mode 100644 index 0000000..6914240 --- /dev/null +++ b/inst/rmarkdown/templates/ISGW/template.yaml @@ -0,0 +1,3 @@ +name: ISGW +description: ISGW R markdown template +create_dir: FALSE diff --git a/inst/rmarkdown/templates/KCL/.DS_Store b/inst/rmarkdown/templates/KCL/.DS_Store new file mode 100644 index 0000000..7693c17 Binary files /dev/null and b/inst/rmarkdown/templates/KCL/.DS_Store differ diff --git a/inst/rmarkdown/templates/KCL/resources/.DS_Store b/inst/rmarkdown/templates/KCL/resources/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/inst/rmarkdown/templates/KCL/resources/.DS_Store differ diff --git a/inst/rmarkdown/templates/KCL/resources/kcl.png b/inst/rmarkdown/templates/KCL/resources/kcl.png new file mode 100644 index 0000000..5d6f773 Binary files /dev/null and b/inst/rmarkdown/templates/KCL/resources/kcl.png differ diff --git a/inst/rmarkdown/templates/KCL/resources/style.css b/inst/rmarkdown/templates/KCL/resources/style.css new file mode 100644 index 0000000..96f76c7 --- /dev/null +++ b/inst/rmarkdown/templates/KCL/resources/style.css @@ -0,0 +1,86 @@ +h1, .h1, h2, .h2, h3, .h3 { + margin-top: 84px; +} + +h1 { + padding-top: 100px; +} + +h1.title { + text-align: center; +} + +pre { + border: 0px solid #cccccc; + border-radius: 0px; + } + + + + + + + +/* ---------- Links ----------------- */ +a { + color: #981D32; +} +a:hover { + color: #981D32; +} + + + + +/* ---------- TOC ----------------- */ +#TOC { + top: 30%; + position: fixed; + width: 210px; +} +.tocify { + border: none; + color: grey; + border-radius: 0px; +} +.list-group-item.active { + color: #981D32; + background-color: white; + border-left: solid; + border-color: #981D32; +} +.list-group-item:hover { + color: #981D32; + background-color: white; + border-left: solid; + border-color: #981D32; +} +.tocify-extend-page { + display: none; +} + + +/* ------ This is just to fix the bug on Safari where table of content is on top of content */ +.toc-content { + margin-left: 230px +} + + + + +/* ---------- Button ----------------- */ +.btn { + border-width: 0 0px 0px 0px; + font-weight: normal; + text-transform: ; + color: #981D32; +} +.btn-default { + color: #981D32; + background-color: #ffffff; + border-color: #ffffff; +} + +.nav-pills > li.active > a, .nav-pills > li.active > a:hover, .nav-pills > li.active > a:focus { + background-color: #981D32; +} diff --git a/inst/rmarkdown/templates/KCL/resources/template_kcl.html b/inst/rmarkdown/templates/KCL/resources/template_kcl.html new file mode 100644 index 0000000..6e8511f --- /dev/null +++ b/inst/rmarkdown/templates/KCL/resources/template_kcl.html @@ -0,0 +1,548 @@ + + + + + + + + + + + +$if(github)$ + +$endif$ + + +$if(theme)$ +$else$ + +$endif$ + +$for(author-meta)$ + +$endfor$ + +$if(date-meta)$ + +$endif$ + +$if(title-prefix)$$title-prefix$ - $endif$$pagetitle$ + +$for(header-includes)$ +$header-includes$ +$endfor$ + +$if(highlightjs)$ + +$if(theme)$ + +$endif$ + +$endif$ + +$if(highlighting-css)$ + + +$if(theme)$ + +$endif$ +$endif$ + +$if(abstract)$ + +$endif$ + +$if(theme)$ + +$endif$ + +$for(css)$ + +$endfor$ + + + + + +$if(theme)$ + + +$if(kable-scroll)$ + +$endif$ + +$if(navbar)$ + + + + +$endif$ + +
+ + + + + +$if(code_menu)$ + + +$endif$ + + + +$if(toc_float)$ + + + + + + + + +
+
+
+ logo +
+
+ +
+ +$endif$ + +$endif$ + +$for(include-before)$ +$include-before$ +$endfor$ + +$if(theme)$ +
+ +$if(code_menu)$ +
+ + +
+ +$endif$ + +$endif$ + +$if(title)$ +

$title$

+$if(subtitle)$ +

$subtitle$

+$endif$ +$for(author)$ +$if(author.name)$ +

$author.name$

+$if(author.affiliation)$ +
+$author.affiliation$
$endif$ +$if(author.email)$ +$author.email$ +
+$endif$ +$else$ +

$author$ - $date$

+$endif$ +$endfor$ +$if(abstract)$ +
+

Abstract

+$abstract$ +
+$endif$ +$endif$ + +$if(theme)$ +
+$endif$ + +$if(toc_float)$ +$else$ +$if(toc)$ +
+$toc$ +
+$endif$ +$endif$ + +$body$ + +$for(include-after)$ +$include-after$ +$endfor$ + + +  +



+
+

A work by $author$

+

$mail$

+ + + + + +

+ $if(twitter)$ + + $endif$ + $if(linkedin)$ + + $endif$ + $if(github)$ + + $endif$ + $if(home)$ + + $endif$ +

+ +  + + +$if(theme)$ + +$if(toc_float)$ +
+
+$endif$ + +
+ + + + + + +$endif$ + +$if(mathjax-url)$ + + +$endif$ + + + diff --git a/inst/rmarkdown/templates/KCL/skeleton/.DS_Store b/inst/rmarkdown/templates/KCL/skeleton/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/inst/rmarkdown/templates/KCL/skeleton/.DS_Store differ diff --git a/inst/rmarkdown/templates/KCL/skeleton/skeleton.Rmd b/inst/rmarkdown/templates/KCL/skeleton/skeleton.Rmd new file mode 100644 index 0000000..8ff62a1 --- /dev/null +++ b/inst/rmarkdown/templates/KCL/skeleton/skeleton.Rmd @@ -0,0 +1,128 @@ +--- +title: "ARAMIS R Markdown template" +author: "[Yan Holtz](https://github.com/holtzy)" +date: "`r format(Sys.time(), '%d %B %Y')`" +mail: "yan.holtz.data@gmail.com" +linkedin: "yan-holtz-2477534a" +twitter: "r_graph_gallery" +github: "holtzy" +home: "www.yan-holtz.com" +output: + epuRate::KCL: + toc: TRUE + number_sections: FALSE + code_folding: "hide" +--- + +```{r, echo=FALSE, message=FALSE, warning=FALSE} +# You need these libraries to run this template: +library(rmarkdown) # install.packages("rmarkdown") +library(epuRate) # devtools::install_github("holtzy/epuRate", force=TRUE) + +``` + +



+ +>Welcome in the [ARAMIS R Markdown template](https://github.com/holtzy/epuRate). This document describes how the template looks like, building an interactive Manhattan plot. + + + + + + +# Loading data +*** +Let's load a GWAS summary statistic stored in the [qqman library](https://github.com/stephenturner/qqman). This library is: + +- Made by Stephen Turner +- Good to plot a quick Manhattan plot + +```{r, message=FALSE} +library(qqman) +``` + + + + + + +# Show data in a table +*** +It's often handy to keep a trace of the raw data somewhere in your document. The DT library allows to build interactive tables that you can search, filter, highlight and more. +```{r} +library(DT) +datatable(gwasResults, rownames = FALSE, filter="top", options = list(pageLength = 5, scrollX=T) ) +``` + + + + + +# Manhattan plot +*** +Using `HTML` outputs you can embed some interactive graphics. For example, the plotly library can transform any of your ggplot2 graphic in an interactive chart: +```{r, message=FALSE, warning=FALSE, echo=FALSE} +# Libraries +library(plotly) +library(tidyverse) + +# Prepare the dataset +don <- gwasResults %>% + + # Compute chromosome size + group_by(CHR) %>% + summarise(chr_len=max(BP)) %>% + + # Calculate cumulative position of each chromosome + mutate(tot=cumsum(chr_len)-chr_len) %>% + select(-chr_len) %>% + + # Add this info to the initial dataset + left_join(gwasResults, ., by=c("CHR"="CHR")) %>% + + # Add a cumulative position of each SNP + arrange(CHR, BP) %>% + mutate( BPcum=BP+tot) %>% + + # Add highlight and annotation information + mutate( is_highlight=ifelse(SNP %in% snpsOfInterest, "yes", "no")) %>% + + # Filter SNP to make the plot lighter + filter(-log10(P)>0.5) + +# Prepare X axis +axisdf <- don %>% group_by(CHR) %>% summarize(center=( max(BPcum) + min(BPcum) ) / 2 ) + +# Prepare text description for each SNP: +don$text <- paste("SNP: ", don$SNP, "\nPosition: ", don$BP, "\nChromosome: ", don$CHR, "\nLOD score:", -log10(don$P) %>% round(2), "\nWhat else do you wanna know", sep="") +``` + +```{r, message=FALSE, warning=FALSE, fig.width=9} +# Make the plot +p <- ggplot(don, aes(x=BPcum, y=-log10(P), text=text)) + + + # Show all points + geom_point( aes(color=as.factor(CHR)), alpha=0.8, size=1.3) + + scale_color_manual(values = rep(c("grey", "#69b3a2"), 22 )) + + + # custom X axis: + scale_x_continuous( label = axisdf$CHR, breaks= axisdf$center ) + + scale_y_continuous(expand = c(0, 0) ) + # remove space between plot area and x axis + + # Add highlighted points + geom_point(data=subset(don, is_highlight=="yes"), color="orange", size=2) + + + # Custom the theme: + theme_bw() + + theme( + legend.position="none", + panel.border = element_blank(), + panel.grid.major.x = element_blank(), + panel.grid.minor.x = element_blank() + ) + + ylim(0, 10) + +ggplotly(p, tooltip="text") +``` + + diff --git a/inst/rmarkdown/templates/KCL/template.yaml b/inst/rmarkdown/templates/KCL/template.yaml new file mode 100644 index 0000000..a35f684 --- /dev/null +++ b/inst/rmarkdown/templates/KCL/template.yaml @@ -0,0 +1,3 @@ +name: KCL +description: KCL R markdown template +create_dir: FALSE diff --git a/inst/rmarkdown/templates/PCTG/.DS_Store b/inst/rmarkdown/templates/PCTG/.DS_Store new file mode 100644 index 0000000..29ab6da Binary files /dev/null and b/inst/rmarkdown/templates/PCTG/.DS_Store differ diff --git a/inst/rmarkdown/templates/QIMR/.DS_Store b/inst/rmarkdown/templates/QIMR/.DS_Store new file mode 100644 index 0000000..5179850 Binary files /dev/null and b/inst/rmarkdown/templates/QIMR/.DS_Store differ diff --git a/inst/rmarkdown/templates/UQ/.DS_Store b/inst/rmarkdown/templates/UQ/.DS_Store new file mode 100644 index 0000000..ee5e12d Binary files /dev/null and b/inst/rmarkdown/templates/UQ/.DS_Store differ diff --git a/inst/rmarkdown/templates/epurate/.DS_Store b/inst/rmarkdown/templates/epurate/.DS_Store new file mode 100644 index 0000000..11953dd Binary files /dev/null and b/inst/rmarkdown/templates/epurate/.DS_Store differ diff --git a/inst/rmarkdown/templates/epurate/skeleton/.DS_Store b/inst/rmarkdown/templates/epurate/skeleton/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/inst/rmarkdown/templates/epurate/skeleton/.DS_Store differ diff --git a/kcl.html b/kcl.html new file mode 100644 index 0000000..c1189cf --- /dev/null +++ b/kcl.html @@ -0,0 +1,440 @@ + + + + + + + + + + + + + + + + + + + +ARAMIS R Markdown template + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+
+
+ logo +
+
+ +
+ + + + + + + +





+
+

Welcome in the ARAMIS R Markdown template. This document describes how the template looks like, building an interactive Manhattan plot.

+
+
+

Loading data

+
+

Let’s load a GWAS summary statistic stored in the qqman library. This library is:

+
    +
  • Made by Stephen Turner
  • +
  • Good to plot a quick Manhattan plot
  • +
+
library(qqman)
+
+
+

Show data in a table

+
+

It’s often handy to keep a trace of the raw data somewhere in your document. The DT library allows to build interactive tables that you can search, filter, highlight and more.

+
library(DT)
+datatable(gwasResults, rownames = FALSE, filter="top", options = list(pageLength = 5, scrollX=T) )
+
+ +
+
+

Manhattan plot

+
+

Using HTML outputs you can embed some interactive graphics. For example, the plotly library can transform any of your ggplot2 graphic in an interactive chart:

+
# Make the plot
+p <- ggplot(don, aes(x=BPcum, y=-log10(P), text=text)) +
+    
+    # Show all points
+    geom_point( aes(color=as.factor(CHR)), alpha=0.8, size=1.3) +
+    scale_color_manual(values = rep(c("grey", "#69b3a2"), 22 )) +
+    
+    # custom X axis:
+    scale_x_continuous( label = axisdf$CHR, breaks= axisdf$center ) +
+    scale_y_continuous(expand = c(0, 0) ) +     # remove space between plot area and x axis
+
+    # Add highlighted points
+    geom_point(data=subset(don, is_highlight=="yes"), color="orange", size=2) +
+  
+    # Custom the theme:
+    theme_bw() +
+    theme( 
+      legend.position="none",
+      panel.border = element_blank(),
+      panel.grid.major.x = element_blank(),
+      panel.grid.minor.x = element_blank()
+    ) +
+    ylim(0, 10)
+
+ggplotly(p, tooltip="text")
+
+ +
+ + + +  +



+
+

A work by Yan Holtz

+

+ + + + + +

+ + + + +

+ +  + + + +
+
+ +
+ + + + + + + + + +