plotCSRsummary: Function to plot class-switch recombination summaries of...

View source: R/CSR.R

plotCSRsummaryR Documentation

Function to plot class-switch recombination summaries of repertoires

Description

The function plot the CSR summary from summariseCSR. Remember to set factors for columns represented in the plots to alter the order of these labels on axes of the plot (see vignette & example below).

Usage

plotCSRsummary(csr_summary)

Arguments

csr_summary

data.frame, output of summariseCSR.

Value

A ggplot2 plot object. You can further manipulate it, e.g. plot data from different subsets in separate panels (with facet_wrap() in ggplot2) etc.

Examples

## Not run: 
# first set the order of the isotypes so that they reflect
# the actual physical order on the genome (hence the 
# order possible in CSR)
csr_summary$startIsotype <- factor(csr_summary$startIsotype,
                                   levels = c("IgM", "IgG3", "IgG1", "IgA1",
                                              "IgG2", "IgG4", "IgE", "IgA2"),
                                   labels = c("M", "G3", "G1", "A1", "G2",
                                              "G4", "E", "A2"))
csr_summary$endIsotype <- factor(csr_summary$endIsotype,
                                 levels = c("IgM", "IgG3", "IgG1", "IgA1",
                                            "IgG2", "IgG4", "IgE", "IgA2"),
                                 labels = c("M", "G3", "G1", "A1", "G2",
                                            "G4", "E", "A2"))

# plot it; it uses ggplot2 so you can extend this with ggplot2 functions
# here separate into different panels using the column 'PatientID'
library(ggplot2)
plotCSRsummary( csr_summary ) + facet_wrap(~ PatientID)


## End(Not run)


Fraternalilab/BrepPhylo documentation built on Jan. 3, 2025, 10:03 a.m.