Added an option to select models based on a reverse ranking#1623
Merged
Conversation
…nd clusters in reverse order, meaning in descending order (from high to low scores). The default behavir remain unchanged (ascending order, from low to high scores). Score-based cluster ranking - Added the `sort_ascending` parameter: `true` (default) selects best-scoring clusters first; `false` reverses the order (highest average score first). The reverse option applies **only** to the score-based ranking, not to size-based ordering. - `rank_clust_order` now ranks clusters by their **average score** (computed over each cluster's best-scoring models via the shared `libclust.rank_clusters` helper), instead of just sorting the original cluster-rank keys coming from the clustering module. - Added `cluster_score_threshold` (default 4): number of best-scoring models per cluster used to compute the cluster's average score. Replaces a previously hard-coded value. Output naming - Exported cluster PDB files are now named following the **average-score ranking**: `cluster_1_model_1.pdb` corresponds to the best-scoring cluster (in ascending or descending order). The export loop renumbers `clt_rank` by its position in the computed ranking. Tests - Updated `tests/test_module_seletopclusts.py` for the new behavior
amjjbonvin
requested review from
AnnaKravchenko,
Comp-era and
VGPReys
and removed request for
VGPReys
July 15, 2026 08:20
Co-authored-by: Arha <kravchenko.anna.d@gmail.com>
Co-authored-by: Arha <kravchenko.anna.d@gmail.com>
Co-authored-by: Arha <kravchenko.anna.d@gmail.com>
Co-authored-by: Arha <kravchenko.anna.d@gmail.com>
Co-authored-by: Arha <kravchenko.anna.d@gmail.com>
Co-authored-by: Arha <kravchenko.anna.d@gmail.com>
Contributor
|
If you could add a separate log for when |
Co-authored-by: Arha <kravchenko.anna.d@gmail.com>
AnnaKravchenko
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do and why?
Until now the assumptions as that the best models would have the lowest scores, with a default ascending sorting when ranking them. Some scoring function might have a different behaviour (e.g. higher is better).
This PR implements the option to rank/select models in reverse order.
An option was added to both
seletopandseletopclustto rank models/clusters in reverse (descending) order meaning in from high to low scores. The default behavior remain unchanged (ascending order, from low to high scores).Single structure selection
sort_ascendingparameter:true(default) selects best-scoring clusters first;falsereverses the order (highest average score first).Score-based cluster selection
sort_ascendingparameter:true(default) selects best-scoring clusters first;falsereverses the order (highest average score first). The reverse option applies only to the score-based ranking, not to size-based ordering.rank_clust_ordernow ranks clusters by their average score (computed over each cluster's best-scoring models via the sharedlibclust.rank_clustershelper), instead of just sorting the original cluster-rank keys coming from the clustering module.cluster_score_threshold(default 4): number of best-scoring models per cluster used to compute the cluster's average score. Replaces a previously hard-coded value.cluster_1_model_1.pdbcorresponds to the best-scoring cluster (in ascending or descending order). The export loop renumbersclt_rankby its position in the computed ranking.How was this tested?
Tested by running a test workflow from the docking-protein-protein example, adding
sort_ascending=falseto theseletop,seletopclustandcaprievalstages and manually control that the ranking is indeed reverted.Integration test for
seletopclustadapted for the new option and new test added forseletop.All tests passing.
AI assistance
AI was used to sort out some error in the
seletopclustimplementation and in updating the tests.Checklist
CHANGELOG.mdupdated for user-facing changesRelated issues
#1620