# Subset example data
data(ExampleDb, package="alakazam")
db <- subset(ExampleDb, ISOTYPE %in% c("IgA", "IgG") & SAMPLE == "-1h")
# Calculate BASELINe
baseline <- calcBaseline(db,
sequenceColumn="SEQUENCE_IMGT",
germlineColumn="GERMLINE_IMGT_D_MASK",
testStatistic="focused",
regionDefinition=IMGT_V_NO_CDR3,
targetingModel=HS5FModel,
nproc=1)
# Grouping the PDFs by the sample and isotype annotations
grouped <- groupBaseline(baseline, groupBy=c("SAMPLE", "ISOTYPE"))
# Plot density faceted by region with custom isotype colors
isotype_colors <- c("IgM"="darkorchid", "IgD"="firebrick",
"IgG"="seagreen", "IgA"="steelblue")
plotBaselineDensity(grouped, "SAMPLE", "ISOTYPE", colorValues=isotype_colors,
colorElement="group", sigmaLimits=c(-1, 1))
# Facet by isotype instead of region
plotBaselineDensity(grouped, "SAMPLE", "ISOTYPE", facetBy="group",
sigmaLimits=c(-1, 1))
Run the code above in your browser using DataLab