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

Filter update #67

Merged
merged 29 commits into from
Oct 14, 2024
Merged

Filter update #67

merged 29 commits into from
Oct 14, 2024

Conversation

frederik-sandfort1
Copy link
Collaborator

@frederik-sandfort1 frederik-sandfort1 commented Aug 20, 2024

Closes #66 and #61 .

Additionally implements a (jsonable) DescriptorsFilter.

Also did some code cleaning and removed unnecessary lines of code without a breaking change

Copy link
Collaborator

@c-w-feldmann c-w-feldmann left a comment

Choose a reason for hiding this comment

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

This was my first round reading. Will check again tomorrow in more detail.

molpipeline/abstract_pipeline_elements/mol2mol/filter.py Outdated Show resolved Hide resolved
molpipeline/abstract_pipeline_elements/mol2mol/filter.py Outdated Show resolved Hide resolved
molpipeline/mol2mol/filter.py Outdated Show resolved Hide resolved
molpipeline/mol2mol/filter.py Outdated Show resolved Hide resolved
molpipeline/mol2mol/filter.py Show resolved Hide resolved
molpipeline/mol2mol/filter.py Outdated Show resolved Hide resolved
tests/test_elements/test_mol2mol/test_mol2mol_filter.py Outdated Show resolved Hide resolved
molpipeline/mol2mol/filter.py Outdated Show resolved Hide resolved
molpipeline/mol2mol/filter.py Outdated Show resolved Hide resolved
@c-w-feldmann c-w-feldmann self-requested a review August 22, 2024 11:43
@frederik-sandfort1 frederik-sandfort1 marked this pull request as draft August 22, 2024 12:55
@frederik-sandfort1 frederik-sandfort1 marked this pull request as ready for review August 22, 2024 15:19
@frederik-sandfort1
Copy link
Collaborator Author

@c-w-feldmann @JochenSiegWork

I have one mypy issue, which I do not understand.

Also three questions:

  • should we combine smarts and smiles filter within a single class? option usesmiles?
  • should we check the input patterns for valid smarts/smiles?
  • should we apply the same logic to ElementFilter?

@c-w-feldmann

This comment was marked as resolved.

Copy link
Collaborator

@c-w-feldmann c-w-feldmann left a comment

Choose a reason for hiding this comment

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

I think my head is exploding, but beside the small additions in the doc string, nothing I can complain about. @JochenSiegWork , your turn.

Copy link
Collaborator

@JochenSiegWork JochenSiegWork left a comment

Choose a reason for hiding this comment

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

almost there :)

molpipeline/abstract_pipeline_elements/mol2mol/filter.py Outdated Show resolved Hide resolved
molpipeline/abstract_pipeline_elements/mol2mol/filter.py Outdated Show resolved Hide resolved
molpipeline/abstract_pipeline_elements/mol2mol/filter.py Outdated Show resolved Hide resolved
molpipeline/utils/value_conversions.py Outdated Show resolved Hide resolved
molpipeline/mol2mol/filter.py Outdated Show resolved Hide resolved
molpipeline/mol2mol/filter.py Outdated Show resolved Hide resolved
molpipeline/mol2mol/filter.py Outdated Show resolved Hide resolved
tests/test_elements/test_mol2mol/test_mol2mol_filter.py Outdated Show resolved Hide resolved
tests/test_elements/test_mol2mol/test_mol2mol_filter.py Outdated Show resolved Hide resolved
Copy link
Collaborator Author

@frederik-sandfort1 frederik-sandfort1 left a comment

Choose a reason for hiding this comment

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

Resolved most, and some comments. Please have a look

molpipeline/abstract_pipeline_elements/mol2mol/filter.py Outdated Show resolved Hide resolved
molpipeline/abstract_pipeline_elements/mol2mol/filter.py Outdated Show resolved Hide resolved
molpipeline/abstract_pipeline_elements/mol2mol/filter.py Outdated Show resolved Hide resolved
molpipeline/abstract_pipeline_elements/mol2mol/filter.py Outdated Show resolved Hide resolved
molpipeline/mol2mol/filter.py Outdated Show resolved Hide resolved
molpipeline/utils/value_conversions.py Outdated Show resolved Hide resolved
tests/test_elements/test_mol2mol/test_mol2mol_filter.py Outdated Show resolved Hide resolved
tests/test_elements/test_mol2mol/test_mol2mol_filter.py Outdated Show resolved Hide resolved
@frederik-sandfort1
Copy link
Collaborator Author

@c-w-feldmann @JochenSiegWork I added an additional filter (ComplexFilter) which can be initiatied with multiple moltomol elements and uses the keep matches logic

