orderSimilarityMatrix {MetCirc} | R Documentation

## Order columns and rows of a similarity matrix according to m/z, retention time and clustering

### Description

Internal function for shiny application. May also be used outside of shiny to reconstruct figures.

### Usage

    orderSimilarityMatrix(similarityMatrix, spectra,
        type=c("retentionTime", "mz", "clustering"), group=FALSE)

### Arguments

`similarityMatrix` | `matrix`, `similarityMatrix` contains pair-wise similarity coefficients which give information about the similarity between precursors
`spectra` | `Spectra` object containing spectra that are compared in `similarityMatrix`
`type` | `character`, one of "retentionTime", "mz" or "clustering"
`group` | `logical`, if TRUE group separated by "_" will be cleaved from rownames/colnames of similarityMatrix and matched against names of spectra, if FALSE rownames/colnames of similarityMatrix are taken as are and matched against names of spectra

### Details

`orderSimilarityMatrix` takes a similarity matrix, spectra (containing information on m/z and retentionTime and a `character` vector as arguments. It will then reorder rows and columns of the similarityMatrix object such, that it orders rows and columns of similarityMatrix according to m/z, retention time or clustering in each group. `orderSimilarityMatrix` is employed in the shinyCircos function to create `similarityMatrix` objects which will allow to switch between different types of ordering in between groups (sectors) in the circos plot. It may be used as well externally, to reproduce plots outside of the reactive environment (see vignette for a workflow).

### Value

'matrix', 'orderSimilarityMatrix' returns a similarity matrix with ordered rownames according to the `character` vector given to order

### Author(s)

Thomas Naake, thomasnaake@googlemail.com

### Examples

    data("spectra", package="MetCirc")
    similarityMat <- compare_Spectra(spectra_tissue[1:10],
        fun=normalizeddotproduct, binSize=0.01)
    ## order according to retention time
    orderSimilarityMatrix(similarityMatrix=similarityMat,
        spectra_tissue, type="retentionTime", group=FALSE)

[Package MetCirc version 1.18.0 Index]