networkPlot2 {piano} | R Documentation

## Gene set network plot

### Description

Draws a network with gene sets as nodes and the thickness of the edges correlating to the number of shared genes. The gene set significance is visualized as color intensities. Gives an overview of the influence of overlap on significant gene sets. Uses package `visNetwork` for plotting.

### Usage

    networkPlot2(gsaRes, class, direction, adjusted = TRUE,
      significance = 0.001, geneSets = NULL, lay = "visNetwork",
      physics = TRUE, overlap = 0.1, label = "names", labelSize = 22,
      ncharLabel = 25, nodeSize = c(10, 40), edgeWidth = c(1, 15),
      edgeColor = NULL, scoreColors = NULL, naColor = "yellow", main,
      submain, seed = 1, maxAllowedNodes = Inf, shiny = FALSE)

### Arguments

`gsaRes` | an object of class `GSAres`, as returned from `runGSA()` or an object returned from `runGSAhyper()`.
`class` | a character string determining the p-values of which directionality class that should be used as significance information for the plot. Can be one of `"distinct"`, `"mixed"`, `"non"`. Has to be `"non"` if the result from `runGSAhyper()` is used.
`direction` | a character string giving the direction of regulation, can be either `"up"`, `"down"` or `"both"` (for `class="distinct"` only).
`adjusted` | a logical, if adjusted p-values should be used, or not. Note that if `runGSA` was run with the argument `adjMethod="none"`, the adjusted p-values will be equal to the original p-values.
`significance` | the significance cut-off that determines which gene sets are included in the plot. Defaults to 0.001.
`geneSets` | a character vector of gene set names, to be included in the plot. Defaults to `NULL`, but if given, the argument `significance` will be ignored.
`lay` | One of `"visNetwork"` (or `"1"`), `"layout_nicely"` (or `"2"`), `"layout_as_star"` (or `"3"`), `"layout_with_fr"` (or `"4"`), `"layout_with_kk"` (or `"5"`), `"layout_with_sugiyama"` (or `"6"`), `"layout_in_circle"` (or `"7"`), `"layout_on_grid"` (or `"8"`), `"layout_as_tree"`, `"layout_on_sphere"`, `"layout_randomly"`, `"layout_with_dh"`, `"layout_with_gem"`, `"layout_with_graphopt"`, `"layout_with_lgl"`, `"layout_with_mds"`
`physics` | logical, whether or not to use physics simulation.
`overlap` | a positive numerical. Determines the smallest number or fraction of sharing genes between two gene-sets that is needed in order to draw a line/edge between the gene-sets. If >= 1, the argument is interpreted as number of genes. If between 0 and 1, the argument is interprested as the fraction of genes of the smalles gene-set in a given pair. Defaults to 0.1.
`label` | a character string, either `"names"` ,`"numbers"`, `"numbersAndSizes"` or `"namesAndSizes"`, determining the labels used for the nodes. The names are the gene set names, numbers is an arbritary numbered list of the gene sets used in the plot connected to the named list returned by the funtion (see example). Sizes are the gene set sizes, e.g. the number of genes.
`labelSize` | the text size of the node labels.
`ncharLabel` | the number of characters to include in the node labels.
`nodeSize` | a numerical vector of length 2 giving the maximum and minimum node sizes. The node size represents the size of the gene set, and all values will be scaled to the given interval.
`edgeWidth` | a numerical vector of length 2 giving the maximum and minimum edge widths. The edge width represents the number of shared genes between two gene sets, and all values will be scaled to the given interval.
`edgeColor` | a character vector giving the colors to use for increasing edge width. Can also be set to a single color. Defaults to a gray-scale.
`scoreColors` | a character vector giving the colors from which the gradient used for node coloring will be created. In the case of `class="distinct"` and `direction="both"` the first half of the vector will be used for the up-regulated gene sets and the second part will be used for the down-regulated gene sets.
`naColor` | the color for gene-sets when selected p-value is NA
`main` | an optional character vector setting the title of the plot.
`submain` | an optional character vector setting the subtitle of the plot.
`seed` | random seed for reproducible layouts
`maxAllowedNodes` | if the set parameters results in a network with more than `maxAllowedNodes`, a error if given instead of drawing the network.
`shiny` | Only for internal use. Set to FALSE by default.

### Details

In the case of `class="distinct"` and `direction="both"`, the distinct directional p-values (`pDistinctDirUp` and `pDistinctDirDn`, see `runGSA`) will be used in combination.

### Value

Returns an object of class `visNetwork` that can be further manipulated, see examples.

### Author(s)

Leif Varemo piano.rpkg@gmail.com and Intawat Nookaew piano.rpkg@gmail.com

### See Also

piano, `runGSA`, `GSAheatmap`, `exploreGSAres`

### Examples

       # Load example input data to GSA:
       data("gsa_input")

       # Load gene set collection:
       gsc <- loadGSC(gsa_input$gsc)

       # Run gene set analysis:
       gsares <- runGSA(geneLevelStats=gsa_input$pvals , directions=gsa_input$directions,
                        gsc=gsc, nPerm=500)

       # Network plot:
       networkPlot2(gsares, class="non", significance=0.1)

       # Display number to gene-set name mapping:
       res <- networkPlot2(gsares, class="non", significance=0.1)
       res$x$nodes[,c("id","geneSetNames")]

       # Examples of reusing res later:

       # Draw same again:
       require(visNetwork)
       visNetwork(res$x$nodes,res$x$edges)
       # os simly just:
       res

       # Draw only essential, rest is default:
       visNetwork(res$x$nodes[,c("id","label")],res$x$edges[,c("from","to")])

       # Add custom options:
       visNetwork(res$x$nodes[,c("id","label")],res$x$edges[,c("from","to")]) %>%
       visIgraphLayout("layout_in_circle")

       # Other example:
       res %>% visNodes(shadow=FALSE)

       # See package visNetwork for more examples

[Package piano version 2.2.0 Index]