diff --git a/topr.png b/topr.png new file mode 100644 index 00000000..4b0b1515 Binary files /dev/null and b/topr.png differ diff --git a/web-topr-package.Rmd b/web-topr-package.Rmd new file mode 100644 index 00000000..230285fe --- /dev/null +++ b/web-topr-package.Rmd @@ -0,0 +1,209 @@ +--- +title: "topr" +descriptionMeta: "This post describes how to use the topr package for viewing and annotating genetic association results." +descriptionTop: "A package for viewing and annotating genetic association data" +sectionText: "topr section" +sectionLink: "topr-package.html" +DataToVizText: "Data to Viz" +DataToVizLink: "data-to-viz.com/graph/web-topr-package.html" +url: "blog-post-template" +output: + html_document: + self_contained: false + mathjax: default + lib_dir: libs + template: template_rgg.html + css: style.css + toc: TRUE + toc_float: TRUE + toc_depth: 2 + df_print: "paged" +--- + + +```{r global options, include = FALSE} +knitr::opts_chunk$set( warning=FALSE, message=FALSE) +``` + + +
ggplot2 and ggrepel R graphics libraries for plotting.
+
+For more details, see the *topr* [github page](https://github.com/totajuliusd/topr) and the *topr* [publication](https://doi.org/10.1186/s12859-023-05301-4).
+
+install.packages("topr").
+
+After installing the package it can be loaded as follows:
+
+```{r}
+library(topr)
+```
+
+
+# Dataset
+***
+
+*topr* comes with three inbuilt genetic association datasets (CD_UKBB, CD_FINNGEN and UC_UKBB). These datasets were originally retrieved from the UK biobank and FinnGen, and are association results (GWAS summary statistics) on Crohn's disease (CD) and Ulcerative colitis (UC).
+
+Input datasets must include least three columns (CHROM, POS and P), where naming of the columns is flexible (i.e the chr label can be either chr or chrom and is case insensitive). For more details, see [topr input datasets](https://totajuliusd.github.io/topr/articles/input_datasets.html).
+
+
+# Basic usage
+***
+*topr's* three main plotting functions are manhattan(), regionplot() and locuszoom().
+
+
+## manhattan
+***
+Create a Manhattan plot using the CD_UKBB dataset
+
+
+```{r fig.height=3.5, fig.width=8.5}
+manhattan(CD_UKBB)
+```
+
+
+Annotate the top variants (with p-values below 5e-9) with their nearest gene:
+
+```{r fig.height=3.5, fig.width=8.5}
+manhattan(CD_UKBB,
+ annotate=5e-9)
+```
+
+Show multiple datasets on the same plot using two y-axes and specify how many datasets to show on the ‘top’ and on the ‘bottom’ with the ntop argument.
+
+```{r fig.height=5.5, fig.width=8.5}
+manhattan(list(CD_UKBB, CD_FINNGEN),
+ legend_labels = c("UKBB", "FinnGen"),
+ annotate=1e-12, ntop=1)
+```
+
+
+See [manhattan](https://totajuliusd.github.io/topr_manual/manhattan.html) for more detailed examples of how to use the manhattan plot function.
+
+R2) has to be **pre-calculated** and included in the input dataset. If the dataset does not contain pre-calculated correlation values, they can be retrieved using the LDproxy package as described [here](https://github.com/totajuliusd/topr?tab=readme-ov-file#locuszoom-example)
+
+```{r fig.height=5, fig.width=9}
+locuszoom(R2_CD_UKBB, scale=0.9)
+```
+
+A package for +viewing and annotating genetic association data
+topr is a collection of plotting functions for visualizing +and exploring genetic association results. Association results from +multiple phenotypes can be viewed simultaneously, over the entire genome +(Manhattan plot) or in the more detailed regional view.
+topr utilises the ggplot2 and
+ggrepel R graphics libraries for plotting.
For more details, see the topr github page and the +topr publication.
+
The topr package can be installed from CRAN using
+install.packages(“topr”).
After installing the package it can be loaded as follows:
+ +topr comes with three inbuilt genetic association datasets
+(CD_UKBB, CD_FINNGEN and UC_UKBB). These
+datasets were originally retrieved from the UK biobank and FinnGen, and
+are association results (GWAS summary statistics) on Crohn’s disease
+(CD) and Ulcerative colitis (UC).
Input datasets must include least three columns (CHROM,
+POS and P), where naming of the columns is flexible
+(i.e the chr label can be either chr or chrom and is case insensitive).
+For more details, see topr
+input datasets.
topr’s three main plotting functions are
+manhattan(), regionplot() and
+locuszoom().
Create a Manhattan plot using the CD_UKBB dataset

Annotate the top variants (with p-values below 5e-9) with their +nearest gene:
+ +
Show multiple datasets on the same plot using two y-axes and specify
+how many datasets to show on the ‘top’ and on the ‘bottom’ with the
+ntop argument.
manhattan(list(CD_UKBB, CD_FINNGEN),
+ legend_labels = c("UKBB", "FinnGen"),
+ annotate=1e-12, ntop=1)
See manhattan +for more detailed examples of how to use the manhattan plot +function.
+Extract snps within a specific region and show them in red on the +plot. Only annotate the snpsOfInterest.
+ +manhattan(list(CD_UKBB, snpsOfInterest), color=c("darkblue","red"),
+ legend_labels=c("CD UKBB","SNPs of interest"),
+ annotate=c(1e-100, 1e-09),
+ label_color="black",
+ nudge_y=2,
+ verbose=FALSE)
See how-to-color-specific-peaks-on-the-manhattan-plot +for more details.
+By default topr uses the human genome assembly for annotation, it can +be used with different gene annotations as long as they are provided by +the user in a specific format, see How +to use topr with other species than human.
+Displays association results for smaller genetic regions defined by +the gene name:
+ +## [1] "Zoomed to region: 1:67038907-67359979"
+
Annotate the variants with vline with reduced region size for denser +labelling of top snps.
+ +## [1] "Zoomed to region: 1:67038907-67359979"
+
View the correlation pattern between the variants within the region +in a locuszoom like plot.
+Note that the variant correlation (R2) has to be
+pre-calculated and included in the input dataset. If
+the dataset does not contain pre-calculated correlation values, they can
+be retrieved using the LDproxy package as described here
## [1] "Zoomed to region: 1:67042284-67359988"
+
Contribution from Kyle Scott kscott-1
+Create a Manhattan plot highlighting genome-wide significant and +suggestive loci using the manhattanExtra function.
+ +
+ 👋 After crafting hundreds of R charts over 12 years, I've + distilled my top 10 tips and tricks. Receive them via email! + One insight per day for the next 10 days! 🔥 +
+