I also had a look on auto2mol - I was a bit puzzled about serializability (there you also just set the elements as attributes, no get_params / set_params functionality given. Please have a look on the implementation especially regarding serializability

Copy link
Collaborator

@JochenSiegWork JochenSiegWork left a comment

Choose a reason for hiding this comment

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

just two small comments

molpipeline/utils/value_conversions.py Outdated Show resolved Hide resolved
molpipeline/abstract_pipeline_elements/mol2mol/filter.py Outdated Show resolved Hide resolved
molpipeline/abstract_pipeline_elements/mol2mol/filter.py Outdated Show resolved Hide resolved
molpipeline/utils/value_conversions.py Outdated Show resolved Hide resolved
molpipeline/abstract_pipeline_elements/mol2mol/filter.py Outdated Show resolved Hide resolved
@JochenSiegWork
Copy link
Collaborator

JochenSiegWork commented Sep 12, 2024

@c-w-feldmann @JochenSiegWork

I have one mypy issue, which I do not understand.

Also three questions:

  • should we combine smarts and smiles filter within a single class? option usesmiles?

Strong yes. I think we should combine SMARTS and SMILES filter within a single class, because every SMILES is a valid SMARTS. Effectively a list of SMILES is a list of SMARTS.

  • should we check the input patterns for valid smarts/smiles?

No. But since you pre-compute the molecules for the SMARTS/SMILES now this is done automatically during the construction of the filter. So you already included this feature now.

  • should we apply the same logic to ElementFilter?

We talked about this. We can in the future because it should fit but we don't have any real use case right now. So postpone.

molpipeline/abstract_pipeline_elements/mol2mol/filter.py Outdated Show resolved Hide resolved
molpipeline/mol2mol/filter.py Outdated Show resolved Hide resolved
molpipeline/mol2mol/filter.py Show resolved Hide resolved
molpipeline/utils/value_conversions.py Outdated Show resolved Hide resolved
molpipeline/mol2mol/filter.py Outdated Show resolved Hide resolved
molpipeline/abstract_pipeline_elements/mol2mol/filter.py Outdated Show resolved Hide resolved
molpipeline/abstract_pipeline_elements/mol2mol/filter.py Outdated Show resolved Hide resolved
molpipeline/abstract_pipeline_elements/mol2mol/filter.py Outdated Show resolved Hide resolved
molpipeline/mol2mol/filter.py Outdated Show resolved Hide resolved
molpipeline/mol2mol/filter.py Outdated Show resolved Hide resolved
molpipeline/mol2mol/filter.py Show resolved Hide resolved
tests/test_elements/test_mol2mol/test_mol2mol_filter.py Outdated Show resolved Hide resolved
tests/test_elements/test_mol2mol/test_mol2mol_filter.py Outdated Show resolved Hide resolved
@c-w-feldmann
Copy link
Collaborator

c-w-feldmann commented Sep 30, 2024

@frederik-sandfort1

  • smiles filter within a single class? option usesmiles?

I would prefer to keep them in separate classes.

  • should we check the input patterns for valid smarts/smiles?

Yes, we should check the input, and raise an Error of the mol-object is None.

  • should we apply the same logic to ElementFilter?

What would be an invalid element? Or do you mean the same filterlogic? I think if it was possible to filer element with the code from the BaseFilter, we should do it.

@c-w-feldmann
Copy link
Collaborator

@c-w-feldmann @JochenSiegWork
I have one mypy issue, which I do not understand.
Also three questions:

  • should we combine smarts and smiles filter within a single class? option usesmiles?

Strong yes. I think we should combine SMARTS and SMILES filter within a single class, because every SMILES is a valid SMARTS. Effectively a list of SMILES is a list of SMARTS.

  • should we check the input patterns for valid smarts/smiles?

No. But since you pre-compute the molecules for the SMARTS/SMILES now this is done automatically during the construction of the filter. So you already included this feature now.

  • should we apply the same logic to ElementFilter?

We talked about this. We can in the future because it should fit but we don't have any real use case right now. So postpone.

I love that I gave completely different answers than Jochen :D
Maybe we need to sit together and have a chat.

Copy link
Collaborator

@c-w-feldmann c-w-feldmann left a comment

Choose a reason for hiding this comment

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

Looks good to me. @JochenSiegWork, your turn :)

Copy link
Collaborator

@JochenSiegWork JochenSiegWork left a comment

Choose a reason for hiding this comment

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

let's merge!

@frederik-sandfort1 frederik-sandfort1 merged commit 4d7ff8d into main Oct 14, 2024
14 checks passed
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.

Smarts filter
3 participants