Package 'MSTree'

Title: MSTree plotting minimum spanning tree directly from the output of ChewBBACA pipeline
Description: This package is used to generate a graph object from the output of chewBBACA pipeline (https://chewbbaca.readthedocs.io/en/latest/). Then, the generated graph object can be used to make a minimum spanning tree (MST). The minimum spanning tree can be customized using all the available arguments. This package consists of two functions: one to build the graph and another one for plotting.
Authors: Abdullah El-Kurdi [aut, cre] (ORCID: <https://orcid.org/0000-0002-8321-4025>)
Maintainer: Abdullah El-Kurdi <[email protected]>
License: Artistic-2.0
Version: 0.99.6
Built: 2026-05-24 15:04:54 UTC
Source: https://github.com/bioc/MSTree

Help Index


MSTree R package

Description

Make a graph object from the extracted alleles

Arguments

chewbbaca_ExtractCgMLST_output

Full path of the file name or a data frame.

max_allelic_difference

numeric; This is an optional argument, can be used to connect nodes that have a distance less than or equal to the specified number, useful to show clusters of isolates. The default is set to -1 which means no clustering is applied.

verbose

logical; set to TRUE to print on screen the progress. default is FALSE.

Details

Make a graph object and generate minimum spanning tree.

This function takes alleles matrix and returns a graph object

Value

Graph object.

Examples

my_graph <- makeGraphFromChewBBACA(system.file("extdata", "cgMLST95.csv", 
  package = "MSTree"), max_allelic_difference=-1)

MSTree R package

Description

Using the igraph object generated from makeGraphFromChewBBACA function, PlotMST function will plot a minimum spanning tree.

Arguments

igraph_object

igraph object, output of the makeGraphFromChewBBACA function

metadata

data frame; This is an optional argument. If given, the function will assume the first column contains the isolates names and will add the remaining columns as metadata to the igraph object, useful for generating custom coloring of the nodes i.e. Year, Source, etc. The default is NULL

show_clustering

logical; If the user has used a value for max_allelic_difference when running makeGraphFromChewBBACA, the user has the option to show the clustering of nodes based on that threshold if set to TRUE, or FALSE to show the minimum spanning tree without any clustering between nodes, as if the user did not apply any clustering. The default is TRUE

MST_edges_color

character; This argument will allow the user to set the color of the edges that connect the nodes. The default is "black"

cluster_edges_color

character; This argument will allow the user to set the color of the edges that connect the clustered nodes. The default is "grey"

MST_edges_width

numeric; This argument will allow the user to set the width of the edges that connect the nodes. The default is 0.75

cluster_edges_width

numeric; This argument will allow the user to set the width of the edges that connect the clustered nodes. The default is 0.5

edge_label_size

numeric; This argument will allow the user to set the label size of the distances on the edges. The default is 3

edge_label_dodge

numeric; This argument will allow the user control the position of the distance on the edges. The default is 2

node_color

character; This argument will allow the user to choose the color of the nodes. The color can be specified by its name or using hexadecimal representation. Also, if the metadata argument is given, the user can specify a column name from the metadata data frame to color the nodes i.e. "Year". The default is "red"

node_size

numeric; This argument will allow the user to control the node size. The default is 3

node_label_size

numeric; This argument will allow the user to control the node label size. If set to zero, no labels will be shown. The default is 0

show_legend

logical; This argument will allow the user to show or hide the legend of the generated plot. The default is TRUE

title

character; This argument will allow the user to add a title to the generated plot. The default is NULL

basic

logical; This argument will allow the user to generate a very basic minimum spanning tree layout using the the package NetPathMiner. The default is FALSE

Details

The function PlotMST will make a minimum spannig tree using the output of makeGraphFromChewBBACA function. Many arguments are available to customize the minimum spanning tree.

Value

Graph object.

Examples

my_graph <- makeGraphFromChewBBACA(system.file("extdata", "cgMLST95.csv", 
   package = "MSTree"), max_allelic_difference=-1)
mst <- PlotMST(my_graph, show_clustering = TRUE, show_legend=FALSE, 
   MST_edges_color="#b97b29", node_color = "#3b17db", 
   node_label_size = 3, title = "MST")