graph-based-link-representation-visualization
Summary
Represent and visualize molecular links discovered between genomic and metabolomic entities (GCFs, spectra, molecular families, strains) as a LinkGraph object, enabling structured access to scored link relationships for downstream analysis and interpretation.
When to use
After NPLinker computes scored links between genomic and metabolomic entities using a scoring method (e.g., metcalf), use this skill to construct and inspect the resulting LinkGraph to examine which GCFs are linked to spectra/molecular families, access link scores, and prepare linked data for export or visualization.
When NOT to use
- Input data is not yet loaded into NPLinker (i.e., npl.load_data() has not been called)
- No links have been computed yet (npl.get_links() has not been invoked)
- Link computation has failed or returned an empty LinkGraph due to incompatible input data or scoring method
Inputs
- NPLinker instance with loaded GNPS spectra, molecular families, and AntiSMASH BGC data
- Computed links from npl.get_links() call with a specified scoring method (e.g., metcalf)
- LinkGraph object returned from link computation
Outputs
- LinkGraph object containing scored link relationships
- Enumerated GCF, spectrum, molecular family, and strain entities accessible via properties
- Scored link tuples (link_graph.links) representing relationships between entities with associated scores
How to apply
After calling npl.get_links() with a scoring method, the returned LinkGraph object provides structured access to NPLinker's four core entity types: GCFs (from AntiSMASH), spectra (from GNPS), molecular families (from GNPS), and strains. Access the LinkGraph via properties such as npl.gcfs, npl.spectra, npl.mfs, and npl.strains to enumerate entities, then retrieve scored link tuples from link_graph.links to examine link strength and relationships. The LinkGraph acts as the primary data structure for representing integration results, making it essential for understanding which genomic regions correlate with detected metabolites and for filtering or ranking links by score before export.
Related tools
- nplinker (Framework that instantiates, loads data into, and returns LinkGraph objects representing computed genomic-metabolomic links) — https://github.com/NPLinker/nplinker
- GNPS (Source of spectra and molecular family data that populate the LinkGraph as metabolomic entities)
- AntiSMASH (Source of BGC data that populate the LinkGraph as GCF (genomic cluster family) entities)
Examples
npl.get_links(npl.gcfs[:3], 'metcalf'); print([(link.gcf.id, link.spectrum.spectrum_id, link.score) for link in npl.link_graph.links])
Evaluation signals
- LinkGraph object is non-empty and contains at least one link (link_graph.links is populated)
- All four entity types (GCFs, spectra, molecular families, strains) are accessible and enumerable via LinkGraph properties
- Link tuples in link_graph.links contain valid score values corresponding to the scoring method used (e.g., metcalf scores are numeric and within expected range)
- Entity counts match the input GNPS and AntiSMASH data (e.g., npl.gcfs count ≤ total BGCs in antismash directory)
- Link relationships are bidirectional: each link can be traced back to source entities (GCF, spectrum, MF, strain)
Limitations
- LinkGraph representation is specific to the scoring method and parameters used; different scoring methods (e.g., metcalf vs. other scorers) produce different link topologies
- LinkGraph does not persist relationships if not explicitly exported; it exists only in memory during the NPLinker session
- Large datasets may result in LinkGraphs with high cardinality, requiring filtering or post-processing to identify high-confidence links
- The document provided contains only changelog entries and dependency history, lacking discussion of LinkGraph serialization formats or visualization limitations
Evidence
- [other] Call npl.get_links(npl.gcfs[:3], 'metcalf') to compute metcalf-scored links between the first three GCFs and other entities, returning a LinkGraph object.: "Call npl.get_links(npl.gcfs[:3], 'metcalf') to compute metcalf-scored links between the first three GCFs and other entities, returning a LinkGraph object."
- [other] Export the LinkGraph by accessing npl.gcfs, npl.spectra, npl.mfs, and npl.strains properties, and serialize link results via link_graph.links to obtain scored link tuples.: "Export the LinkGraph by accessing npl.gcfs, npl.spectra, npl.mfs, and npl.strains properties, and serialize link results via link_graph.links to obtain scored link tuples."
- [readme] NPLinker is a python framework for data mining microbial natural products by integrating genomics and metabolomics data.: "NPLinker is a python framework for data mining microbial natural products by integrating genomics and metabolomics data."
1---2name: graph-based-link-representation-visualization3description: Use when after NPLinker computes scored links between genomic and metabolomic entities using a scoring method (e.4license: CC-BY-4.05---67# graph-based-link-representation-visualization89## Summary1011Represent and visualize molecular links discovered between genomic and metabolomic entities (GCFs, spectra, molecular families, strains) as a LinkGraph object, enabling structured access to scored link relationships for downstream analysis and interpretation.1213## When to use1415After NPLinker computes scored links between genomic and metabolomic entities using a scoring method (e.g., metcalf), use this skill to construct and inspect the resulting LinkGraph to examine which GCFs are linked to spectra/molecular families, access link scores, and prepare linked data for export or visualization.1617## When NOT to use1819- Input data is not yet loaded into NPLinker (i.e., npl.load_data() has not been called)20- No links have been computed yet (npl.get_links() has not been invoked)21- Link computation has failed or returned an empty LinkGraph due to incompatible input data or scoring method2223## Inputs2425- NPLinker instance with loaded GNPS spectra, molecular families, and AntiSMASH BGC data26- Computed links from npl.get_links() call with a specified scoring method (e.g., metcalf)27- LinkGraph object returned from link computation2829## Outputs3031- LinkGraph object containing scored link relationships32- Enumerated GCF, spectrum, molecular family, and strain entities accessible via properties33- Scored link tuples (link_graph.links) representing relationships between entities with associated scores3435## How to apply3637After calling npl.get_links() with a scoring method, the returned LinkGraph object provides structured access to NPLinker's four core entity types: GCFs (from AntiSMASH), spectra (from GNPS), molecular families (from GNPS), and strains. Access the LinkGraph via properties such as npl.gcfs, npl.spectra, npl.mfs, and npl.strains to enumerate entities, then retrieve scored link tuples from link_graph.links to examine link strength and relationships. The LinkGraph acts as the primary data structure for representing integration results, making it essential for understanding which genomic regions correlate with detected metabolites and for filtering or ranking links by score before export.3839## Related tools4041- **nplinker** (Framework that instantiates, loads data into, and returns LinkGraph objects representing computed genomic-metabolomic links) — https://github.com/NPLinker/nplinker42- **GNPS** (Source of spectra and molecular family data that populate the LinkGraph as metabolomic entities)43- **AntiSMASH** (Source of BGC data that populate the LinkGraph as GCF (genomic cluster family) entities)4445## Examples4647```48npl.get_links(npl.gcfs[:3], 'metcalf'); print([(link.gcf.id, link.spectrum.spectrum_id, link.score) for link in npl.link_graph.links])49```5051## Evaluation signals5253- LinkGraph object is non-empty and contains at least one link (link_graph.links is populated)54- All four entity types (GCFs, spectra, molecular families, strains) are accessible and enumerable via LinkGraph properties55- Link tuples in link_graph.links contain valid score values corresponding to the scoring method used (e.g., metcalf scores are numeric and within expected range)56- Entity counts match the input GNPS and AntiSMASH data (e.g., npl.gcfs count ≤ total BGCs in antismash directory)57- Link relationships are bidirectional: each link can be traced back to source entities (GCF, spectrum, MF, strain)5859## Limitations6061- LinkGraph representation is specific to the scoring method and parameters used; different scoring methods (e.g., metcalf vs. other scorers) produce different link topologies62- LinkGraph does not persist relationships if not explicitly exported; it exists only in memory during the NPLinker session63- Large datasets may result in LinkGraphs with high cardinality, requiring filtering or post-processing to identify high-confidence links64- The document provided contains only changelog entries and dependency history, lacking discussion of LinkGraph serialization formats or visualization limitations6566## Evidence6768- [other] Call npl.get_links(npl.gcfs[:3], 'metcalf') to compute metcalf-scored links between the first three GCFs and other entities, returning a LinkGraph object.: "Call npl.get_links(npl.gcfs[:3], 'metcalf') to compute metcalf-scored links between the first three GCFs and other entities, returning a LinkGraph object."69- [other] Export the LinkGraph by accessing npl.gcfs, npl.spectra, npl.mfs, and npl.strains properties, and serialize link results via link_graph.links to obtain scored link tuples.: "Export the LinkGraph by accessing npl.gcfs, npl.spectra, npl.mfs, and npl.strains properties, and serialize link results via link_graph.links to obtain scored link tuples."70- [readme] NPLinker is a python framework for data mining microbial natural products by integrating genomics and metabolomics data.: "NPLinker is a python framework for data mining microbial natural products by integrating genomics and metabolomics data."