An nLTT plot consists out of points that denote a number of (normalized)
lineages in (normalized) time. For nLTT plots with only a few points,
stretch_nltt_matrix
inserts timepoints.
For all examples, the following R code must be run:
library(ape) library(nLTT) # nolint library(testit)
Create an easy tree:
newick <- "((A:1,B:1):1,C:2);" phylogeny <- ape::read.tree(text = newick) plot(phylogeny) ape::add.scale.bar() #nolint
From this tree, we can create an nLTT plot:
nltt_plot(phylogeny)
We can extract the timepoints of the nLTT plot using the
get_phylogeny_nltt_matrix
function.
nltt <- nLTT::get_phylogeny_nltt_matrix(phylogeny) print(nltt)
The timepoints are plotted in red over the nLTT plot:
nltt_plot(phylogeny) points(nltt, pch = 19, col = "red")
The function stretch_nltt_matrix
inserts timepoints, as shown in this table:
nltt <- nLTT::get_phylogeny_nltt_matrix(phylogeny) stretch_matrix <- nLTT::stretch_nltt_matrix( nltt, dt = 0.25, step_type = "upper" ) print(stretch_matrix)
Plotting these as blue points between the red points:
nltt_plot(phylogeny) points(nltt, pch = 19, col = "red") points(stretch_matrix, pch = 19, col = "blue")
A good result is when all blue points fall on the line.
Create an easy tree:
newick <- "((A:1,B:1):1,(C:1,D:1):1);" phylogeny <- ape::read.tree(text = newick) plot(phylogeny) ape::add.scale.bar() #nolint
From this tree, we can create an nLTT plot:
nltt_plot(phylogeny)
We can extract the timepoints of the nLTT plot using the
get_phylogeny_nltt_matrix
function.
nltt <- nLTT::get_phylogeny_nltt_matrix(phylogeny) print(nltt)
The timepoints are plotted in red over the nLTT plot:
nltt_plot(phylogeny) points(nltt, pch = 19, col = "red")
The function stretch_nltt_matrix
inserts timepoints, as shown in this table:
nltt <- nLTT::get_phylogeny_nltt_matrix(phylogeny) stretch_matrix <- nLTT::stretch_nltt_matrix( nltt, dt = 0.25, step_type = "upper" ) print(stretch_matrix)
Plotting these as blue points between the red points:
nltt_plot(phylogeny) points(nltt, pch = 19, col = "red") points(stretch_matrix, pch = 19, col = "blue")
A good result is when all blue points fall on the line.
Create a complex tree:
newick <- paste0("((((XD:1,ZD:1):1,CE:2):1,(FE:2,EE:2):1):4,((AE:1,BE:1):1,", "(WD:1,YD:1):1):5);" ) phylogeny <- ape::read.tree(text = newick) plot(phylogeny) ape::add.scale.bar() #nolint
From this tree, we can create an nLTT plot:
nltt_plot(phylogeny)
We can extract the timepoints of the nLTT plot using the
get_phylogeny_nltt_matrix
function.
nltt <- nLTT::get_phylogeny_nltt_matrix(phylogeny) print(nltt)
The timepoints are plotted in red over the nLTT plot:
nltt_plot(phylogeny) points(nltt, pch = 19, col = "red")
The function stretch_nltt_matrix
inserts blue points between these
red points:
nltt <- nLTT::get_phylogeny_nltt_matrix(phylogeny) nltt_plot(phylogeny) stretch_matrix <- nLTT::stretch_nltt_matrix( nltt, dt = 0.05, step_type = "upper" ) points(nltt, pch = 19, col = "red") points(stretch_matrix, pch = 19, col = "blue")
A good result is when all blue points fall on the line.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.