/usr/share/pdb2pqr/extensions/template is in pdb2pqr 2.1.1+dfsg-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | """
Extensions Template
A template for creating new post-processing scripts. Please see the
PDB2PQR Programmer Guide for more information.
Author: Todd Dolinsky
"""
__date__ = "17 February 2006" # Date
__author__ = "Todd Dolinsky" # Author
from src.utilities import * # Functions from utilities.py
from src.routines import * # Functions from routines.py
def usage():
"""
A small function that will be added to the overall PDB2PQR
usage. Note that the root of the file name (in this case template.py)
becomes the command line option.
ex. chi.py will add the --chi command line option.
Returns a string describing the usage for this function.
This will be used for help text for command line option for this function.
Defining this function is optional.
"""
str = "Put usage here"
return str
def addExtensionOptions(extensionGroup):
"""
Add options specific to this extension to the option parser.
This function is optional.
extensionGroup: A link to the OptionParser group object for extension
options. See the Python OptionParser documentation.
Option names must not conflict with other option names.
"""
extensionGroup.add_option('--Ni', dest='Ni', action='store_true', default=False,
help='Include N atoms in template output')
extensionGroup.add_option('--Ox', dest='Ox', action='store_true', default=False,
help='Include O atoms in template output')
def run_extension(routines, outroot, options):
"""
The main function. This will be called after all other PDB2PQR
activity has been completed. There are two useful parameters
that must be passed into the function.
This functions is required.
Parameters
routines: A link to the routines object The routines object
contains both protein (routines.protein) and links
to the majority of functions necessary to use the
PDB2PQR API.
outroot: A string containing the root of the output name. If
you want to return information to stdout this can be
ignored (although it must still be present) - otherwise
this can be used to output the desired data to a file.
The root contains whatever the desired PQR file name is
before the period, so "out.pqr" will have "out", and
"example" will just return "example". For other
extension scripts we have appended the function name
to the outroot.
options: A options parser like class containing additional options
created for this extension by the optional addExtensionOptions
function.
"""
outname = outroot + ".template"
file = open(outname, "w")
protein = routines.protein
# For example, let's write all the CA atoms in the protein to the file
for atom in protein.getAtoms():
if atom.name == "CA": file.write(atom)
file.close()
|