agentsclimarketplace

Network node attribute assignment

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v2/skills/network-node-attribute-assignment

Use when you have constructed a NetworkX graph with LC-MS features as nodes and need to annotate each node with metadata derived from the MamsiStructSearch output (assay source, isotopologue group, adduct group, structural cluster ID, correlation cluster ID, and optional compound annotation).From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill network-node-attribute-assignment

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 15 stars15 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its file declares

Copied from the file, not written here

The file declares its own license as CC-BY-4.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

7.9 KB, ~1.4k tokens by cl100k_base, as published. Nobody here has run it

network-node-attribute-assignment

License: restricted — no clear open-source license detected for the underlying tool; verify licensing before commercial use or redistribution. <!-- asb-license-banner -->

Summary

Assign node attributes (assay membership, structural cluster identity, correlation cluster membership, and compound name) to feature nodes in a NetworkX graph constructed from multi-assay LC-MS data. This enrichment enables downstream filtering, visualization, and structural interpretation of feature relationships.

When to use

You have constructed a NetworkX graph with LC-MS features as nodes and need to annotate each node with metadata derived from the MamsiStructSearch output (assay source, isotopologue group, adduct group, structural cluster ID, correlation cluster ID, and optional compound annotation). This is required before rendering the network or filtering nodes by cluster membership.

When NOT to use

  • The NetworkX graph has not yet been constructed from features—use graph construction first.
  • MamsiStructSearch has not been run or its output DataFrame is incomplete or missing cluster columns.
  • Features in the graph do not correspond to rows in the MamsiStructSearch DataFrame (feature name mismatch).

Inputs

  • NetworkX graph object with features as nodes
  • pandas DataFrame from MamsiStructSearch output (columns: Feature, Assay, Isotopologue group, Isotopologue pattern, Adduct group, Adduct, Structural cluster, Correlation cluster, Cross-assay link, optional cpdName)

Outputs

  • NetworkX graph object with enriched node attributes (assay, isotopologue_group, isotopologue_pattern, adduct_group, adduct, structural_cluster, correlation_cluster, cross_assay_link, compound_name)
  • Attribute-annotated feature nodes suitable for visualization and filtering

How to apply

Load the DataFrame output from MamsiStructSearch, which contains columns Feature, Assay, Isotopologue group, Isotopologue pattern, Adduct group, Adduct, Structural cluster, Correlation cluster, Cross-assay link, and optional cpdName. For each feature node in the NetworkX graph, retrieve the corresponding row and assign its metadata values as node attributes using NetworkX's node attribute dictionary (e.g., G.nodes[feature_id]['assay'] = row['Assay'], G.nodes[feature_id]['struct_cluster'] = row['Structural cluster']). Ensure all features present in the graph have complete attribute assignment. This enables node colorization by cluster in pyvis visualization and supports downstream node filtering or curation based on structural properties.

Related tools

Examples

struct = MamsiStructSearch(rt_win=5, ppm=10)
struct.load_lcms(selected)
struct.get_structural_clusters(annotate=True)
df_clusters = struct.get_struct_cluster_df()
for feature, row in df_clusters.iterrows():
    G.nodes[feature]['assay'] = row['Assay']
    G.nodes[feature]['structural_cluster'] = row['Structural cluster']
    G.nodes[feature]['correlation_cluster'] = row['Correlation cluster']

Evaluation signals

  • Every feature node in the graph has non-null values for 'assay', 'structural_cluster', and 'correlation_cluster' attributes.
  • Node attribute keys match the MamsiStructSearch column names (Assay, Isotopologue group, Adduct group, Structural cluster, Correlation cluster, cpdName).
  • When iterating over G.nodes(data=True), each node dict contains ≥ 7 keys (feature identifier + 6 metadata attributes).
  • Pyvis interactive visualization renders nodes with distinct colors for each unique structural_cluster value (if include_all=True) without missing or NaN-colored nodes.
  • Filtering operations (e.g., [node for node, attr in G.nodes(data=True) if attr['assay'] == 'HPOS']) return the expected subset of features.

Limitations

  • Feature names in the NetworkX graph must exactly match feature identifiers in the MamsiStructSearch DataFrame; case-sensitive mismatches will result in missing attribute assignments.
  • If MamsiStructSearch is run with annotate=True but the assay is not supported by the National Phenome Centre ROI database, the cpdName attribute will be None/NaN for those features.
  • Large networks (>5000 features) may experience slow rendering in pyvis due to force-directed layout computation; consider filtering to structural clusters of interest before visualization.
  • Cross-assay link metadata is only populated when features from different assays (e.g., positive and negative ion modes) share a hypothetical neutral mass within the specified ppm tolerance.

Evidence

  • [methods] 1. Load structural clusters and correlation clusters from MamsiStructSearch output (DataFrame with Feature, Assay, Isotopologue group, Isotopologue pattern, Adduct group, Adduct, Structural cluster, Correlation cluster, Cross-assay link, and optional cpdName columns). 2. Construct a NetworkX graph with features as nodes, assigning node attributes (assay, cluster membership, compound name).: "Load structural clusters and correlation clusters from MamsiStructSearch output (DataFrame with Feature, Assay, Isotopologue group, Isotopologue pattern, Adduct group, Adduct, Structural cluster,"
  • [methods] Overlapping adduct clusters and isotopologue clusters are then merged to form structural clusters. Further, we search cross-assay clusters using [M+H]+/[M-H]- as link references.: "Overlapping adduct clusters and isotopologue clusters are then merged to form structural clusters. Further, we search cross-assay clusters using [M+H]+/[M-H]- as link references"
  • [readme] The different node colours represent different flattened hierarchical correlation clusters, while the edges between nodes identify their structural links.: "The different node colours represent different flattened hierarchical correlation clusters, while the edges between nodes identify their structural links"

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.