make a new custom selector #97
Replies: 11 comments 3 replies
-
Summoning @tromo. I think you’d want to mimic HydrogenSelector. |
Beta Was this translation helpful? Give feedback.
-
That is what I was thinking too. I just don't see how to copy that so that I have some particular selection I can call from within a selection string. I can't seem to find where the selection strings are parsed, so that I can make a new name for one. |
Beta Was this translation helpful? Give feedback.
-
This is non-trivial, and you may find that the generated files from a modern flex/bison simply wont work. What you will need to do is:
|
Beta Was this translation helpful? Give feedback.
-
As a first pass, I suggest implementing it in python -- use a function with selection strings to test the strings and make sure everything works. Once you have all of that sorted, you can move on to trying to get it into the grammar. |
Beta Was this translation helpful? Give feedback.
-
Wait is the flex/bison not regenerated whenever you rebuild? Also, if not...and it doesn't work...shouldn't we fix that? I'm trying to implement this as a selection string and it's taking forever. I suppose I can write something in python logic that does a bunch of testing on atom properties and connectivity... |
Beta Was this translation helpful? Give feedback.
-
I know I can just save things in text files, but I kind of wanted to offer
people a way to select things without the headache, and I didn't want to
distribute data with my PR (though I know sometimes that's necessary). It
just seemed really graceful to be able to say `resid < 214 &&
polar_hydrogen`. We talk about wanting to have programs that read
conceptually, and I guess that seemed like the right concept to me.
…On Tue, Nov 22, 2022 at 10:26 PM Tod Romo ***@***.***> wrote:
We also decided that it was unlikely that someone would want to muck
around with the parser, so not generating the files each time made for a
[slightly] simpler build.
As far as performance goes, the parser was never meant to be particularly
performant. Internally, it uses a simple stack-based machine and compiles a
program representing the selection string (called a "kernel") which gets
used by a selector (KernelSelector()) to actually do the selecting. If
your selection is invariant over a trajectory, then none of this matters
since you select what atoms you want to work with at the start and then
they all get updated through the magic of pAtom. If you need to reselect
per frame, then you're going to want to do it programmatically.
FWIW, If you're using a shell script, you can always do something like,
loos_command -s "( $(cat selection_one) ) & ( $(cat selection_two) )" foo
bar
—
Reply to this email directly, view it on GitHub
<#97 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABAZVYINE4HVANO5JWEJ2QLWJWFG7ANCNFSM6AAAAAASIKVFGY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
My other issue with something like “polar_hydrogen” is that doing it right requires loos to learn chemistry, which I’ve strongly resisted having it do (my premise the programs should be either brilliant or stupid, because smart just gets you into trouble). |
Beta Was this translation helpful? Give feedback.
-
How else do we track hydrogen bonds across a large selection?
…On Wed, Nov 23, 2022 at 6:50 AM Grossfield Lab ***@***.***> wrote:
My other issue with something like “polar_hydrogen” is that doing it
*right* requires loos to learn chemistry, which I’ve strongly resisted
having it do (my premise the programs should be either brilliant or stupid,
because smart just gets you into trouble).
—
Reply to this email directly, view it on GitHub
<#97 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABAZVYJZEAGGDL7FV3UMFETWJYAJBANCNFSM6AAAAAASIKVFGY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Right now, you have to identify the potential donors and acceptors yourself. You could guess programmatically (eg all hydrogens bound to something other than carbon are donors, but I’m sure there are lots of exceptions)
Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
FWIW, I think the way I'd approach this is to write a function that picks out the polar hydrogens by whatever criteria you want. You could add a command line flag that says only use polar hydrogens. Your selection then is two stage: first use |
Beta Was this translation helpful? Give feedback.
-
I’d settled on this as well. That way if others want it they can call it.
…On Wed, Nov 23, 2022 at 11:48 AM Tod Romo ***@***.***> wrote:
FWIW, I think the way I'd approach this is to write a function that picks
out the polar hydrogens by whatever criteria you want. You could add a
command line flag that says only use polar hydrogens. Your selection then
is two stage: first use selectAtoms() and then call your function (if
requested). That way you can consider as many atoms as you want, or also
make it sufficiently performant that you could call it every frame, if
that's what you want to do.
—
Reply to this email directly, view it on GitHub
<#97 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABAZVYL2TD4N5PCNLOTI5XDWJZDGDANCNFSM6AAAAAASIKVFGY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I'd really like to define a new built-in selector (like 'backbone' or 'hydrogen'); actually I'd like to define several. I've poked around some but I'm not seeing how to do that (though I think that editing the contents of 'selectors' might allow me to change one that already exists). I can talk about the ones I want to create (in fact I'd like to, I've begun making one as a selection string and it was pretty involved...) but knowing how to make one in the abstract seems pretty helpful.
Beta Was this translation helpful? Give feedback.
All reactions