Molecular structure to graph conversion
Use when when you have validated RDKit molecule objects from chemical databases (PubChem, HMDB) and need to generate graph-structured features for machine learning models that consume molecular topology as input.From its SKILL.md
npx -y skills add HolobiomicsLab/asb-skill-collections --skill molecular-structure-to-graph-conversionAssembled 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
6.1 KB, 889 tokens by cl100k_base, as published. Nobody here has run it
molecular-structure-to-graph-conversion
License: restricted — no clear open-source license detected for the underlying tool; verify licensing before commercial use or redistribution. <!-- asb-license-banner -->
Summary
Convert RDKit molecule objects derived from PubChem/HMDB IDs into graph-based feature representations (node and edge tensors) suitable for neural network training. This skill bridges molecular structure validation and downstream multimodal feature alignment by extracting topology and connectivity information.
When to use
When you have validated RDKit molecule objects from chemical databases (PubChem, HMDB) and need to generate graph-structured features for machine learning models that consume molecular topology as input. Use this skill if your training pipeline requires node-edge tensor representations alongside other modalities (fingerprints, descriptors).
When NOT to use
- Input molecule structures are already represented as pre-computed adjacency matrices or graph embeddings.
- Your analysis goal requires only 1D molecular summaries (fingerprints, descriptors) and does not need topology information.
- Molecule objects are invalid or cannot be parsed by RDKit (structural integrity check has failed).
Inputs
- RDKit molecule objects (validated molecular structures)
- PubChem or HMDB molecule identifiers (as strings or integers)
- data.csv (CSV file containing molecule IDs and metadata)
Outputs
- Node feature tensors (atom-level properties and embeddings)
- Edge feature tensors (bond-level connectivity and properties)
- Aligned graph tensor pair suitable for GNN input
- Serialized graph features (HDF5 or pickle format)
How to apply
After loading and validating molecule IDs from data.csv and converting each to a RDKit molecule object, extract node features (atom properties) and edge features (bond connectivity) from the molecular structure graph. Use RDKit's graph traversal and property accessor methods to construct adjacency and feature matrices. Stack the resulting node and edge tensors into aligned numpy arrays that preserve molecule identity and can be serialized (HDF5 or pickle) alongside other modality tensors. Verify that tensor dimensions match the number of atoms and bonds in each molecule and that sparse representations (if used) preserve graph connectivity.
Related tools
- RDKit (Molecular structure parsing, graph construction, and feature extraction from validated molecule objects)
- numpy (Tensor creation, stacking, and alignment of node-edge feature matrices into aligned multimodal arrays)
- pandas (Loading and indexing molecule metadata from data.csv for batch processing)
Examples
# In data_prep.py: mol = Chem.MolFromSmiles(smiles); nodes, edges = extract_graph_features(mol); graph_tensor = np.stack([nodes, edges])
Evaluation signals
- Node tensor shape matches total atom count per molecule; edge tensor shape matches total bond count.
- All nodes are assigned valid atom features (atomic number, charge, hybridization); all edges reference valid atom pairs.
- Graph connectivity is preserved: edge indices refer to valid node indices and reflect the molecular structure.
- Tensor dimensions and dtypes are consistent across the batch and serializable without loss of precision.
- Downstream GNN model accepts graph tensors without reshape errors and produces valid node/graph-level embeddings.
Limitations
- RDKit version pinned to 2020.03.4; newer versions may change graph API or feature definitions.
- Molecules with unusual valence states or incomplete structure records may fail graph construction or produce sparse/malformed tensors.
- No handling documented for molecules with disconnected components; multi-component graphs may require custom handling.
- Graph representation is static and does not encode conformational or stereochemical variations beyond 2D connectivity.
Evidence
- [other] Convert each molecule ID to a RDKit molecule object and validate structural integrity.: "Convert each molecule ID to a RDKit molecule object and validate structural integrity."
- [other] Generate graph-based features (node and edge tensors) from molecular structures using RDKit.: "Generate graph-based features (node and edge tensors) from molecular structures using RDKit."
- [other] Stack graph, fingerprint, and descriptor modalities into aligned multimodal feature tensors using numpy.: "Stack graph, fingerprint, and descriptor modalities into aligned multimodal feature tensors using numpy."
- [readme] the process of multimodal dataset production is in data_prep.py: "the process of multimodal dataset production is in data_prep.py"
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.
Gives 0 of the 12 instructions most product growth skills give in 889 tokens
Counted across 728 of the 1,010 authors here whose files we hold, read 2026-08-07
- Read product marketing context before asking questionsin 24 of 728, across 18 files
- Define the ideal customer profilein 21 of 728, across 3 files
- Document a rollback plan before deploymentin 21 of 728, across 12 files
- Analyze the codebase to understand the productin 19 of 728, across 1 file
- Ask clarifying questions about the value propositionin 19 of 728, across 1 file
- Search for companies matching the criteriain 19 of 728, across 1 file
- Look for signals of immediate needin 19 of 728, across 1 file
- Assign a fit score from one to tenin 19 of 728, across 1 file
- Identify the target decision-maker rolein 19 of 728, across 1 file
- Suggest a personalized contact strategyin 19 of 728, across 1 file
- Provide conversation starters for outreachin 19 of 728, across 1 file
- Format results in a scannable markdown templatein 19 of 728, across 1 file
Said here and by no other author read
- extract node features from the molecular structure graph
- construct adjacency and feature matrices
- stack tensors into aligned numpy arrays
- serialize graph features
- verify tensor dimensions match atom and bond counts
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.