# \donttest{
# Subset example data to one isotype and 200 sequences
data(ExampleDb, package="alakazam")
db <- subset(ExampleDb, c_call == "IGHA")
set.seed(112)
db <- dplyr::slice_sample(db, n=50)
tuneMtx = list()
for (i in 1:length(unique(db$sample_id))) {
# Get data corresponding to current sample
curDb = db[db[["sample_id"]] == unique(db[["sample_id"]])[i], ]
# Count the number of mutations per 5-mer
subCount = createSubstitutionMatrix(db=curDb, model="s",
sequenceColumn="sequence_alignment",
germlineColumn="germline_alignment_d_mask",
vCallColumn="v_call",
multipleMutation="independent",
returnModel="5mer", numMutationsOnly=TRUE)
# Tune over minNumMutations = 5..50
subTune = minNumMutationsTune(subCount, seq(from=5, to=50, by=5))
tuneMtx = c(tuneMtx, list(subTune))
}
# Name tuneMtx after sample names
names(tuneMtx) = unique(db[["sample_id"]])
# plot with legend for both samples for a subset of minNumMutations values
plotTune(tuneMtx, thresh=c(5, 15, 25, 40), criterion="3mer",
pchs=16:17, ltys=1:2, cols=2:3,
plotLegend=TRUE, legendPos=c(25, 30))
# plot for only 1 sample for all the minNumMutations values (no legend)
plotTune(tuneMtx[[1]], thresh=seq(from=5, to=50, by=5), criterion="3mer")
# }
Run the code above in your browser using DataLab