Opened 8 years ago

Closed 4 years ago

#1011 closed defect (fixed)

atomspec should not include bonds with only one end specified

Reported by: Elaine Meng Owned by: pett
Priority: major Milestone:
Component: Command Line Version:
Keywords: Cc: pett, Tom Goddard
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

It may be because my specification has a negation (~):

sel C & ~ @@idatm_type=Car

... is supposed to select all non-aromatic carbon atoms, which it does, but it also selects bonds between aromatic and non-aromatic carbon atoms. At first I thought it was an error in atom type, but now I see that the set of atoms selected is actually correct, just an overzealous additional selection of bonds. To be more specific, the command above selects CB-CG bonds in Phe and Tyr, where the CB is not aromatic but CG is aromatic. Reassign as appropriate.

Change History (14)

comment:1 by Tom Goddard, 8 years ago

Cc: Tom Goddard added
Owner: changed from Tom Goddard to Elaine Meng

I agree the result is not the best, but it is behaving as expected. Specifier C includes all carbon atoms and bonds between carbons, @@idatm_type=Car includes all Car atoms (and no bonds) and ~@@idatm_type=Car adds the intra-bonds to the Car atoms and inverts the result giving all non-Car atoms and all bonds that are not between two Car atoms. Then the intersection "&" includes all bonds that are between C and not between two Car atoms.

So how should the atom spec rules work to get a better result? This case is similar to bug #1009 where ~/a includes the molecular surface of chain A (because /a does not specify the molecular surface of /a so ~/a includes it). In both bugs a basic problem is that the invert operator "~" is acting on only atoms and it is including other stuff (e.g. molecular surfaces, bonds, volumes, BILD models, ...). Maybe ~ acting on an atoms only specifier should produce just atoms. This isn't going to be quite what we want. For instance selector C includes both carbon atoms and inter-carbon bonds so ~C includes all bonds not between two carbons. I think probably the intent is that it include all bonds between non-carbons.

The basic questions are how should implied bonds be handle in atom specs, and how should the invert "~" operator work.

I don't know the answer, nor am I too excited by the question, so I'm reassigning to Elaine to define the precise atom spec rules. Then either Conrad or I can implement them.

in reply to:  2 ; comment:2 by Elaine Meng, 8 years ago

My suggestion (which was how I thought it worked until these recent surprises):

(1) blank atomspec is still “all”, all applicable types of models.  By applicable I mean the command handles that kind of model.  If it doesn’t, then ignore that kind of model.

(2) evaluate nonblank atomspec as atoms only unless nonatomic model is specified by model number.  Nonatomic model could be molecular surface, volume model, pseudobond model, etc.

(3) propagate from the set of atoms to:
- all bonds with both end atoms specified
- all pseudobonds with both end atoms specified
- all molecular surface patches for those atoms

in reply to:  3 ; comment:3 by goddard@…, 8 years ago

What if I hand select some atoms and bonds:  For instance ctrl-click a residue, then up arrow.  Now which bonds does ~sel include?  In Chimera the bonds from neighboring residues to the originally selected residue are not part of sel, but they are also not part of ~sel (in ChimeraX they are part of ~sel currently).  So is the rule that the invert operator ~ simply pretends no bonds are selected?  This is one unclear case, what do do with ~ when the specifier being inverted includes atoms and bonds and pseudobonds.

Cases of pseudobonds may be different.  What if I select a few hbonds and no atoms, then what is in ~sel?  Probably don’t want to ignore the pseudobonds.

Another unclear case is “select ~/a” when there is a volume open.  Does it select the volume?  In Chimera 1 it does.  Maybe that is not the best behavior.  Usually when you use ~(some atoms) you mean just to invert just among atoms.

Your rule 2 Elaine says “specified by model number”.  I think the rules can’t depend on the actual textual form of the atom spec.  I can specify models without using a model number, for instance by using a selector or a named selection or simple “sel", or possibly other ways yet to be invented.  So the rules for how the invert operator ~ works need to only depend on what atoms, bonds and models are to be inverted — they can’t depend on how those atoms/bonds/models were specified in text because the possibilities for how text produces the atoms/bonds/models are endless.

