Conversation
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Variable dataset_path is not used.
| from im2deep import constants | ||
|
|
||
| # Store original values | ||
| original_model = constants.DEFAULT_MODEL |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Import of 'PSM' is not used.
Import of 'Peptidoform' is not used.
|
|
||
| from __future__ import annotations | ||
|
|
||
| import sys |
There was a problem hiding this comment.
Import of 'sys' is not used.
| import sys |
| from typing import Any | ||
| import logging | ||
| from rich.text import Text | ||
| import gzip |
There was a problem hiding this comment.
Import of 'gzip' is not used.
| import gzip |
| with pytest.raises(IM2DeepError): | ||
| raise CalibrationError("calibration failed") | ||
|
|
||
| with pytest.raises(CalibrationError, match="calibration failed"): |
There was a problem hiding this comment.
This statement is unreachable.
| except ValueError as e: | ||
| raise CalibrationError("wrapped error") from e | ||
|
|
||
| assert exc_info.value.__cause__ is original_error |
There was a problem hiding this comment.
This statement is unreachable.
No description provided.