Renders a sequence logo from CDR3 amino acid sequences using
ggseqlogo. Two methods are available: "bits" shows information
content per position, "prob" shows amino acid frequencies.
Arguments
- cdr3_seqs
Character vector. CDR3 amino acid sequences.
- chain
Character string.
"alpha"or"beta".- trim
Logical. If
TRUE, trim conserved C/F residues before alignment (first 3, last 2 characters). DefaultTRUE.- method
Character string.
"prob"for frequency-based logo,"bits"for information content. Default"prob".- gap_character
Character string. Gap character for alignment. Default
"-".- title
Optional plot title. If
NULL, defaults to the chain name with Greek letter.- nucseq_src
List of character vectors with nucleotide source labels (one per CDR3). Required for junction bars.
- show_junction_bars
Logical. If
TRUEandnucseq_srcis provided, stack junction bars below the logo via patchwork.- return_junction_pwm
Logical. If
TRUE, return a list with componentsplot(the ggplot logo) andjunction_pwm(the numeric matrix, orNULL). DefaultFALSE.
Value
A ggplot object (or patchwork object if junction bars
are included). When return_junction_pwm = TRUE, a list with
plot and junction_pwm.
Examples
if (FALSE) { # \dontrun{
seqs <- c("CAVRDSSYKLIF", "CAVKDSSYKLIF", "CAVRDSYKLIF",
"CAVRDSSYKLIF", "CAVKDSYKLIF")
plot_cdr3_logo(seqs, chain = "alpha", method = "bits")
plot_cdr3_logo(seqs, chain = "beta", method = "prob")
} # }