file.path <- system.file("extdata", "TCRB_sequencing", package = "LymphoSeq")
file.list <- readImmunoSeq(path = file.path)
productive.nt <- productiveSeq(file.list = file.list, aggregate = "nucleotide")
geneFreq(productive.nt, locus = "VDJ", family = FALSE)
# Create a heat map of V gene usage
vfamilies <- geneFreq(productive.nt, locus = "V", family = TRUE)
require(reshape)
vfamilies <- reshape::cast(vfamilies, familyName ~ samples, value = "frequencyGene", sum)
rownames(vfamilies) <- as.character(vfamilies$familyName)
vfamilies$familyName <- NULL
RedBlue <- grDevices::colorRampPalette(rev(RColorBrewer::brewer.pal(11, "RdBu")))(256)
require(pheatmap)
pheatmap::pheatmap(vfamilies, color = RedBlue, scale = "row")
# Create a word cloud of V gene usage
vgenes <- geneFreq(productive.nt, locus = "V", family = FALSE)
require(wordcloud)
wordcloud::wordcloud(words = vgenes[vgenes$samples == "TCRB_Day83_Unsorted", "geneName"],
freq = vgenes[vgenes$samples == "TCRB_Day83_Unsorted", "frequencyGene"],
colors = RedBlue)
# Create a cumulative frequency bar plot of V gene usage
vgenes <- geneFreq(productive.nt, locus = "V", family = FALSE)
require(ggplot2)
ggplot2::ggplot(vgenes, aes(x = samples, y = frequencyGene, fill = geneName)) +
geom_bar(stat = "identity") +
theme_minimal() +
scale_y_continuous(expand = c(0, 0)) +
guides(fill = guide_legend(ncol = 3)) +
labs(y = "Frequency (%)", x = "", fill = "") +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust = 1))
Run the code above in your browser using DataLab