-
Notifications
You must be signed in to change notification settings - Fork 2
IM2Deep 2.0 API #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
IM2Deep 2.0 API #18
Conversation
There was a problem hiding this 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 IM2Deep 2.0 API, a major refactoring from version 1.2.0 to 2.0.0-beta. The changes modernize the codebase with comprehensive test coverage, refactored architecture using PyTorch Lightning, and an improved API design with better separation of concerns.
Changes:
- Complete API refactoring with new modular structure (core, calibration, model_ops, constants)
- Added comprehensive test suite with 9 test modules covering ~90% of functionality
- Replaced DeepLC-based models with native PyTorch Lightning implementations
- Updated dependencies: removed version constraint on deeplc, added torch and lightning as core dependencies
- Enhanced CLI with better argument handling and profiling support
Reviewed changes
Copilot reviewed 27 out of 36 changed files in this pull request and generated 29 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/* | New comprehensive test suite with fixtures, unit tests, and integration tests |
| pytest.ini | Pytest configuration with markers for integration and slow tests |
| pyproject.toml | Updated dependencies: removed deeplc constraint and er extras, added torch/lightning |
| im2deep/utils.py | Major expansion with input parsing, validation, CCS conversion, and CLI utilities |
| im2deep/_model_ops.py | New file for PyTorch model loading and prediction operations |
| im2deep/core.py | New high-level API with predict() and predict_and_calibrate() functions |
| im2deep/constants.py | New file centralizing model paths, configurations, and physical constants |
| im2deep/calibration.py | Refactored calibration with abstract base class and LinearCCSCalibration implementation |
| im2deep/_architecture.py | New file with PyTorch Lightning model architectures (IM2Deep, IM2DeepMulti, IM2DeepMultiTransfer) |
| im2deep/_exceptions.py | Minor formatting improvements to exception classes |
| im2deep/main.py | Major CLI refactor with DefaultCommandGroup, improved argument handling, and profiling |
| im2deep/init.py | Updated to version 2.0.0-beta with new API exports |
| README.md | Comprehensive documentation update with CLI examples and API usage |
| .github/workflows/test.yml | New CI/CD workflow for automated testing |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| from im2deep.constants import DEFAULT_MODEL | ||
|
|
||
| if DEFAULT_MODEL is not None: | ||
| model_path = Path(DEFAULT_MODEL) |
Copilot
AI
Jan 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable model_path is not used.
| from im2deep.constants import DEFAULT_MULTI_MODEL | ||
|
|
||
| if DEFAULT_MULTI_MODEL is not None: | ||
| model_path = Path(DEFAULT_MULTI_MODEL) |
Copilot
AI
Jan 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable model_path is not used.
| from im2deep.constants import DEFAULT_REFERENCE_DATASET_PATH | ||
|
|
||
| if DEFAULT_REFERENCE_DATASET_PATH is not None: | ||
| dataset_path = Path(DEFAULT_REFERENCE_DATASET_PATH) |
Copilot
AI
Jan 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable dataset_path is not used.
| from im2deep.constants import DEFAULT_MULTI_REFERENCE_DATASET_PATH | ||
|
|
||
| if DEFAULT_MULTI_REFERENCE_DATASET_PATH is not None: | ||
| dataset_path = Path(DEFAULT_MULTI_REFERENCE_DATASET_PATH) |
Copilot
AI
Jan 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable dataset_path is not used.
| from im2deep import constants | ||
|
|
||
| # Store original values | ||
| original_model = constants.DEFAULT_MODEL |
Copilot
AI
Jan 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable original_model is not used.
| import pandas as pd | ||
| import numpy as np | ||
| from pathlib import Path | ||
| from psm_utils import PSM, PSMList, Peptidoform |
Copilot
AI
Jan 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import of 'PSM' is not used.
Import of 'Peptidoform' is not used.
|
|
||
| from __future__ import annotations | ||
|
|
||
| import sys |
Copilot
AI
Jan 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import of 'sys' is not used.
| import sys |
| from typing import Any | ||
| import logging | ||
| from rich.text import Text | ||
| import gzip |
Copilot
AI
Jan 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import of 'gzip' is not used.
| import gzip |
| with pytest.raises(IM2DeepError): | ||
| raise CalibrationError("calibration failed") | ||
|
|
||
| with pytest.raises(CalibrationError, match="calibration failed"): |
Copilot
AI
Jan 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This statement is unreachable.
| except ValueError as e: | ||
| raise CalibrationError("wrapped error") from e | ||
|
|
||
| assert exc_info.value.__cause__ is original_error |
Copilot
AI
Jan 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This statement is unreachable.
No description provided.