ggplotDistanceGraph: Plotting a Distance Network

View source: R/plot_functions.R

ggplotDistanceGraphR Documentation

Plotting a Distance Network

Description

ggplotDistanceGraph will create a graph-like visualisation (ripple plot) of the corresponding barcode sequences and their similarity based on the ggplot2 and the ggnetwork packages. The nodes represent the barcode sequences and their respective size reflects the corresponding read counts. Edges between nodes indicate a distance between two barcodes of maximal minDist. If ori_BCs is provided the node color also refelects the distance of a particular barcode to one of the initial barcodes.

Usage

ggplotDistanceGraph(
  BC_dat,
  minDist = 1,
  loga = TRUE,
  ori_BCs = NULL,
  lay = "fruchtermanreingold",
  complete = FALSE,
  col_type = "rainbow",
  m = "hamming",
  scale_nodes = 1,
  scale_edges = 1,
  legend_size = 4
)

Arguments

BC_dat

a BCdat object.

minDist

an integer value representing the maximal distance for which the graph will contain edges.

loga

a logical value, indicating the use or non-use of logarithmic read count values.

ori_BCs

a vector of character strings containing the barcode sequences (without the fixed positions of the barcode construct).

lay

a character string, identifying the prefered layout algorithm (see ggnetwork layout option, "?gplot.layout"). Default value is "fruchtermanreingold", but possible are also "circle", "eigen", "kamadakawai", "spring" and many more. Or the user provides a two-column matrix with as many rows as there are nodes in the network, in which case the matrix is used as nodes coordinates.

complete

a logical value. If TRUE, every node will have at least one edge.

col_type

a character sting, choosing one of the available color palettes ("rainbow", "heat.colors", "topo.colors", "greens", "wild" - see package "grDevices").

m

a character string, Method for distance calculation, default value is Hamming distance. Possible values are "osa", "lv", "dl", "hamming", "lcs", "qgram", "cosine", "jaccard", "jw", "soundex" (see stringdist function of the stringdist-package for more information).

scale_nodes

a numeric value, scaling the node size.

scale_edges

a numeric value, scaling the edge size.

legend_size

a numeric value, scaling the legend symbol size, if legend_size equals 0, the legend will be dismissed.

Value

a ggplot2 object

Examples


## Not run: 

data(BC_dat)
ggplotDistanceGraph(BC_dat, minDist = 1, loga = TRUE, ori_BCs = NULL, lay = "fruchtermanreingold",
complete = FALSE, col_type = "rainbow")


## End(Not run)


genBaRcode documentation built on March 31, 2023, 11:02 p.m.