highlight: Add links and highlight sectors

Description Usage Arguments Details Value Author(s) Examples

View source: R/plottingFunctions.R

Description

A function to add links and highlight sectors to an initialised and plotted 'circlize' plot with one track.

Usage

1
2
3
4
5
6
7
8
highlight(
  groupname,
  ind,
  linkDf,
  colour = NULL,
  transparency = 0.4,
  links = TRUE
)

Arguments

groupname

'character' vector containing "group" and "name" to display, that is a unique identifier of the features, "group" and "name" have to be separated by '"_"' where "group" is the first and "name" is the last element

ind

'numeric', indices which will be highlighted

linkDf

'data.frame', in each row there is information about features to be connected

colour

'NULL' or 'character', colour defines the colours which are used for plotting, if 'NULL' default colours are used

transparency

'numeric', defines the transparency of the colours

links

'logical', should links of unselected features be plotted

Details

Internal use for 'shinyCircos' or outside of 'shinyCircos' to reproduce the figure.

Value

The function will update an existing plot by highlighting a specified sector and connected links.

Author(s)

Thomas Naake, thomasnaake@googlemail.com

Examples

 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
data("spectra", package = "MetCirc")
similarityMat <- compare_Spectra(spectra_tissue[1:10],
    fun = normalizeddotproduct, binSize = 0.01)
 ## order similarityMat according to retentionTime and update rownames
 simM <- orderSimilarityMatrix(similarityMat, spectra = spectra_tissue[1:10],
             type = "retentionTime")
 ## create link matrix
 linkDf <- createLinkDf(similarityMatrix = simM, spectra = spectra_tissue,
     condition = c("SPL", "LIM", "ANT", "STY"), lower = 0.5, upper = 1)
 ## cut link matrix (here: only display links between groups)
 linkDf_cut <- cutLinkDf(linkDf, type = "inter")
 ## set circlize parameters
 circos.clear()
 circos.par(gap.degree = 0, cell.padding = c(0.0, 0, 0.0, 0),
         track.margin = c(0.0, 0))
 groupname <- c(as.character(linkDf_cut[, "spectrum1"]),
                 as.character(linkDf_cut[, "spectrum2"]))
 groupname <- unique(groupname)
 ## here: set indSelected arbitrarily
 indSelected <- c(2,3)
 ## actual plotting
 plotCircos(groupname, linkDf_cut, initialize = TRUE,
     featureNames = TRUE, cexFeatureNames = 0.2, groupSector = TRUE,
     groupName = FALSE, links = FALSE, highlight = TRUE)
 ## highlight
 highlight(groupname = groupname, ind = indSelected, linkDf = linkDf_cut,
     colour = NULL, transparency = 0.4, links = TRUE)

MetCirc documentation built on Nov. 8, 2020, 8:26 p.m.