Skip to content
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

Test cofactor networks generated with the CLI #1048

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

jthorton
Copy link
Collaborator

@jthorton jthorton commented Dec 12, 2024

Extend the CLI network tests with cofactors to explicitly check that they are included in the transformations.
Checklist

  • Added a news entry

Developers certificate of origin

Copy link

🚨 API breaking changes detected! 🚨

Copy link

codecov bot commented Dec 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.80%. Comparing base (401ae3d) to head (03191ed).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1048      +/-   ##
==========================================
- Coverage   94.50%   92.80%   -1.70%     
==========================================
  Files         134      134              
  Lines        9986     9995       +9     
==========================================
- Hits         9437     9276     -161     
- Misses        549      719     +170     
Flag Coverage Δ
fast-tests 92.80% <100.00%> (?)
slow-tests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jthorton
Copy link
Collaborator Author

Python 3.11/12 tests are failing as the name of the cofactor component is not what we expect, see here.

AssertionError: assert 'cofactor1' in {'RFEComponentLabels.COFACTOR1': SmallMoleculeComponent(name=3L9H), 'ligand': SmallMoleculeComponent(name=lig_CHEMBL1078691), 'protein': ProteinComponent(name=), 'solvent': SolventComponent(name=O, Na+, Cl-)}

Copy link

🚨 API breaking changes detected! 🚨

@jthorton jthorton self-assigned this Dec 12, 2024
@jthorton jthorton linked an issue Dec 12, 2024 that may be closed by this pull request
@jthorton jthorton requested review from atravitz and IAlibay December 12, 2024 16:44
@@ -112,7 +112,7 @@ def __call__(
RFEComponentLabels.PROTEIN: self.protein,
}
for i, c in enumerate(self.cofactors):
components.update({f'{RFEComponentLabels.COFACTOR}{i+1}': c})
components.update({f'{RFEComponentLabels.COFACTOR.value}{i+1}': c})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the reason for using the value here instead of using the RFEComponentLabels object itself?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason using it like this gives an unexpected label, the cofactor is called RFEComponentLabels.COFACTOR1 whereas the ligand and protein components are labelled ligand and protein as expected. See the error for how this looks, I guess its not super important to change as I don't think these labels are used for anything but it doesn't look nice and its not easy to pull out the cofactor with the inconsistent naming.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

within abstract_chemicalsystem_generator.py, if you make the class inherit from StrEnum instead of both str and Enum (i.e.RFEComponentLabels(StrEnum)), it'll solve this!

It looks like StrEnum has some additional handling for string representation, but I don't quite understand the details.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh thanks, though I think that the component keys should all be strings going by the type hint in gufe so maybe they should all be using .value?

Copy link

🚨 API breaking changes detected! 🚨

Copy link
Contributor

@atravitz atravitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one change to make the enum handling cleaner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add tests for cofactor support
2 participants