Learn R Programming

tcR (version 1.3)

spectratyping: Spectratype plot.

Description

General function for making a spectratyping plots.

Usage

spectratyping(.data, .column = "VD.insertions", .by.alphabet = "Vb",
  .do.legend = T, .draw.only.legend = F, .legend.ncol = -1, .nrow = 2,
  .by.col = "", .sum.col = "Percentage", .other = F, .log = F,
  .verbose = T)

Arguments

.data
mitcr List with data frames.
.column
Character vector with name of the column with numeric characteristic.
.by.alphabet
Either 'Va/b', 'Ja/b' or an alphabet.
.do.legend
If T than plot a legend.
.draw.only.legend
If T than plot only a legend without plots.
.legend.ncol
Number of columns in the legend. If -1 than function will try to predict number of columns.
.nrow
Rows of grid of plots.
.by.col
Character vector with name of the column by which divide the given data frames.
.sum.col
Which column use for sum.
.other
If T than include in the result plot values which isn't in the given alphabet.
.log
If T than scale y-axis by log10.
.verbose
If T than print messages about state of the process.

Value

  • ggplot object.

Details

For each element in .data do: for each factor in .by.col which is in .by.alphabet, compute histogram of .column and then plot stacked histogram of distributions of .by.col for each factor.

Examples

Run this code
# Spectratyping of distribution of length of CDR3 nucleotide sequences
# by V-beta-segments.
immdata <- lapply(immdata, function (x) {
             x$Length <- nchar(x$CDR3.nucleotide.sequence)
             x
           } )
spectratyping(immdata, 'Length', 'Vb')
# Spectratyping of distribution of Total insertions
# by J-beta-segments.
spectratyping(immdata, 'Total.insertions', 'Jb')

Run the code above in your browser using DataLab