mmnetwork: Network plot of mate-pair or paired-end connected scaffold...

Description Usage Arguments Value Using the locator with mmnetwork Author(s) Examples

View source: R/mmnetwork.R

Description

Plots all connected scaffolds in a network plot. Scaffolds can then be highlighted and extracted using the locator and selection features.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
mmnetwork(
  mm,
  network,
  min_connections = 1,
  color_by = NULL,
  color_scale_log10 = FALSE,
  locator = FALSE,
  selection = NULL,
  highlight_labels = NULL,
  highlight_color = "darkred",
  links_scale = 1,
  scaffold_labels = FALSE,
  print_nolinks = FALSE,
  seed = 0
)

Arguments

mm

(required) A dataframe loaded with mmload.

network

(required) Paired-end or mate-pair connections between scaffolds in long format. The first and second columns must contain all connected scaffold pairs and the third column the number of connections.

min_connections

Filter all scaffold pairs with equal to or less than this number of connections. (Default: 2)

color_by

Color the scaffolds by a variable in mm. (Default: NULL)

color_scale_log10

(Logical) Log10-scale the color gradient when color_by is set and the variable is continuous (Default: FALSE)

locator

(Logical) When TRUE, left-clicks in the plot are captured and the exact x/y-coordinates of the mouse clicks are captured and returned. These coordinates can be used to highlight a selection of scaffolds in the plot, and to extract all scaffolds within the selection. (Default: FALSE)

selection

A 2-column dataframe with the x and y coordinates of points with which to draw a polygon onto the plot to highlight a selected region. A selection can be obtained by using the locator feature (by locator = TRUE). (Default: NULL)

highlight_labels

A dataframe or vector of scaffold names whose labels to highlight in the plot (colored by highlight_color). (Default: NULL)

highlight_color

The color with which to highlight the scaffold labels defined by highlight_labels. (Default: "darkred")

links_scale

A factor to scale the sizes of the links plotted between scaffolds. (Default: 1)

scaffold_labels

Add labels with the scaffold names of all scaffolds.

print_nolinks

(Logical) Print the names of all scaffolds with no links to other scaffolds to the console. (Default: FALSE)

seed

Network plots are based on Random Number Generation, and this is used to set a specific random seed (with set.seed) allowing for reproducible network plots. Set to NULL to generate a unique network plot with each run of mmnetwork. (Default: 0)

Value

A ggplot object. Note that mmgenome2 hides all warnings produced by ggplot objects.

Using the locator with mmnetwork

Unlike a plot generated by mmplot, the coordinates of points in each dimension in a mmnetwork plot is not contained within the provided dataframe mm itself. As such mmnetwork does not have a corresponding extract function like mmextract is for mmplot. Instead, a subset of mm containing all scaffolds within the selection polygon is available in the returned ggplot object with plot$data_in_selection.

Author(s)

Kasper Skytte Andersen ksa@bio.aau.dk

Soren M. Karst smk@bio.aau.dk

Mads Albertsen MadsAlbertsen85@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
library(mmgenome2)
data(mmgenome2)
data(paired_ends)
mmgenome2
selection <- data.frame(
  cov_C13.11.25 = c(7.2, 16.2, 25.2, 23.3, 10.1),
  cov_C14.01.09 = c(47, 77, 52.8, 29.5, 22.1)
)
mmgenome2_extraction <- mmextract(mmgenome2, selection = selection)
mmgenome2_extraction
p <- mmnetwork(mmgenome2_extraction,
  network = paired_ends,
  min_connections = 1,
  color_by = "taxonomy"
)
p

KasperSkytte/mmgenome2 documentation built on Dec. 14, 2021, 12:11 a.m.