Compatibility fixes for modern NumPy / sklearn / HMMER / CheckM #49
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Update COMEBin to run with modern dependencies (Python 3.11, NumPy 1.26, scikit-learn 1.4+, PyTorch 2.2+), replacing removed/deprecated APIs and fixing env solver failures.
What changed
Python code fixes:
sklearn.cluster._kmeansprivate imports → public APIs (KMeans,euclidean_distances,check_random_state,row_norms)KMeans(algorithm="full", n_jobs=-1)→KMeans(algorithm="lloyd", n_init=10)stable_cumsum→np.cumsum(dtype=np.float64)np.int→np.int64(5 instances across 3 files).item(0)→.item()(deprecated positional arg in NumPy 2.x)torch.cuda.amp.{GradScaler,autocast}→torch.amp.{GradScaler,autocast}with explicitdevice_type(PyTorch 2.4+)ruamel.yamlPath loading → file handle (avoids deprecation warning)-E 1e-10when--cut_tcfails (HMMER ≥3.3)Runtime hardening:
CHECKM_DATA_PATHfrom$CONDA_PREFIXMPLCONFIGDIRto output dir (avoids writes to restricted$HOME)pkg_resourcesdeprecation warning from CheckMEnvironment (
comebin_env.yaml):<3.12for CheckM1 compatibility)>=1.26,<2.0, scikit-learn>=1.4, PyTorch>=2.2hnswlib,python-igraph,leidenalg,scanpyfrom pip to conda-forgepplacer=1.1.alpha19(>=1.1doesn't match alpha version strings → solver failure)ruamel.yamlandtqdmdependenciesIssue tags
Fixes #44
Refs #29, #38, #11
Validation
mamba env create -f comebin_env.yamlAI Assistance
Portions of this PR were developed with assistance from OpenAI Codex (initial refactoring) and Claude Code (code review, additional fixes, env debugging).