ExportCytoscape
ExportCytoscape.RdExport an mmo object as a node table and edge table for visualisation in
Cytoscape. Edges are derived from a stored feature dissimilarity matrix.
Nodes carry abundance statistics and any annotation columns present in
mmo$sirius_annot and mmo$feature_info.
Usage
ExportCytoscape(
mmo,
distance = "dreams",
outprefix = "cytoscape_export",
sim_threshold = 0.7,
top_k = NULL,
group_col = "group",
sample_col = "sample"
)Arguments
- mmo
mmo object. Must contain
mmo$feature_dataandmmo$metadata.mmo$feature_infoandmmo$sirius_annotare used when present.- distance
Name of the dissimilarity matrix to use for edges (default:
"dreams"). Passed toGetDistanceMat().- outprefix
File path prefix for output CSVs (default:
"cytoscape_export").- sim_threshold
Minimum pairwise similarity (= 1 - dissimilarity) for an edge to be retained (default:
0.7). Set to0to disable.- top_k
Integer or
NULL. If notNULL, each node retains only itstop_kmost similar neighbours after threshold filtering (default:NULL= no k limit).- group_col
Metadata column defining groups for per-group mean abundance columns (default:
"group").- sample_col
Metadata column matching sample IDs to feature columns (default:
"sample").
Value
Invisibly returns a named list:
nodes (data.frame), edges (data.frame),
nodes_path, edges_path (file paths).
Details
Edge filtering: Two complementary filters control which edges are retained. Both are applied together (a pair must pass both to be included):
sim_threshold– drop all edges with similarity below this value. Higher values produce sparser, higher-confidence networks.top_k– for each node, retain only itstop_kmost similar neighbours (by similarity).NULLkeeps all edges that pass the threshold. This is useful for preventing highly-connected hub nodes from dominating the layout.
A warning is issued when the retained edge count exceeds 50 000, as large networks can be slow to render in Cytoscape.
Node table columns:
The node table always includes id, prevalence (proportion of
samples with detected abundance), and one mean_<group> column per
group. Any columns present in mmo$feature_info and
mmo$sirius_annot are appended automatically – the function does not
assume specific column names. Column names are sanitised to replace
characters that cause problems in Cytoscape (spaces, #, :).
Loading in Cytoscape:
File -> Import -> Network from File -> select
_edges.csv. Mapsourceas Source Node,targetas Target Node,similarityas Edge Attribute.File -> Import -> Table from File -> select
_nodes.csv. Mapidas the Key column matching node names.In the Style panel, map
Fill Colorto any annotation column (e.g.NPC_pathway) to color nodes by compound class.