knitr::opts_chunk$set(dpi=300)

MLLPT

R-CMD-check codecov CodeFactor

Maximum likelihood assignment of low-pass samples (MLLPT)


Installation

# install.packages("devtools")
devtools::install_github('dombennett/treeman') # package requires newest version of treeman (not on CRAN)
devtools::install_github("T-Heide/MLLPT")

Help and support


Getting started

library(MLLPT)
library(phangorn)
1) Input data
data("example_lp_data", package="MLLPT") # example dataset included in the package
# 1/3 a phylogenetic tree
print(example_lp_data$tree)
# 2/3 a phylo object (with id attribute)
print(example_lp_data$phydata)
head(attr(example_lp_data$phydata, "id")) # a non default attribute of mutation ids!
# 3/3 a list of sample data
str(example_lp_data$samples)
2) Add LP samples
set.seed(123)

tree_with_lp_added = 
  with(example_lp_data,  {
    MLLPT::add_lowpass_sampled(
      tree = tree, 
      phydata = phydata, 
      sample_data = samples, 
      return_details = TRUE, 
      n_bootstraps = 1000, 
      n_cores = 8
    )
  })
3) Plots
labeller_function = function(x) gsub("EPICC_C[0-9]+_", "", x)

tree_with_lp_added$tree %>% 
  MLLPT:::remove_root_tip("GL") %>%  
  MLLPT::set_lp_tiplength(0.05) %>% 
  MLLPT::plot_tree(
    labeller_function = labeller_function, 
    pointsize = 2, 
    linewidth = 0.8
  )
MLLPT::plot_lp_loglik(
    tree_with_lp_added,
    labeller_function = labeller_function
  ) + ggplot2::theme(axis.text.x = ggplot2::element_text(angle=90, vjust = 0.5))
MLLPT::plot_lp_loglik_edge(
    tree_with_lp_added,
    labeller_function = labeller_function
  ) + ggplot2::theme(strip.text = ggplot2::element_text(size=9))
MLLPT::plot_lp_position_edge(
    tree_with_lp_added,
    labeller_function = labeller_function
  ) + ggplot2::theme(strip.text = ggplot2::element_text(size=9))
MLLPT::plot_sample_data(
    tree_with_lp_added,
    external_purity_estimate = c(0.90, 0.48),
    label_external_purity = "GT",
    labeller_function = labeller_function
  )

Copyright

Copyright (C) 2020, Timon Heide (timon.heide@icr.ac.uk)

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.


Contacts

Timon Heide, Institute of Cancer Research, London, UK.



T-Heide/MLLLP documentation built on Dec. 18, 2021, 3:09 p.m.