Description Usage Arguments Value Note Author(s) References See Also Examples
View source: R/fitness_landscape_utils.R
Show a plot of a fitness landscape. The plot is modeled after (actually, mostly a blatant copy of) that of MAGELLAN, http://wwwabi.snv.jussieu.fr/public/Magellan/.
Note: this is not a plot of the fitnessEffects object; for that, see
plot.fitnessEffects
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | plotFitnessLandscape(x, show_labels = TRUE,
col = c("green4", "red", "yellow"),
lty = c(1, 2, 3),
use_ggrepel = FALSE,
log = FALSE, max_num_genotypes = 2000,
only_accessible = FALSE,
accessible_th = 0,
...)
## S3 method for class 'genotype_fitness_matrix'
plot(x, show_labels = TRUE,
col = c("green4", "red", "yellow"),
lty = c(1, 2, 3),
use_ggrepel = FALSE,
log = FALSE, max_num_genotypes = 2000,
only_accessible = FALSE,
accessible_th = 0,
...)
## S3 method for class 'evalAllGenotypes'
plot(x, show_labels = TRUE,
col = c("green4", "red", "yellow"),
lty = c(1, 2, 3),
use_ggrepel = FALSE,
log = FALSE, max_num_genotypes = 2000,
only_accessible = FALSE,
accessible_th = 0,
...)
## S3 method for class 'evalAllGenotypesMut'
plot(x, show_labels = TRUE,
col = c("green4", "red", "yellow"),
lty = c(1, 2, 3),
use_ggrepel = FALSE,
log = FALSE, max_num_genotypes = 2000,
only_accessible = FALSE,
accessible_th = 0,
...)
|
x |
One of the following:
The first two are the same as the format for the |
show_labels |
If TRUE, show the genotype labels. |
col |
A three-element vector that gives the colors to use for increase, decreases and no changes in fitness, respectively. The first two colours are also used for peaks and sinks. |
lty |
A three-element vector that gives the line types to use for increase, decreases and no changes in fitness, respectively. |
use_ggrepel |
If TRUE, use the ggrepel package to avoid overlap of labels. |
log |
Log-scale the y axis. |
max_num_genotypes |
Maximum allowed number of genotypes. For some
types of input, we make a call to |
only_accessible |
If TRUE, show only accessible paths. A path is
considered accesible if, at each mutational step (i.e., with the
addition of each mutation) fitness increases by at least
|
accessible_th |
The threshold for the minimal change in fitness at
each mutation step (i.e., between successive genotypes) to be used if
|
... |
Other arguments passed to |
A fitness landscape plot: a plot showing paths between genotypes and peaks and sinks (local maxima and minima).
I have copied most of the ideas (and colors, and labels) of this plot from MAGELLAN (http://wwwabi.snv.jussieu.fr/public/Magellan/) but MAGELLAN has other functionality that is not provided here such as epistasis stats for the landscape, and several visual manipulation options.
One feature of this function that is not available in MAGELLAN is showing genotype labels (i.e., annotated by gene names), which can be helpful if the different genotypes mean something to you.
In addition to the above differences, another difference between this plot and those of MAGELLAN is how sinks/peaks of more than one genotype are dealt with. This plot will show as sinks or peaks sets of one or more genotypes that are of identical fitness (and separated by a Haming distance of one). So a sink or a peak might actually be made of more than one genotype. In MAGELLAN, as far as I can tell, peaks and sinks are always made of a single isolated genotype.
Does this matter? In most realistic cases where not two genotypes can have exactly the same fittnes it does not. In some cases, though, it might matter. Are multi-genotype sinks/peaks really sinks/peaks? Arguably yes: suppose genotypes "AB" and "ABC" both have fitness 0, which is minimal among the fitness in the set of genotypes, and genotypes "A" and "ABCD" have fitness 0.1. To go from "A" to "ABCD", if you want to travel through "AB", you have to go through the valley of "AB" and "ABC"; once in "ABC" you can climb up to "ABCD"; and once in "AB" you can move to "ABC" since it has identical fitness to "AB". Mutatis mutandis for multi-genotype peaks. Ignoring the possibility of peaks/sinks made of more than one genotype actually makes code much simpler.
Sometimes not showing the any links that involve a decrease in fitness
can help see non-accessible pathways (in strong selection, no multiple
mutations, etc); do this by passing, for instance, an NA for the
second element of col
.
Finally, use common sense: for instance, if you pass a
allFitnessEffects
that specifies for, say, the fitness
of a total of 5000 genotypes you'll have to wait a while for the plot
to finish.
Ramon Diaz-Uriarte
MAGELLAN web site: http://wwwabi.snv.jussieu.fr/public/Magellan/
Brouillet, S. et al. (2015). MAGELLAN: a tool to explore small fitness landscapes. bioRxiv, 31583. http://doi.org/10.1101/031583
allFitnessEffects
,
evalAllGenotypes
,
allFitnessEffects
,
rfitness
,
plot.fitnessEffects
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## Generate random fitness for four genes-genotypes
## and plot landscape.
r1 <- rfitness(4)
plot(r1)
## Specify fitness in a matrix, and plot it
m5 <- cbind(A = c(0, 1, 0, 1), B = c(0, 0, 1, 1), F = c(1, 2, 3, 5.5))
plotFitnessLandscape(m5)
## Specify fitness with allFitnessEffects, and plot it
fe <- allFitnessEffects(epistasis = c("a : b" = 0.3,
"b : c" = 0.5),
noIntGenes = c("e" = 0.1))
plot(evalAllGenotypes(fe, order = FALSE))
## same as
plotFitnessLandscape(evalAllGenotypes(fe, order = FALSE))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.