show.sequence: Show DNA Sequences

View source: R/show.sequence.R

show.sequenceR Documentation

Show DNA Sequences

Description

A function displaying a set of DNA sequences in the form of a mosaic of colored tiles.

Usage

show.sequence(
  x,
  xlim,
  ylim,
  xlab = "Position",
  text = FALSE,
  col = c(A = "red", G = "yellow", C = "green", T = "blue", `-` = "grey"),
  ...
)

Arguments

x

A vector containing the DNA sequences (ATCG-; character).

xlim

The range of nucleotides to show (a length 2 numeric vector).

ylim

The range of sequences to show (a length 2 numeric vector).

xlab

An optional label for the x-axis (character).

text

Whether to show the letters associated with the DNA bases (default: FALSE; logical).

col

A named vector of color values with which to show the nucleotides.

...

Further arguments (graphical parameters) to be passed internally to function plot and text.

Value

NULL (invisibly).

Author(s)

Guillaume Guénard [aut, cre] (<https://orcid.org/0000-0003-0761-3072>), Pierre Legendre [ctb] (<https://orcid.org/0000-0002-3838-3305>)

Examples

## A set of exemplary DNA sequences:
sqn <- c(Sequence_0 = "ATCG-TTT-G--C--CA--TTA--TTAA-GTGC-GTGGTCT-TCA",
         Sequence_1 = "ATCG-TTTCG--CCCCA--TTA--TTAA-GTAA-GTAATCTTTCA",
         Sequence_2 = "TTGGCTTCC--TC--CAT-TTC--TTCA-GT-ACG-ATTCTTTTA",
         Sequence_3 = "TTCG-TACC-T-T---A-ATAA--T-AA-GTCTTGTAATCGTTCA",
         Sequence_4 = "TTCG-TACC-T-T-T-C-ATAA--T-AA-GTCTGGTGGTCGTTCA",
         Sequence_5 = "TTCG-TACG-T-T-T-C-ATAT--T-AA-GTCTGGTGGTCGTTCA",
         Sequence_6 = "TTCG-TACG-T-T-T-GATTTT--T-AA-GTCTGGT---CGTTCA",
         Sequence_7 = "TTAG-TACG-T-T-T-GATTTT--T-TT-G---GGT---CGTTTT",
         Sequence_8 = "TTAG-TACG-T-T-T-GATTTT--T-TT-G---GA----CGTTTT",
         Sequence_9 = "TTAG-TACG-TATCT-GAT--TAAT-TT-G---GA----CG--TA")

## With all the defaults:
show.sequence(sqn)

## Displays the nucleotides and the gaps:
show.sequence(sqn, text=TRUE, cex=0.75)

## Clean up:
rm(sqn)


guenardg/MPSEM documentation built on April 14, 2025, 3:53 p.m.