knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

adrift -- Modelling drift on admixture graphs

Licence lifecycle Project Status: Active Last-changedate packageversion Travis build status AppVeyor Build Status Coverage Status Coverage Status CRAN status CRAN downloads minimal R version

The goal of adrift is to have an improved admixturegraph package with better visualisation of graphs and graph statistics.

Installation

You can install the released version of adrift from CRAN with:

install.packages("adrift")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("mailund/adrift")

Example

library(magrittr)
library(adrift)

graph <- parse_dot(readr::read_file("data-raw/Basic_OngeEA_wArch.dot"))
graph %>% 
    make_graph_plot() %>%
    show_leaf_labels(nudge_y = -0.5) %>%
    show_inner_node_labels()
library(magrittr)
library(adrift)

graph <- parse_qpgraph(readr::read_file("data-raw/Basic_OngeEA_wArch.graph"))
graph %>% 
    make_graph_plot(edge_colour = "darkblue") %>%
    show_leaf_labels(nudge_y = -0.5, angle = 15) %>%
    show_inner_node_labels()
graph <- parse_dot(readr::read_file("data-raw/BosGraph.dot"))
graph %>% 
    make_graph_plot(edge_colour = "red") %>%
    show_leaf_labels(angle = -90, size = 2.8, nudge_y = -1, hjust = 0)
graph <- parse_qpgraph(readr::read_file("data-raw/Basic_OngeEA_wArch.graph"))
plt <- graph %>%
    make_graph_plot(
        ggplot2::aes(filter = !admixed),
        edge_colour = "darkblue"
    ) %>%
    show_leaf_labels(nudge_y = -0.5, angle = 15)

admixture_vars <- c(
    "P_P2" = "alpha",
    "K_K2" = "beta",
    "AfrAnc_AdmixedNonAfr" = "gamma",
    "SuperArch_DenisovaAncAnc" = "delta"
)
plt %>% add_admixture_labels(
    admixture_vars,
    linetype = "dotted",
    colour = "darkred"
)

plt %>% add_admixture_labels(
    attr(graph, "admixture_proportions"),
    label_size = 3,
    linetype = "dashed",
    colour = "darkgray"
)


mailund/adrift documentation built on Jan. 24, 2021, 7:20 p.m.