Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/4ment/skyplotr
https://github.com/4ment/skyplotr
beast coalescent ggplot2 mcmc visualization
Last synced: about 5 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/4ment/skyplotr
- Owner: 4ment
- License: gpl-3.0
- Created: 2024-03-07T23:51:43.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-05-22T06:33:49.000Z (6 months ago)
- Last Synced: 2024-05-22T07:38:25.033Z (6 months ago)
- Topics: beast, coalescent, ggplot2, mcmc, visualization
- Language: R
- Homepage:
- Size: 714 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# skyplotr
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
### Overview
**skyplotr** is an R package providing functions for plotting the population size trajectory across time. The plots created by **skyplotr** are ggplot objects, which means that after a plot is created it can be further customized using various functions from the **ggplot2** package.
### Installation
* Install the latest development version from GitHub (requires [devtools](https://github.com/hadley/devtools) package):
```r
devtools::install_github("4ment/skyplotr")
```### Example
`HCV.tsv` contains 1000 MCMC samples obtained from BEAST. This analysis involves a nucleotide alignment of Hepatitis C Virus (HCV), utilizing the piecewise-constant coalescent model (aka skygrid). This model comprises 75 epochs with a cutoff set at 400.
```r
library(dplyr)
library(ggplot2)
library(skyplotr)samples <- read.csv("data-raw/HCV-skygrid.tsv", sep = "\t")
root_height <- samples$treeModel.rootHeight
log_pop_size <- select(samples, starts_with("skygrid.logPopSize"))
cutoff <- samples$skygrid.cutOff[1]
skygrid <- prepare_skygrid(root_height, log_pop_size, cutoff, age_of_youngest=1994)
skygrid <- mutate(skygrid, across(all_of(c("trajectory", "trajectory_low", "trajectory_high"))), exp)plot_title <- ggtitle("Population size trajectory",
"with median and 95% intervals")skyplot(skygrid, fill="darkcyan") + plot_title + ylab("Effective population size")
```![HCV-skygrid](images/HCV-skygrid.png)