
Visualization of repertoire dissimilarities in a multidimensional scaling (MDS) plot
Source:R/plotFunctions.R
plotDissMDS.RdThis 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 performs multidimensional scaling (MDS) on the calculated dissimilarity scores. This enables visualization of repertoire relationships in a reduced-dimensional space, highlighting similarities and differences among samples.
Usage
plotDissMDS(
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"),
binary = FALSE,
colorBy = NULL,
shapeBy = NULL,
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."
- binary
a boolean indicating whether or not to transform the data into a presence/absence data. Default is FALSE
- colorBy
a vector indicating one column name in mData. Colors are thus attributed to the different groups within this column in the MDS. The chosen column must be of class factor.
- shapeBy
a vector indicating one column name in mData. Shapes are thus attributed to the different groups within this column
- 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)
plotDissMDS(x = RepSeqData, level = "V", method = "euclidean", colorBy="sex")
#> New names:
#> • `` -> `...1`
#> • `` -> `...2`
plotDissMDS(x = RepSeqData, level = "aaCDR3", method = "jaccard",
colorBy="cell_subset", shapeBy="sex")
#> New names:
#> • `` -> `...1`
#> • `` -> `...2`