This is a read-only mirror of pymolwiki.org
Difference between revisions of "Apropos"
Jump to navigation
Jump to search
m (1 revision) |
|||
(7 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | DESCRIPTION | + | {{Infobox psico |
+ | |module = psico.helping | ||
+ | }} | ||
+ | |||
+ | '''DESCRIPTION''' | ||
"apropos" searches through the documentation of all currently defined commands and lists those commands for which the keyword is either contained in the documentation or matches the command name itself. | "apropos" searches through the documentation of all currently defined commands and lists those commands for which the keyword is either contained in the documentation or matches the command name itself. | ||
Line 5: | Line 9: | ||
If an appropriate '''DESCRIPTION''' section is provided in the documentation of the command, the first 80 characters are listed as a summary. | If an appropriate '''DESCRIPTION''' section is provided in the documentation of the command, the first 80 characters are listed as a summary. | ||
− | USAGE | + | '''INSTALLATION''' |
− | + | ||
+ | 1. copy the script bellow to a folder and name it ''apropos.py'' | ||
+ | |||
+ | 2. run it from within pymol with the '''run''' command: | ||
+ | <source lang="python"> | ||
+ | run apropos.py | ||
+ | </source> | ||
+ | |||
+ | 3. see example bellow on how to use it | ||
+ | |||
+ | '''USAGE''' | ||
+ | <source lang="python"> | ||
+ | apropos [keyword or regexp] | ||
+ | </source> | ||
− | EXAMPLE | + | '''EXAMPLE''' |
''apropos fit'' | ''apropos fit'' | ||
Line 33: | Line 50: | ||
</pre> | </pre> | ||
− | SEE ALSO | + | '''SEE ALSO''' |
grepset(www.pymolwiki.org), Python re module | grepset(www.pymolwiki.org), Python re module | ||
− | + | '''apropos.py''' | |
<source lang="python"> | <source lang="python"> | ||
+ | # | ||
+ | # apropos.py | ||
+ | # Author: Ezequiel Panepucci | ||
+ | # Date: 2006-07-20 | ||
+ | # | ||
from pymol import cmd | from pymol import cmd | ||
import re | import re | ||
Line 112: | Line 134: | ||
desc = '>>>>>>>> Ooopsie, no DESCRIPTION found for this command!!! <<<<<<' | desc = '>>>>>>>> Ooopsie, no DESCRIPTION found for this command!!! <<<<<<' | ||
else: | else: | ||
− | desc = docmatches. | + | desc = docmatches.group(1) |
matches_with_help.append( (cc, desc ) ) | matches_with_help.append( (cc, desc ) ) | ||
if len(matches_without_help) > 0: | if len(matches_without_help) > 0: | ||
− | |||
print '\n###The following commands are NOT documented.\n' | print '\n###The following commands are NOT documented.\n' | ||
for cc in matches_without_help: | for cc in matches_without_help: | ||
− | print | + | print '%*s' % (maxcclen, cc) |
if len(matches_with_help) > 0: | if len(matches_with_help) > 0: | ||
− | |||
print '\n###The following commands are documented. \'help command\' \n' | print '\n###The following commands are documented. \'help command\' \n' | ||
− | for | + | for cc,desc in matches_with_help: |
− | print | + | print '%*s : %s' % (maxcclen, cc,desc) |
cmd.extend('apropos',apropos) | cmd.extend('apropos',apropos) | ||
</source> | </source> | ||
+ | |||
+ | ''Author: Ezequiel (Zac) Panepucci'' | ||
+ | |||
+ | [[Category:Script_Library|Apropos]] | ||
+ | [[Category:UI_Scripts]] |
Latest revision as of 03:58, 4 March 2019
Included in psico | |
Module | psico.helping |
---|
DESCRIPTION
"apropos" searches through the documentation of all currently defined commands and lists those commands for which the keyword is either contained in the documentation or matches the command name itself.
If an appropriate DESCRIPTION section is provided in the documentation of the command, the first 80 characters are listed as a summary.
INSTALLATION
1. copy the script bellow to a folder and name it apropos.py
2. run it from within pymol with the run command:
run apropos.py
3. see example bellow on how to use it
USAGE
apropos [keyword or regexp]
EXAMPLE
apropos fit
###EXACT MATCH FOR: fit ==> try 'help fit' at the prompt. ###The following commands are NOT documented. vdw_fit ###The following commands are documented. 'help command' fit : "fit" superimposes the model in the first selection on to the model intra_fit : "intra_fit" fits all states of an object to an atom selection rms : "rms" computes a RMS fit between two atom selections, but does not pair_fit : "pair_fit" fits a set of atom pairs between two models. Each atom intra_rms_cur : "intra_rms_cur" calculates rms values for all states of an object commands : >>>>>>>> Ooopsie, no DESCRIPTION found for this command!!! <<<<<< zoom : "zoom" scales and translates the window and the origin to cover the intra_rms : "intra_rms" calculates rms fit values for all states of an object align : "align" performs a sequence alignment followed by a structural rms_cur : "rms_cur" computes the RMS difference between two atom fitting : "fitting" allows the superpositioning of object1 onto object2 using
SEE ALSO
grepset(www.pymolwiki.org), Python re module
apropos.py
#
# apropos.py
# Author: Ezequiel Panepucci
# Date: 2006-07-20
#
from pymol import cmd
import re
def apropos(regexp=''):
'''
DESCRIPTION
"apropos" searches through the documentation of all currently
defined commands and lists those commands for which the keyword
is either contained in the documentation or matches the command
name itself.
If an appropriate "DESCRIPTION" section is provided in the documentation
of the command, the first 80 characters are listed as a summary.
USAGE
apropos [keyword or regexp]
EXAMPLE
apropos fit
###EXACT MATCH FOR: fit ==> try 'help fit' at the prompt.
###The following commands are NOT documented.
vdw_fit
###The following commands are documented. 'help command'
fit : "fit" superimposes the model in the first selection on to the model
intra_fit : "intra_fit" fits all states of an object to an atom selection
rms : "rms" computes a RMS fit between two atom selections, but does not
pair_fit : "pair_fit" fits a set of atom pairs between two models. Each atom
intra_rms_cur : "intra_rms_cur" calculates rms values for all states of an object
commands : >>>>>>>> Ooopsie, no DESCRIPTION found for this command!!! <<<<<<
zoom : "zoom" scales and translates the window and the origin to cover the
intra_rms : "intra_rms" calculates rms fit values for all states of an object
align : "align" performs a sequence alignment followed by a structural
rms_cur : "rms_cur" computes the RMS difference between two atom
fitting : "fitting" allows the superpositioning of object1 onto object2 using
SEE ALSO
grepset(www.pymolwiki.org), Python re module
'''
cmd.set("text","1",quiet=1)
count=0
docre = re.compile(regexp, re.MULTILINE | re.IGNORECASE)
cmdre = re.compile(regexp, re.IGNORECASE)
matches_with_help = []
matches_without_help = []
maxcclen=0
for cc in cmd.keyword:
if cc == regexp:
print '\n###EXACT MATCH FOR: %s ==> try \'help %s\' at the prompt.' % (cc,cc)
doc = cmd.keyword[cc][0].__doc__
if doc == None:
if re.search(regexp, cc, re.IGNORECASE):
count += 1
matches_without_help.append(cc)
continue
if re.search(regexp, doc, re.MULTILINE | re.IGNORECASE):
count += 1
if len(cc) > maxcclen:
maxcclen = len(cc)
docmatches = re.match(r"""^\s+DESCRIPTION\s+(.{0,80})\S*""", doc, re.IGNORECASE)
if docmatches == None:
desc = '>>>>>>>> Ooopsie, no DESCRIPTION found for this command!!! <<<<<<'
else:
desc = docmatches.group(1)
matches_with_help.append( (cc, desc ) )
if len(matches_without_help) > 0:
print '\n###The following commands are NOT documented.\n'
for cc in matches_without_help:
print '%*s' % (maxcclen, cc)
if len(matches_with_help) > 0:
print '\n###The following commands are documented. \'help command\' \n'
for cc,desc in matches_with_help:
print '%*s : %s' % (maxcclen, cc,desc)
cmd.extend('apropos',apropos)
Author: Ezequiel (Zac) Panepucci