[Pmv] even more on 'How to select some sugar atoms'

Ruth Huey rhuey at scripps.edu
Mon Apr 24 16:31:01 PDT 2006

String selection in Pmv is based on matching a particular selection 
string such as 'O.*' to properties (usually names) of entities 
(molecules, chains, residues or atoms)  in the viewer.

String selection in Pmv is based on the python regular expression 
module, *re*.  The re module uses a number of special characters for 
wildcards.  For example,   '*' matches to 0 or more repetitions of the 
preceding character while '.' matches any character (except a newline).  
Thus, 'O.' matches any 2-character name starting with an 'O' and 'O.*' 
matches any length name which starts with an 'O'.   Pmv supports '*' and 
'.'  special characters. 

As Sargis pointed out, Pmv supports a broader use of  '*' as a wildcard 
which matches anything by always inserting a '.' before '*'  Entering 
"O*" for the Atom level in the SelectFromString GUI will result in 
selecting all the atoms in the viewer whose name starts with O including 
names as 'O', 'O1P',  'O5*', 'O4*', 'O2', 'O3*', 'O1P', 'O2P', 'O5*', 
'O4*', 'O6' etc... Entering "O." for the Atom level will result in 
selecting all the atoms in the viewer with 2-character long names which 
start with an 'O' such as 'O2', 'O6', 'O1', 'O5'

In the next bug-fix release of Pmv, "escape characters" will add yet 
another level of complexity to all this:
The re module provides an escape character '\' to let the user construct 
matches to strings which include these 'special' characters.  Using '\' 
it is possible select all the oxygen atoms whose name contains '*' (for 
example, those in a ribose ring) with a string like this: "O.\*" 

In that release, you will be able to do this by changing the 
'selectStringMatchMode' from 'caseSensitive' to 
'caseInsensWithEscapedChars' via  File->Preferences->Modify Defaults. 
Alternatively, you will be able to select the sugar atoms by typing 
something this into the python shell: 
mv.select(mv.allAtoms.get("O.\*", escapeCharacters=True, 

Feedback is always welcome!




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mgldev.scripps.edu/pipermail/pmv/attachments/20060424/ef4d91be/attachment.html

More information about the Pmv mailing list