Learn R Programming

bcRep (version 1.3.6)

dist.PCoA: Principal coordinate analysis (PCoA; multidimensional scaling [MDS]) of dissimilarity/distance indices

Description

Performs and plots a principal coordinate analysis (PCoA) of dissimilarity/distance indices. Correction methods can be used. Merging of samples to groups is possible in the plot function.

Usage

dist.PCoA(dist.tab = NULL, correction = c("lingoes", "cailliez", "none"))
plotDistPCoA(pcoa.tab = NULL, groups = NULL, names = NULL, axes = NULL, plotCorrection = FALSE, title = NULL, plotLegend=FALSE, PDF = NULL)

Arguments

dist.tab
Dissimilarity/distance matrix (e.g. from sequences.distance())
correction
Correction method of PCoA: Lingoes, Cailliez or none
pcoa.tab
PCoA outout from dist.PCoA()
groups
data.frame containing sequences (1. column) and groups (2. column)
names
Names of samples/axes
axes
Which axes shall be plotted? e.g. c(1,2) for axes 1 and 2
plotCorrection
Shall corrected or uncorrected eigenvalues be plotted?
title
Title of the plot
plotLegend
Shall legend be plotted?
PDF
PDF project name (see Details)

Value

Output is an PCoA object, see pcoa.

Details

This function provides a PCoA object for dissimilarity indices/distances as input (e.g. from functions sequences.distance or geneUsage.distance()). For further details of pcoa see pcoa.

The plot function provides a figure with the principal coordinates with positive eigenvalues (in the case of no correction) or the principal coordinates with positive eigenvalues from the distance matrix corrected using the specified correction method. The principal coordinates correspond to the specified axes.

A figure called "PDF"_PCoA.pdf will be saved to the working directory.

References

Paradis E., Claude J. & Strimmer K. 2004. APE: analyses of phylogenetics and evolution in R language. Bioinformatics 20: 289-290.

See Also

dist.PCoA, plotDistPCoA, sequences.distance, geneUsage.distance, pcoa

Examples

Run this code
## Not run: 
# data(clones.ind)
# seq.dist<-sequences.distance(sequences = clones.ind$unique_CDR3_sequences_AA, 
#      method = "levenshtein", divLength=F)
# distpcoa<-dist.PCoA(dist.tab = seq.dist, correction = "none")
# 
# # 'groups' data.frame for plot function: in the case, there are no groups:
# groups.vec<-unlist(apply(data.frame(clones.ind$unique_CDR3_sequences_AA),1,
#           function(x){strsplit(x,split=", ")[[1]]}))
# groups.vec<-cbind(groups.vec, 1)
# 
# plotDistPCoA(pcoa.tab = distpcoa, groups=groups.vec, axes = c(1,2), 
#      plotCorrection = FALSE, title = NULL, plotLegend=T, PDF = "TEST")    
# ## End(Not run)

Run the code above in your browser using DataLab