Skip to content

feat(cli): Implement DREID-Forge Command-Line Interface#10

Merged
TKanX merged 50 commits intomainfrom
feature/9-implement-a-composable-command-line-interface-cli
Dec 15, 2025
Merged

feat(cli): Implement DREID-Forge Command-Line Interface#10
TKanX merged 50 commits intomainfrom
feature/9-implement-a-composable-command-line-interface-cli

Conversation

@TKanX
Copy link
Copy Markdown
Member

@TKanX TKanX commented Dec 15, 2025

Summary:

Introduced dforge, a feature-rich command-line interface (CLI) for the DREID-Forge library. This tool exposes the complete parameterization pipeline—from structure preparation to force field generation—through two intuitive subcommands: dforge bio for biological macromolecules and dforge chem for small molecule chemistry. It includes robust I/O handling, interactive progress reporting, and extensive configuration options for fine-tuning the DREIDING force field application.

Changes:

  • Implemented CLI Architecture:

    • Created src/bin/dforge structure with modular command handlers (commands/bio.rs, commands/chem.rs).
    • Integrated clap for argument parsing with subcommands, aliases (b/c), and grouped help messages.
    • Added support for stdin/stdout piping and multi-format output generation in a single run.
  • Developed dforge bio Command:

    • Exposes the full bio-forge preparation pipeline: cleaning (water/ions/hetero removal), protonation (pH, His tautomers), and solvation (box size, ion concentration).
    • Handles PDB and mmCIF inputs with automatic format detection.
    • Supports loading external MOL2 templates for non-standard residues.
  • Developed dforge chem Command:

    • Optimized for small molecule parameterization (MOL2/SDF inputs).
    • Streamlines the workflow by bypassing biological preparation steps while retaining full force field configurability (QEq charges, potential types).
  • Enhanced User Experience:

    • Integrated indicatif for rich, interactive progress spinners and step completion reporting.
    • Implemented detailed summary tables for structure statistics (atoms, bonds, box dimensions) and parameterization results (atom type distribution, potential term counts).
    • Added a comprehensive error reporting system with actionable hints for common failures (e.g., missing parameters, invalid formats).
  • Configuration & Flexibility:

    • Mapped all library configurations (CleanConfig, ProtonationConfig, ForgeConfig, LammpsConfig) to CLI flags.
    • Enabled customization of potential functional forms (Harmonic/Morse, Cosine/Theta-Harmonic, LJ/Exp-6).
    • Added support for custom atom typing rules and parameter files via TOML inputs.
  • Documentation:

    • Created MANUAL.md as a definitive user guide for the CLI.
    • Added example workflows for various molecule types (drugs, proteins, large complexes) in the examples/ directory.
    • Updated README.md with CLI installation and usage instructions.
  • Performance & Refactoring:

    • Replaced BTreeMap with IndexMap in to_bio_topology to ensure deterministic atom ordering, critical for reproducible simulations.
    • Fixed edge cases in SDF parsing and BGF writing.

TKanX added 30 commits December 12, 2025 22:48
TKanX added 20 commits December 14, 2025 03:20
…s including Acetaminophen, Aspirin, and others
@TKanX TKanX self-assigned this Dec 15, 2025
Copilot AI review requested due to automatic review settings December 15, 2025 06:21
@TKanX TKanX added documentation 📖 Improvements or additions to documentation enhancement ✨ New feature or request labels Dec 15, 2025
@TKanX TKanX linked an issue Dec 15, 2025 that may be closed by this pull request
37 tasks
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a comprehensive CLI tool (dforge) for the DREID-Forge molecular parameterization library, exposing the complete pipeline from structure preparation to force field generation. The implementation follows good practices with modular architecture, proper error handling, and rich user experience features. Key changes also include critical bug fixes in the core library for deterministic atom ordering and robust parsing.

Key Changes:

  • Implemented full-featured CLI with bio and chem subcommands for different molecular workflows
  • Replaced BTreeMap with IndexMap in topology conversion for deterministic ordering
  • Fixed edge cases in SDF parsing and BGF writing for Unicode safety
  • Added interactive progress reporting and detailed error diagnostics

Reviewed changes

Copilot reviewed 27 out of 68 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/io/util.rs Switched to IndexMap for deterministic atom ordering in bio topology conversion
src/io/sdf/reader.rs Fixed potential panics with .get() for safe string slicing
src/io/mod.rs Split LAMMPS format into separate Data and Settings variants
src/io/bgf/writer.rs Fixed truncation to handle Unicode properly with char boundaries
src/forge/config.rs Updated documentation comment for clarity
src/bin/dforge/main.rs CLI entry point with context detection and error handling
src/bin/dforge/cli.rs Comprehensive argument parsing with clap
src/bin/dforge/commands/ Command handlers for bio and chem workflows
src/bin/dforge/config/ Configuration builders mapping CLI args to library types
src/bin/dforge/io/ I/O abstraction layer with format inference
src/bin/dforge/display/ Progress reporting, error display, and summary tables
src/bin/dforge/util/ Text wrapping and truncation utilities
examples/drugs/ Example drug molecules with documentation
examples/large/ Large biomolecule examples

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@TKanX TKanX merged commit 7b833c8 into main Dec 15, 2025
8 checks passed
@TKanX TKanX deleted the feature/9-implement-a-composable-command-line-interface-cli branch December 15, 2025 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation 📖 Improvements or additions to documentation enhancement ✨ New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement a Composable Command-Line Interface (CLI)

2 participants