View source: R/align_plot_dna.R
align_plot_dna | R Documentation |
This function takes in an alignment of DNA sequences in a matrix format and returns a plot of that alignment.
align_plot_dna(
alignMat,
nuc_colours = NULL,
other_colours = NULL,
gap_colour = NA,
border_colour = NA,
pos_vec = NULL,
show_bases = TRUE,
base_size = 3,
show_legend = FALSE
)
alignMat |
Matrix: the DNA alignments. Rows are the taxa, columns are the base positions, and cells contain the values. Values should be one of 'A', 'T', 'G', 'C', '?', 'N', '-'. |
nuc_colours |
Character: named vector of colour values for nucleotides.
For example, |
other_colours |
Character: named vector colour values for '?' or 'N'
values. For example, |
gap_colour |
Chracter: named vector colour for gaps. For examples,
|
border_colour |
Character: single value, the colour of borders around base positions. Default is NA, no assigned border colour. |
pos_vec |
Integer: a vector of base positions to plot, subsets alignment. Default is NULL, which will plot all bases. |
show_bases |
Logical: whether the values of bases should be plotted. Default is TRUE. |
base_size |
Numeric: the text size used for nucleotide bases. Default is 3. |
show_legend |
Logical: whether a legend should be plotted. Default is FALSE. |
library(genomalicious)
# Create a link to raw external datasets in genomalicious
genomaliciousExtData <- paste0(find.package('genomalicious'), '/extdata')
# Path to the demo FASTA file
fasta <- paste0(genomaliciousExtData, '/data_COI_dna.fasta')
# Multi sequence alignmnet of demo COI data.
aln <- align_many_genes_dna(fasta, gene.names='COI')
# Plot base positions from 598 to 627
align_plot_dna(as.matrix(aln$COI$align), pos_vec=598:627)
# Custom colours, no text, and borders
align_plot_dna(
as.matrix(aln$COI$align),
nuc_colours=c(`A`='#ce0073',`T`='#e46adf',`G`='#59A3FF',`C`='#08c7e0'),
border_colour='grey20',
pos_vec=598:627,
show_bases=FALSE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.