Opened 7 years ago

Closed 7 years ago

#1375 closed defect (fixed)

implement wildcarding for atom specs

Reported by: pett Owned by: Conrad Huang
Priority: blocker Milestone:
Component: Command Line Version:
Keywords: Cc: Elaine Meng
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

As per: https://www.rbvi.ucsf.edu/trac/ChimeraX/wiki/2018-10-22

(basically globbing throughout, though in attribute tests only if '~' is the operator. Also, '='/'~' as the operators do case insensitive matching, where as '=='/'' do case sensitive)

Change History (11)

comment:1 by pett, 7 years ago

Cc: Elaine Meng added

comment:2 by Conrad Huang, 7 years ago

Initial implementation is in the daily build. Leaving ticket open for a while in case there are issues.

in reply to:  3 ; comment:3 by Elaine Meng, 7 years ago

Is this just for residue names and atom names?  In Chimera we also had some special stuff for ranges, something like the words start or end or * to mean either one of those (if it were at the start or end of the range specification, respectively).

in reply to:  4 ; comment:4 by Conrad Huang, 7 years ago

Yes, it is strictly wildcarding for names.  In fact, for now, wildcards 
are disabled if you have a range, mainly because I couldn't think of a 
rational way of combining wildcards and ranges.  So, for example, @c*-cz 
will interpret "c*" as the literal string rather than as a wildcard.

Our old interpretation of @cb-* was retired for ChimeraX in a long-ago 
discussion.  It is more difficult to implement in ChimeraX than in 
Chimera because of the way the data structures are designed.  I think 
there was something about "you can just use 'sidechain'" as well.

Conrad

On 10/26/2018 9:31 AM, Elaine Meng wrote:

in reply to:  5 ; comment:5 by Elaine Meng, 7 years ago

I agree we don’t need ranges of names.  However, I was referring to numerical ranges, for which I think we should have wildcards for start and end  (one often does not know the first or last residue number).   It can be a separate ticket, though. Let me know if I should make one.

in reply to:  6 ; comment:6 by Conrad Huang, 7 years ago

It might be ugly to implement, but is the proposal that a lone "*" as 
either start or end of a residue range is interpreted as "first" or 
"last" residue in a chain?

If so, can you please make another ticket?
   Thanks.


Conrad

On 10/26/2018 12:48 PM, Elaine Meng wrote:

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

OK, the ticket for numerical ranges is #1388.  As mentioned in that ticket, I’m OK with using words instead of asterisk.  Just want the convenience of not having to look up the first and last residue number in a structure.

comment:8 by Conrad Huang, 7 years ago

Removed ~, ~~, !~ and !~~ operators. =, ==, != and !== now use simple compare or glob matching depending on the absence or presence of wildcard characters in the user-entered value.

At our meeting, we agreed to use backslash as the escape character. However, I looked at the documentation for fnmatch, the Python module we use for glob matching, and it has its own way for escaping characters: "For a literal match, wrap the meta-characters in brackets. For example, '[?]' matches the character '?'.". Should we use that instead?

in reply to:  9 ; comment:9 by Elaine Meng, 7 years ago

My 2 cents’ is that  \ is easier to type and seems more familiar as an escape character, but maybe there are other factors I don’t understand (like how important it is to adhere to the module).

comment:10 by Elaine Meng, 7 years ago

Seems that we settled on the scheme, with * wildcard, ? single-char wildcard, and square brackets [ ] to indicate a set of characters to substitute individually, or to “escape” a single character that would otherwise have a special meaning, as currently documented
http://rbvi.ucsf.edu/chimerax/docs/user/commands/atomspec.html#wildcards

I.e. seems like the ticket could be closed.

comment:11 by Conrad Huang, 7 years ago

Resolution: fixed
Status: assignedclosed

Wildcard issues have been resolved here and in #1388

Note: See TracTickets for help on using tickets.