Skip to content
Snippets Groups Projects
Commit e0094c05 authored by Studer Gabriel's avatar Studer Gabriel
Browse files

Use structure loading functionality from PM3ArgumentParser

This immediately improves functionality as we can also load
gzipped stuff or cif files.
parent c05f9ea9
Branches
Tags
No related merge requests found
...@@ -123,19 +123,25 @@ You can (re-)construct the sidechains in a model from the command line. ...@@ -123,19 +123,25 @@ You can (re-)construct the sidechains in a model from the command line.
.. code-block:: console .. code-block:: console
$ pm build-sidechains [-h] [-o <FILENAME>] [-k] [-n] [-r] in_file $ usage: build-sidechains [-h] (-p <FILE> | -e <FILE>) [-o <FILENAME>] [-k]
[-n] [-r]
Example usage: Example usage:
.. code-block:: console .. code-block:: console
$ pm build-sidechains input.pdb $ pm build-sidechains -p input.pdb
This reads a structure stored in in.pdb, strips all sidechains, This reads a structure stored in in.pdb, strips all sidechains,
detects and models disulfid bonds and reconstructs all sidechains with the detects and models disulfid bonds and reconstructs all sidechains with the
flexible rotamer model. The result is stored as :file:`out.pdb`. flexible rotamer model. The result is stored as :file:`out.pdb`.
The output filename can be controlled with the ``-o`` flag. The output filename can be controlled with the ``-o`` flag.
A structure can be provided in PDB (``-p``) or in any format readable by the
:func:`ost.io.LoadEntity` method (``-e``). In the latter case, the format is
chosen by file ending. Recognized File Extensions: ``.ent``, ``.pdb``,
``.ent.gz``, ``.pdb.gz``, ``.cif``, ``.cif.gz``.
Several flags control the modelling behaviour: Several flags control the modelling behaviour:
.. option:: -k, --keep-sidechains .. option:: -k, --keep-sidechains
......
...@@ -20,20 +20,16 @@ ost.PushVerbosityLevel(2) ...@@ -20,20 +20,16 @@ ost.PushVerbosityLevel(2)
# parse command line # parse command line
parser = pm3argparse.PM3ArgumentParser(__doc__, action=True) parser = pm3argparse.PM3ArgumentParser(__doc__, action=True)
parser.add_argument('in_file', type=str, help='File to load coordinates ' + parser.AddStructure()
'(PDB format)') parser.AssembleParser()
parser.add_argument('-o', '--out-file', metavar='<FILENAME>', type=str, parser.add_argument('-o', '--out-file', metavar='<FILENAME>', type=str,
default='out.pdb', help='File to store coordinates ' + default='out.pdb', help='File to store coordinates ' +
'(default: %(default)s)') '(default: %(default)s)')
parser.add_argument('-k', '--keep-sidechains', action='store_true', parser.add_argument('-k', '--keep-sidechains', action='store_true',
help='Keep existing sidechains') help='Keep existing sidechains')
parser.add_argument('-n', '--no-disulfids', action='store_true', parser.add_argument('-n', '--no-disulfids', action='store_true',
help='Do not build disulfid bonds before sidechain ' + help='Do not build disulfid bonds before sidechain ' +
'optimization') 'optimization')
parser.add_argument('-r', '--rigid-rotamers', action='store_true', parser.add_argument('-r', '--rigid-rotamers', action='store_true',
help='Do not use rotamers with subrotamers') help='Do not use rotamers with subrotamers')
...@@ -41,10 +37,10 @@ opts = parser.Parse() ...@@ -41,10 +37,10 @@ opts = parser.Parse()
ost.PushVerbosityLevel(3) ost.PushVerbosityLevel(3)
if not os.path.isfile(opts.in_file): if len(opts.structures) != 1:
helper.MsgErrorAndExit("Failed to load input file '%s'." % opts.in_file, 4) helper.MsgErrorAndExit("Expect exactly one input structure", 4)
prot = io.LoadPDB(opts.in_file) prot = opts.structures[0]
rotamer_model = "frm" rotamer_model = "frm"
if opts.rigid_rotamers: if opts.rigid_rotamers:
rotamer_model = "rrm" rotamer_model = "rrm"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment