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

Create selectors for 'altloc' and the other various AG fields #105

Open
lgsmith opened this issue Apr 12, 2023 · 6 comments
Open

Create selectors for 'altloc' and the other various AG fields #105

lgsmith opened this issue Apr 12, 2023 · 6 comments

Comments

@lgsmith
Copy link
Contributor

lgsmith commented Apr 12, 2023

Is your feature request related to a problem? Please describe

I often run into situations where I need to break up an AG into alt-loc sets, and one can't select on these. There may be other fields from PDBs or other source files that also don't have a selector in the selection langauge (for example, does B-factor?). It seemed natural to assume that if loos provided a field as metadata, then I could select on that metadata, but that's not how it works at present.

Describe the solution you'd like

I want an expansion to the selection language to include all the fields.

Describe alternatives you've considered

I currently write for loops over atoms within an AG and write conditional tests to filter things I need from fields the selection language doesn't index (specifically, for me, altloc).

Additional context

Nothing other than to say I'm not sure how many other metadata fields there are that are missing a selector, but they should probably all get checked.

@agrossfield
Copy link
Member

This probably isn't happening any time soon. The selection parsing code is very brittle and hard to change, for reasons @tromo could explain better, and loos is really intended to focus on simulations rather than general structure analysis.

For what it's worth, though, the performance should be only trivially different for a manual loop vs. selection, since that's what selection does. If the loop really needs to be in C++, there are code examples of how to do this (look in KernelActions.hpp)

@lgsmith
Copy link
Contributor Author

lgsmith commented Apr 12, 2023 via email

@agrossfield
Copy link
Member

Replacing the selection language code is on the TODO list, but that too is a lot of work for very little impact, so it's far down the list.

@agrossfield
Copy link
Member

Maybe I'm missing something, but your problem also strikes me as a failure to use the "curate once, use multiple times". If you're picking out the most populated side chain configuration, that's a do-once kind of thing -- write a script to do it, write it out, and thereafter use that.

As I think about it, your particular problem doesn't lend itself to the selection language anyway, since you're not just eg picking out atoms with occupancy above a certain threshold or b-factor below a threshold (and recall by design the selection language operates 1 atoms at a time).

@tromo
Copy link
Contributor

tromo commented Apr 13, 2023

I agree completely...I've been itching to replace the lex/yacc code with something like ANTLR, but it'll probably take a sabbatical to actually get it done.

@lgsmith
Copy link
Contributor Author

lgsmith commented Apr 19, 2023

If a user is using a python script to compare say an RMSD to a crystal structure that has altlocs in the selection sub-structure, they'll get a length error for the atomic group. This might take more naive users longer to diagnose than it did me because they'll need to realize that altloc atoms, by virtue of not being selectable, are indistinguishable from the atoms they are trying to select using the selection string, and therefore will get grouped with the AG they make to do the RMSD calculation regardless of how they troubleshoot the selection string.

What if we update the length mismatch error message with a phrase that says something like 'make sure you checked your reference structure for altloc atoms' or similar. Alternatively, when a PDB is read that has altlocs in it a warning could be printed that says something like 'You are using a structure with atoms in alternative locations (Atom.altLoc() to access). Selections comparing atoms in this group to analogous groups from simulations are unlikely to have the same number of atoms in them by default, even if you believe them to be chemically identical.'

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

No branches or pull requests

3 participants