Plot a PhyloSim object.
This method plots the aggregated alignment alongside the tree used for simulation. Various options allow for control over the plot style.
# S3 method for PhyloSim
plot(x, plot.tree, plot.ancestors, plot.chars, plot.legend, plot.labels, aspect.ratio,
num.pages, char.text.size, axis.text.size, color.scheme, color.branches, tree.xlim,
aln.xlim, tracks, aln.length.tolerance, plot.nongap.bl, ...)
A PhyloSim object.
Whether to plot the tree alongside the alignment. TRUE or FALSE; defaults to TRUE.
Whether to plot the ancestral sequences. TRUE or FALSE; defaults to TRUE.
Whether to plot the actual text of the characters.
Whether to plot the legend showing the character-to-color mapping.
Whether to plot the sequence labels along the y-axis
(Experimental; when set, this option forces the num.pages value to 1) Constrains the alignment residues to have a certain aspect ratio; values above 1 cause vertically-stretched blocks. FALSE disables aspect ratio control, numerical values set the aspect ratio; defaults to FALSE.
Optionally split the alignment over a number of vertically-stacked pages. This is useful for long alignments. 'auto' chooses a sensible number of pages, numerical values specify a number; defaults to 'auto'.
Text size for the aligned characters. This may require tweaking depending on the DPI and output format. Defaults to 'auto'.
Text size for the sequence labels along the y-axis. This may require tweaking depending on the DPI and output format. Defaults to 'auto'.
Color scheme to use ("auto", "binary", "dna", "protein", "codon", "combined", "combined_codon"). Defaults to 'auto'. When set to 'auto', the function will choose an appropriate coloring scheme based on the alignment content.
The event count used to color the branches ("substitutions" by default). See getBranchEvents.PhyloSim
.
The x-axis limits of the tree panel.
The x-axis limits of the alignment panel (in alignment column coordinates).
Tracks to display above or below the alignment as colored blocks.
The input format for tracks is a list of data frames with the following possible fields, all of which are optional and can be omitted:
pos - the sequence position (starting with 1) of the feature. Defaults to NULL.
score - the score (between 0 and 1) of the feature. Scores above 1 or below zero will be truncated. Defaults to 1.
y_lo - the lower Y offset (between 0 and 1) of the feature. Defaults to 0. Use a y_lo and y_hi value for each row in the track data frame to create a wiggle plot like effect.
y_hi - the upper Y offset (between 0 and 1) of the feature. Defaults to 1. Use just a y_hi value for each row in the track data frame to create a bar plot like effect.
[the fields below are considered unique per track; the values from the first row in the track data frame are used.]
id - the display ID for the track. Defaults to 'Track'.
layout - set to 'above' to put the track above the alignment, 'below' for below.
height - the number of alignment rows for the track to span in height. Defaults to 3.
color.gradient - a comma-separated list of colors to interpolate between when coloring the blocks. Examples: 'white,red' 'blue,gray,red' '#FF00FF,#FFFFFF'. Defaults to 'white,black'.
color - a single color to use when coloring the blocks. Mutually exclusive with color.gradient, and if a color.gradient value exists then this value will be ignored. Defaults to black.
background - a color for the background of the track. Defaults to white.
The desired alignment/sequence length ratio (A/S ratio) to trim the alignment to. The A/S ratio is defined as the ratio between the alignment length and the mean ungapped sequence length, and the alignment trimming procedure will remove blocks of indel-containing columns (in a sensible order) until either (a) the desired indel tolerance is reached, or (b) no more columns can be removed without yielding an empty alignment. A track is added below the alignment to indicate how many indels each resulting alignment column used used to harbor, and black squares are overlaid onto the alignment where extant sequence data has been trimmed. Defaults to NULL (no trimming); values in the range of 0.9 to 1.3 tend to work well at improving the legibility of very gappy alignments.
If set to TRUE, plots the non-gap branch length (defined as the branch length of the subtree of non-gapped sequences) as a track below the alignment. Defaults to FALSE.
Not used.
The PhyloSim object (invisible).
For more information see PhyloSim
.
# NOT RUN {
# Create a PhyloSim object.
# Provide the phylo object
# and the root sequence.
sim<-PhyloSim(
name="TinySim",
phylo=rcoal(3),
root.seq=NucleotideSequence(string="ATGCTAGCTAGG",processes=list(list(JC69())))
);
# plot the aggregated phylo object
plot(sim)
# run simulation
Simulate(sim)
# Plot the alignment without the tree or ancestral sequences.
plot(sim, plot.ancestors=FALSE, plot.tree=FALSE)
# Force a DNA-based color scheme
# (default is 'auto' to auto-detect based on the sequence composition)
plot(sim, color.scheme='dna', plot.legend=TRUE)
# }
Run the code above in your browser using DataLab