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

Implementation of SugarSelection #4790

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
Prev Previous commit
Next Next commit
Update selection.py
talagayev authored Nov 14, 2024
commit 9b5042831f37e696df08c02e47ad848cb312c167
2 changes: 1 addition & 1 deletion package/MDAnalysis/core/selection.py
Original file line number Diff line number Diff line change
@@ -1065,7 +1065,7 @@
Abbreviations for PDB, CHARMM and GLYCAM
https://glycam.org/docs/othertoolsservice/2016/06/09/3d-snfg-list-of-residue-names/index.html

* manually added aglycans 'ROH', 'OME', 'TBT'
* manually added aglycans 'ROH', 'OME', 'TBT'
from GLYCAM-Web generated files.
"""
token = 'sugar'
@@ -1295,14 +1295,14 @@
}

def _apply(self, group):
resname_attr = group.universe._topology.resnames

Check warning on line 1298 in package/MDAnalysis/core/selection.py

Codecov / codecov/patch

package/MDAnalysis/core/selection.py#L1298

Added line #L1298 was not covered by tests
# which values in resname attr are in sugar_res?
matches = [ix for (nm, ix) in resname_attr.namedict.items()

Check warning on line 1300 in package/MDAnalysis/core/selection.py

Codecov / codecov/patch

package/MDAnalysis/core/selection.py#L1300

Added line #L1300 was not covered by tests
if nm in self.sugar_res]
# index of each atom's resname
nmidx = resname_attr.nmidx[group.resindices]

Check warning on line 1303 in package/MDAnalysis/core/selection.py

Codecov / codecov/patch

package/MDAnalysis/core/selection.py#L1303

Added line #L1303 was not covered by tests
# intersect atom's resname index and matches to sugar_res
return group[np.isin(nmidx, matches)]

Check warning on line 1305 in package/MDAnalysis/core/selection.py

Codecov / codecov/patch

package/MDAnalysis/core/selection.py#L1305

Added line #L1305 was not covered by tests