Skip to content

granet ‐ visualizing genome dereplication using graphs

Rauf Salamzade edited this page Oct 4, 2024 · 7 revisions

granet uses igraph to generate graphical visuals showing how the representatives selected by skDER or CiDDER relate to the full set of genomes provided as input. Each node corresponds to a genome and edges indicate pairs of genomes are similar at some ANI and AF cutoff (default 99% ANI and 90% AF).

Note, because skani ANI & AF estimates from a previous skDER analysis are used as inputs for granet, if skDER was run with more stringent cutoffs for ANI / AF then what is requested to be shown - then not all possible edges will be shown. Red nodes are selected representative genomes.

Example command

granet -s skder_greedy_99ANI90AF/Skani_Triangle_Edge_Output.txt \
       -d skder_greedy_99ANI90AF/Dereplicated_Representative_Genomes/ 

Note, while it might appear there are many singleton black (non-representative genomes), if you zoom in you will see it is on top of a red node. This is corrected in v1.2.8 onwards where representative nodes are made to be on top.

We can make remake the plot - making the area of the plot smaller and applying a different layout scheme (Kamada-Kawai in this case):

granet -s skder_greedy_99ANI90AF/Skani_Triangle_Edge_Output.txt \
       -d skder_greedy_99ANI90AF/Dereplicated_Representative_Genomes/ \
       -o kamada_kawai_layout.png -w 10 -l kamada_kawai

Learn about different layout schemes supported by igraph on this page of their documentation.

Usage

usage: granet [-h] -s SKANI_RESULTS -d DEREPLICATED_RESULTS [-i ANI_CUTOFF] [-f AF_CUTOFF] [-o OUTPUT_PLOT] [-w WIDTH] [-wm] [-l LAYOUT] [-ns NODE_SIZ

        Program: granet
        Author: Rauf Salamzade
        Affiliation: Kalan Lab, UW Madison, McMaster University

        granet: graph network - plots a network with representative genomes marked in red.

        E.g. granet -s greedy_skder_results/Skani_Triangle_Edge_Output.txt \
                    -d greedy_skder_results/Dereplicated_Representative_Genomes/ \
                    -ns 10 -w 5 -ew 2 -o greedy_skder_granet.png


options:
  -h, --help            show this help message and exit
  -s SKANI_RESULTS, --skani-results SKANI_RESULTS
                        Path to skani clustering results - for CiDDER this can be generated via requesting -ns.
  -d DEREPLICATED_RESULTS, --dereplicated_results DEREPLICATED_RESULTS
                        Path to Dereplicated_Representative_Genomes/ folder in skDER or CiDDER results folder.
  -i ANI_CUTOFF, --ani-cutoff ANI_CUTOFF
                        The ANI cutoff for edges to be shown in the network [Default is 99.0].
  -f AF_CUTOFF, --af-cutoff AF_CUTOFF
                        The AF cutoff for edges to be shown in the network [Default is 90.0].
  -o OUTPUT_PLOT, --output-plot OUTPUT_PLOT
                        Path to output plot in PNG format [Default is "dereplication_network_view.png"].
  -w WIDTH, --width WIDTH
                        Width of the plotting space [Default is 50].
  -wm, --weak-mode      Apply weak connection mode - to space things out more if too much overlap - not compatible with layout.
  -l LAYOUT, --layout LAYOUT
                        The layout mode to use - see: https://python.igraph.org/en/stable/tutorial.html#layout-algorithms [Default is "fruchterman_rei
  -ns NODE_SIZE, --node-size NODE_SIZE
                        The node size [Default is 3].
  -ew EDGE_WIDTH, --edge-width EDGE_WIDTH
                        The edge width [Default is 0.5].
  -rs RANDOM_SEED, --random-seed RANDOM_SEED
                        Random seed to control layout reproducability [Default is 1234].
  -v, --version         Report version of granet.