How steineggerlab/foldcomp works
Main Components
• Input Handler / File I/O: Modules responsible for reading protein structures (PDB/CIF) and managing input directories, tar files, or file lists.
• Core Compression & Decompression Engine: The heart of the project that processes the structure data. This includes:
• C++ compression code (foldcomp.cxx, src/foldcomp.cpp, etc.)
• Algorithms to convert 3D coordinates into torsion angles and then encode them into a small binary file (FCZ file format).
• Decompression logic that reverses the process.
• Python API and CLI Frontend:
• Command-line interface (the foldcomp executable) that wraps the compression/decompression routines and exposes various commands.
• The Python binding (foldcomp.py) that allows the same functionalities via a Python package.
• External Libraries and Dependencies:
• gemmi library for handling molecular data formats and any structure-specific functions.
• microtar (and possibly other utilities) for handling archive files.
• Build and Deployment Infrastructure:
• CMake configuration files that specify how to compile the C++ components.
• GitHub workflows (.github/workflows) for continuous integration and testing.
• Setup scripts (setup.py, build.sh) and packaging configuration (pyproject.toml) to build and distribute the software.
• Test and Example Suites:
• The test directory contains various examples and test files that verify the functionality of the system across different input types.
Representing Relationships and Data Flow
• How the user provides data (as PDB/CIF files, directories, or archives) to the system through the CLI or Python API.
• Python layer as an adapter/wrapper sitting on top of the core engine – interfacing with users through high-level APIs and using the underlying C++ routines.
• External libraries (gemmi and microtar) should be depicted as auxiliary modules that the Core Engine depends on for specialized tasks (e.g., structure parsing and archive operations).
Architectural Patterns and Design Principles
• Separation of Concerns: The system cleanly separates the file I/O, core computational logic (compression/decompression), and user interface layers.
• Modularity: The design is modular (with distinct directories for core source code, libraries, tests, examples, and CI workflows), making it easier to extend and maintain.
• Multi-language Interoperability: The project demonstrates a hybrid approach combining C++ performance with Python usability.
• Threading Support: There is a threading option in the commands, so indicate that the engine can leverage parallelization for performance.