Calculates and plots kmers distributions and frequencies.
VDJ_kmers(
VDJ,
sequence.column,
grouping.column,
kmer.k,
max.kmers,
specific.kmers,
plot.format,
as.proportions
)
VDJ dataframe output from the VDJ_GEX_matrix function.
Character vector. One or more sequence column names from the VDJ for kmer counting. if more than one column is provided (e.g. c("VDJ_cdr3s_aa","VJ_cdr3s_aa")) these columns will be pasted together before counting the kmers.
Character. Column name of a column to group kmer counting by. This could be "sample_id" to group each kmer by the sample.
Integer. Length k of each kmer.
Integer. Maximum number of kmers to be plotted in the output barplots.
Character vector. Specific kmers to be plotted in the output barplots.
Character. The output plot format: 'barplot' for barplots of kmer frequency per group, 'pca' for group-level PCA reduction across the kmer vectors, 'density' for kmer count density plots.
Boolean. If TRUE, will return the kmer barplot as proportions instead of absolute counts.
Returns a ggplot with the kmer analysis depedning on the plot.format parameter