This function assesses pairwise repertoire dissimilarities using a specific dissimilarity method.
It calculates a list of dissimilarity indices, each taking into account different parameters. The proposed methods include:
The Jaccard similarity: a measure of similarity between sample sets defined as the size of the intersection divided by the size of the union of the sample sets.
The Morisita-Horn similarity: a measure of similarity that tends to be over-sensitive to abundant species.
The function also performs a hierarchical clustering on the calculated distance scores in case the results are represented on a heatmap.
Usage
plotDissimilarity(
x,
level = c("aaClone", "ntClone", "V", "J", "VJ", "ntCDR3", "aaCDR3"),
method = c("manhattan", "euclidean", "canberra", "clark", "bray", "kulczynski",
"jaccard", "gower", "altGower", "morisita", "horn", "mountford", "raup", "binomial",
"chao", "cao", "mahalanobis"),
clustering = c("ward.D", "ward.D2", "single", "complete", "average", "mcquitty",
"median", "centroid"),
binary = FALSE,
colorBy = NULL,
plot = c("Heatmap", "MDS"),
label_colors = NULL
)
Arguments
- x
an object of class
RepSeqExperiment
- level
a character specifying the level of the repertoire on which the indices are computed. Should be one of "aaClone","ntClone", "V", "J", "VJ", "ntCDR3" or "aaCDR3".
- method
a character specifying the distance method to be computed. Should be one of the following: "manhattan", "euclidean", "canberra", "clark", "bray", "kulczynski", "jaccard", "gower", "altGower", "morisita", "horn", "mountford", "raup", "binomial", "chao", "cao", "mahalanobis."
- clustering
a character specifying the clustering method to be used in case a heatmap is plotted. If not, the parameter can be set to NULL.
- binary
a boolean indicating whether or not to transform the data into a presence/absence data. Default is FALSE
- colorBy
a vector indicating at least on column name in mData. Colors are thus attributed to the different groups within this column. The chosen column must be of class factor.
- plot
a character indicating the type of visualization in which the results will be represented, either a heatmap or a MDS.
- label_colors
a list of colors for each factor column in metaData. See
plotColors
. If NULL, default colors are used.
Details
Details on the calculated indices as well as the clustering methods can be found in the vegan package: https://www.rdocumentation.org/packages/vegan/versions/2.4-2/topics/vegdist
Examples
data(RepSeqData)
plotDissimilarity(x = RepSeqData, level = "V", method = "euclidean", colorBy="sex", plot="MDS")
#> Error in plotDissimilarity(x = RepSeqData, level = "V", method = "euclidean", colorBy = "sex", plot = "MDS"): could not find function "plotDissimilarity"
plotDissimilarity(x = RepSeqData, level = "aaCDR3", method = "jaccard",
colorBy=c("sex","cell_subset"), plot="Heatmap")
#> Error in plotDissimilarity(x = RepSeqData, level = "aaCDR3", method = "jaccard", colorBy = c("sex", "cell_subset"), plot = "Heatmap"): could not find function "plotDissimilarity"