An open API service indexing awesome lists of open source software.

https://github.com/atgenomix/atgwas

gwasViewer: R Shiny app for interactive GWAS result exploration powered by Spark
https://github.com/atgenomix/atgwas

gwas manhattan-plot r shiny spark

Last synced: 3 months ago
JSON representation

gwasViewer: R Shiny app for interactive GWAS result exploration powered by Spark

Awesome Lists containing this project

README

          

# gwasViewer: Spark-Powered Shiny App for GWAS Visualization

gwasViewer is an interactive R Shiny application designed for **Genome-Wide Association Study (GWAS)** result exploration. It connects directly to a **Spark-based catalog**, enabling scalable analysis of large GWAS summary statistics.

## ๐Ÿš€ Features

- ๐Ÿ“Š **Interactive Manhattan Plot** using Plotly
- ๐Ÿ“ˆ **QQ Plot** for visualizing p-value distributions
- ๐Ÿงฌ **GWAS Table Viewer** with download support
- ๐Ÿ” **Dynamic database selector** based on Spark catalog
- โšก **High-performance Spark backend** with `sparklyr`
- ๐ŸŽจ Customizable genome-wide significance threshold

## ๐Ÿ“ฆ Required R Packages

The app imports the following packages:

```r
shiny, qqman, DT, sparklyr, DBI, shinycssloaders, plotly, scales, dplyr
````

Install them via:

```r
install.packages(c("shiny", "qqman", "DT", "DBI", "shinycssloaders", "plotly", "scales", "dplyr"))
# For sparklyr
install.packages("sparklyr")
```

## ๐Ÿ”ง Usage

```r
# Install from GitHub
remotes::install_github("atgenomix/atgwas")
# Launch the viewer
atgwas::gwasViewer()
```

### ๐Ÿ–ฅ๏ธ UI Overview

* **Sidebar**

* `Genome-wide threshold`: Customize p-value significance cutoff
* `Database Selector`: Choose Spark SQL database to analyze

* **Tabs**

* `Table`: Displays the GWAS result table with CSV export
* `QQ Plot`: Observed vs expected p-values (supports PNG export)
* `Manhattan`: Interactive Manhattan plot with zoom, tooltips

## ๐Ÿ“‚ Data Requirements

The selected Spark database table must contain at least:

* `CHR`: Chromosome identifier
* `BP`: Base-pair position
* `P`: p-value
* (Optional) `SNP`: Variant ID

## ๐Ÿ“ˆ Visualization Details

### Manhattan Plot

Significant variants (e.g., `P < 5e-8`) are highlighted interactively. The app preprocesses and subsets data to optimize rendering for large datasets.

### QQ Plot

Displays p-value inflation/deflation to detect population stratification or biases.

## ๐Ÿงช Developer Modules

* `dbBrowserUI()` / `dbBrowserServer()` โ€” Spark database selection
* `sparkConnectionUI()` / `sparkConnectionServer()` โ€” Custom Spark connection
* `plot_manhattan()` โ€” Static ggplot2-based Manhattan plot
* `prep_manhattan()` โ€” Data preprocessing for Manhattan plot

## ๐Ÿ“ค Export Options

* **CSV Download** โ€” Filtered GWAS result table
* **PNG Download** โ€” QQ Plot

## ๐Ÿ‘จโ€๐Ÿ”ฌ Example Workflow

1. Start the app and connect to your Spark master
2. Select a database from the sidebar
3. View and download the GWAS summary table
4. Switch to the QQ plot tab and export as PNG
5. Explore the Manhattan plot interactively

---

## ๐Ÿ“„ License

This project is licensed under the **Apache License 2.0**.

See the [LICENSE](./LICENSE) file for details.
## ๐Ÿค Acknowledgements

* [`sparklyr`](https://spark.rstudio.com/)
* [`plotly`](https://plotly.com/r/)
* [`DT`](https://rstudio.github.io/DT/)
* [`shiny`](https://shiny.rstudio.com/)