https://github.com/nylander/saturation.plot
Code for for displaying the relationship between the uncorrected (P-) distance and the distance on a phylogenetic tree
https://github.com/nylander/saturation.plot
Last synced: 2 days ago
JSON representation
Code for for displaying the relationship between the uncorrected (P-) distance and the distance on a phylogenetic tree
- Host: GitHub
- URL: https://github.com/nylander/saturation.plot
- Owner: nylander
- Created: 2024-02-20T16:53:05.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-11T10:08:28.000Z (over 1 year ago)
- Last Synced: 2025-03-05T04:38:36.782Z (over 1 year ago)
- Language: R
- Size: 402 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Saturation plots
- Last modified: ons feb 21, 2024 11:27
- Sign: JN

## Description
Code for generating saturation plots used in [Klopfstein et al.,
2013](https://doi.org/10.1371/journal.pone.0069344) for displaying the
relationship between the uncorrected (P-) distance and the distance on a
phylogenetic tree.
## Requirements
[R](https://www.r-project.org/) with R-package
[ape](https://cloud.r-project.org/web/packages/ape/index.html).
Recently tested with R v4.3.2 and ape v5.7.1.
## Input
1. Multiple sequence alignment in fasta format ([example](data/data.fas))
2. Tree with tip labels corresponding to sequence labels
([example](data/tree.phy))
## Examples
```R
library("ape")
source("src/saturation.plot.R")
tree <- read.tree("data/tree.phy")
ultrametric_tree <- read.tree("data/ultrametric.phy")
dna <- read.dna("data/data.fas", format="fasta")
third_pos <- dna[, seq(3, ncol(dna), by=3)]
firstsecond_pos <- dna[, -seq(3, ncol(dna), by=3)]
par(mfrow=c(2, 3))
saturation.plot(tree, dna, main="Default")
saturation.plot(tree, dna, main="Background, no regression line",
bg=TRUE, regr=FALSE)
saturation.plot(tree, dna, main="Change some settings",
bg=FALSE, col="red", ylim=c(0, 0.08), cex=0.5)
saturation.plot(tree, dna, main="Other colors and symbols",
bg=TRUE, col="yellow", bg.col="darkgray", reg.col="red",
pch=24, cex=1.5, lwd=2)
saturation.plot(ultrametric_tree, dna, main="Use ultrametric tree")
saturation.plot(tree, firstsecond_pos, main="Codon pos 1st+2nd vs. 3rd",
regr=FALSE, col="red", ylim=c(0, 0.15))
saturation.plot(tree, third_pos,
bg=FALSE, regr=FALSE, col="blue", ylim=c(0, 0.15), add=TRUE)
legend(x="topright", legend=c("3rd", "1st+2nd"),
col=c("blue", "red"), pch=20, bty="n")
```