RosettaCommons / rosetta

The Rosetta Bio-macromolecule modeling package.
https://www.rosettacommons.org
Other
116 stars 55 forks source link

Support python bitwise operators for residue selectors in PyRosetta #33

Closed klimaj closed 5 months ago

klimaj commented 6 months ago

This PR adds support for use of python bitwise operators for ResidueSelector objects in PyRosetta. Residue selectors are now able to be combined by the following PyRosetta-to-python operator symbol conversions:

Only python bitwise operators are affected, while python boolean operators and, or and not are unaffected when implemented with ResidueSelector objects.

Also thanks to @everyday847 for the original idea to override the __and__ method of residue selector objects.

klimaj commented 5 months ago

Thanks @lyskov, that's a good point -- I've now moved the unit test to src/test/T121_core.ResidueSelector.py and it's passing on the benchmark server!

ajasja commented 5 months ago

This is excellent, thanks @klimaj ! (Sorry for seeing this so late.) Too bad we can't overload the logical and, or etc, but there are good reasons why not https://peps.python.org/pep-0335/ :)