Description Usage Arguments Details Value Author(s) References See Also Examples
Function to convert similarity matrix to object of S3 class "dist"
.
1 | sim2dist(x, maxSim = 1)
|
x |
symmetric matrix: similarity matrix. |
maxSim |
maximum similarity possible. |
Similarity is converted to distance by maxSim - x
.
The resulting matrix is converted to an object of S3 class "dist"
by as.dist
Object of S3 class "dist"
is returned; see dist
.
Fabienne Flessa Fabienne.Flessa@uni-bayreuth.de,
Alexandra Kehl Alexandra.Kehl@uni-tuebingen.de,
Matthias Kohl Matthias.Kohl@stamats.de
Flessa, F., Kehl, A., Kohl, M. Analysing diversity and community structures using PCR-RFLP: a new software application. Molecular Ecology Resources 2013 Jul; 13(4):726-33.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | data(BLASTdata)
## without sequence range
## Not run:
res <- simMatrix(BLASTdata)
## End(Not run)
## with sequence range
range(BLASTdata$alignment.length)
res1 <- simMatrix(BLASTdata, sequence.range = TRUE, Min = 100, Max = 450)
res2 <- simMatrix(BLASTdata, sequence.range = TRUE, Min = 500)
## visualize similarity matrix
library(MKomics)
simPlot(res2, minVal = 0,
labels = colnames(res2), title = "(Dis-)Similarity Plot")
## or
library(lattice)
myCol <- colorRampPalette(brewer.pal(8, "RdYlGn"))(128)
levelplot(res2, col.regions = myCol,
at = do.breaks(c(0, max(res2)), 128),
xlab = "", ylab = "",
## Rotate label of x axis
scales = list(x = list(rot = 90)),
main = "(Dis-)Similarity Plot")
## convert to distance
res.d <- sim2dist(res2)
## hierarchical clustering
plot(hclust(res.d))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.