I suggest you reassign this ticket to Conrad unless you want to work on it further.  He is the guru of atom-spec.  I think I was initially assigned this because I added independently selected bonds which created some of these problems.  But I don’t want to take on the problem of how atom specs behave.

in reply to:  4 ; comment:4 by Elaine Meng, 8 years ago

OK, let’s limit this ticket to to the bonds behavior rather than making it the omnibus of all things atomspec.  Still, as with any ticket I submit, reassign if it seems appropriate.

I would revise rule #2 from "specified by model number” to “specified directly” (not by negation ~).  Parts of a nonblank spec that specify nonatomic things directly are interpreted directly, and any other parts (which could be the whole spec and could include negation ~) are interpreted solely as atoms.  After that, the set of atoms is expanded to bonds and pseudobonds with both ends specified.

I would vote to process inversions within an atomic model as a set of atoms only and add the bonds/pbonds with both ends in the result.  I am agnostic as to whether the multi-model inversion (or negation of the current selection) should select other kinds of models. You may want to weigh in on that even if you don’t change anything yourself, as it would include the volume models.

comment:5 by Tom Goddard, 8 years ago

Owner: changed from Elaine Meng to Conrad Huang

Elaine and Conrad can figure out atomspec behaviors with bonds, inversion, and non-atomic models.

comment:6 by Elaine Meng, 8 years ago

I see the comments by email are annoying in the web page (don't wrap), so I'll try to enter something more succinct directly:

Unless specified/selected directly, bonds, pseudobonds, and molecular surface patches are only specified/selected as a side effect of specifying/selecting the corresponding atoms, evaluated after any and/or/not operations (May also apply to other atom-subsidiary models like atom labels.)

I don't feel strongly about what should happen to other models like graphical objects and density maps.

I d

comment:7 by Elaine Meng, 8 years ago

Related to ticket #1009 molecular surface not included in command-line specifiers of corresponding atoms (protein, nucleic, many others)

in reply to:  8 ; comment:8 by goddard@…, 8 years ago

Elaine, your suggestions keep ignoring an important constraint that the rules for operators like invert “~" (probably) cannot depend on how the atoms / bonds / pseudobonds / other models are specified.  When you say "Unless specified/selected directly…” you want the result to depend on how the objects were specified and the operators have no idea how something was specified (directly, indirectly, …).  The rules need to say given that these atoms / bonds / pseudobonds / other models were specified (in any manner), here is what the invert “~” operator should do.  I’ll let you and Conrad work out what those rules are.  I’m slightly interested in the rules, like if you say ~#1 just select everything or nothing when #1 is a volume, well I think that would be very unexpected weird behavior.  So if you make rules that only work well for atomic models it seems like a mistake to me.  But I think that is obvious, and trust you will come up with the best that can be done.


comment:9 by Conrad Huang, 6 years ago

Status: assignedfeedback

Bonds are a rather special case, in that they are added implicitly (inferred from selected atoms) rather than explicitly (mentioned in specifiers). Perhaps we are too aggressive (early) in when we add bonds? Should we change the behavior (particularly inversion selectors and ~select command) so that we recalculate the list of implicitly selected bonds after all the explicit atom selections are done?

comment:10 by pett, 6 years ago

Seems like it might work.

comment:11 by Elaine Meng, 5 years ago

Status: feedbackaccepted
Summary: atomspec should not include bonds with only end specifiedatomspec should not include bonds with only one end specified

Would it be difficult to implement what Conrad said in comment 9? My feedback is that that sounds like it would do the trick.

comment:12 by Elaine Meng, 5 years ago

Owner: changed from Conrad Huang to pett
Status: acceptedassigned

comment:13 by pett, 5 years ago

Status: assignedaccepted

comment:14 by pett, 4 years ago

Cc: Conrad Huang removed
Resolution: fixed
Status: acceptedclosed

Changed the behavior of the '~' operator and the ~sel command to remove bonds/pseudobonds without both endpoint atoms selected. Code change

Note: See TracTickets for help on using tickets.