Add some topology slicing methods.#961
Open
chrisjonesBSU wants to merge 7 commits intomosdef-hub:mainfrom
Open
Add some topology slicing methods.#961chrisjonesBSU wants to merge 7 commits intomosdef-hub:mainfrom
chrisjonesBSU wants to merge 7 commits intomosdef-hub:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #961 +/- ##
==========================================
- Coverage 93.48% 93.19% -0.29%
==========================================
Files 67 68 +1
Lines 7785 7837 +52
==========================================
+ Hits 7278 7304 +26
- Misses 507 533 +26 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
for more information, see https://pre-commit.ci
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.
PR Summary:
This is ultimately an effort to help out @JAGarcia03 with his project, but it should be a useful addition in general.
utils.pygets new slicing methods where the goal is to create a new topology object that contains a subset of another topology's molecules or residues. This should live inutils.pyas we have been wanting to reduce the amount of methods and code in general withinTopology, and this file will be a good place to add other, more creative slicing methods.This also adds the ability to filter by number in addition to tag within
iter_sites_by_moleculeanditer_sites_by_residue.For example, if you want to get just the sites belonging to the 0th "Benzene" (instead of all of them) you can now do:
for site in topology.iter_sites_by_molecule(molecule_tag="Benzene", molecule_number=0)A quick example:
I still need to make the slicing tests more thorough, and add new tests for the changes to
iter_sites_by_*PR Checklist