replayPlotAdd: Plot plotCircos or highlight

View source: R/shinyApp.R

replayPlotAddR Documentation

Plot plotCircos or highlight

Description

replayPlotAdd plots additional plots on a plot, either plots plotCircos or highlight.

Usage

replayPlotAdd(
  orderMatch = "mz",
  onCircle = FALSE,
  linkDf,
  mz_match,
  rt_match,
  clust_match,
  ind,
  indMz,
  indRT,
  indCluster
)

Arguments

orderMatch

character(1), either "mz", "retentionTime", or "clustering"

onCircle

logical, are coordinates on circle. If FALSE and no features are selected (length(ind) == 0), then filled plots are replayed, otherwise highlighted plots are replayed.

linkDf

data.frame that contains information of linked features for given thresholds

mz_match

character, ordered vector according to m/z

rt_match

character, ordered vector according to retention time

clust_match

character, ordered vector according to clustering

ind

numeric, indices of clicked features

indMz

numeric, indices of clicked features for "mz" ordering

indRT

numeric, indices of clicked features for "retentionTime" ordering

indCluster

numeric, indices of clicked features for "clustering" ordering

Details

Helper function for shinyCircos.

Value

Depending on onCircle and indMz either returns plotCircos or highlight

Author(s)

Thomas Naake, thomasnaake@googlemail.com

Examples

data("spectra", package = "MetCirc")
similarityMat <- Spectra::compareSpectra(sps_tissue[1:10],
    FUN = MsCoreUtils::ndotproduct, ppm = 10, m = 0.5, n = 2)
rownames(similarityMat) <- colnames(similarityMat) <- sps_tissue$name[1:10]
  
## order according to m/z 
mz_match <- MetCirc:::typeMatch_link0(similarityMatrix = similarityMat, 
    sps = sps_tissue, type = "mz", 
    condition = c("SPL", "LIM", "ANT", "STY"))
linkDf <- mz_match[["link0df"]]
mz_match <- mz_match[["type_match"]]

## order according to retention time 
rt_match <- MetCirc:::typeMatch_link0(similarityMatrix = similarityMat, 
    sps = sps_tissue, type = "retentionTime", 
    condition = c("SPL", "LIM", "ANT", "STY"))
rt_match <- rt_match[["type_match"]]

## order according to clustering
clust_match <- MetCirc:::typeMatch_link0(similarityMatrix = similarityMat, 
    sps = sps_tissue, type = "clustering", 
    condition = c("SPL", "LIM", "ANT", "STY"))
clust_match <- clust_match[["type_match"]]
circos.initialize(mz_match,##, levels  =  mz_match),
    xlim = matrix(rep(c(0,1), length(mz_match)), ncol = 2, byrow = TRUE))
#circos.trackPlotRegion(factor(mz_match, levels = mz_match), ylim = c(0,1))  
MetCirc:::replayPlotAdd(orderMatch = "mz", onCircle = FALSE, linkDf = linkDf, 
    mz_match = mz_match, rt_match = rt_match, clust_match = clust_match, 
    ind = 1, indMz = NULL, indRT = NULL, indCluster = NULL)


tnaake/MetCirc documentation built on Nov. 3, 2024, 11:16 a.m.