Commit bcd2e153 by peastman

Renamed one argument

parent b0f8f744
......@@ -131,9 +131,9 @@ This is the most powerful way to use PDBFixer. It allows you to script the proc
<p>
PDBFixer is based on OpenMM, and to use its Python API you should first be familiar with the OpenMM API. Consult the OpenMM documentation for details. In everything that follows, I will assume you are already familiar with OpenMM.
<p>
To use PDBFixer create a <tt>PDBFixer</tt> object, passing to its constructor a <tt>PdbStructure</tt> object containing the structure to process. You then call a series of methods on it to perform various transformations. When all the transformations are done, you can get the new structure from its <tt>topology</tt> and <tt>positions</tt> fields. The overall outline of your code will look something like this:
To use PDBFixer create a <tt>PDBFixer</tt> object, passing to its constructor the file to process. You then call a series of methods on it to perform various transformations. When all the transformations are done, you can get the new structure from its <tt>topology</tt> and <tt>positions</tt> fields. The overall outline of your code will look something like this:
<tt><pre>
fixer = PDBFixer(file=open('myfile.pdb'))
fixer = PDBFixer(filename='myfile.pdb')
# ...
# Call various methods on the PDBFixer
# ...
......@@ -213,7 +213,7 @@ Here is a complete example that ties this together. It adds all missing atoms i
<tt><pre>
from pdbfixer import PDBFixer
from simtk.openmm.app import PDBFile
fixer = PDBFixer(file=open('myfile.pdb'))
fixer = PDBFixer(filename='myfile.pdb')
fixer.findMissingResidues()
fixer.findNonstandardResidues()
fixer.replaceNonstandardResidues()
......@@ -227,7 +227,7 @@ PDBFile.writeFile(fixer.topology, fixer.positions, open('output.pdb', 'w'))
Suppose you want to keep only the first chain in the file and remove all the others. To do this, call <tt>removeChains()</tt>:
<tt><pre>
<span style="color:grey">fixer = PDBFixer(file=open('myfile.pdb'))</span>
<span style="color:grey">fixer = PDBFixer(filename='myfile.pdb')</span>
numChains = len(list(fixer.topology.chains()))
fixer.removeChains(range(1, numChains))
<span style="color:grey">fixer.findMissingResidues()</span>
......
......@@ -133,14 +133,14 @@ class PDBFixer(object):
"""PDBFixer implements many tools for fixing problems in PDB files.
"""
def __init__(self, filename=None, file=None, url=None, pdbid=None):
def __init__(self, filename=None, pdbfile=None, url=None, pdbid=None):
"""Create a new PDBFixer instance to fix problems in a PDB file.
Parameters
----------
filename : str, optional, default=None
A filename specifying the file from which the PDB file is to be read.
file : file, optional, default=None
pdbfile : file, optional, default=None
A file-like object from which the PDB file is to be read.
The file is not closed after reading.
url : str, optional, default=None
......@@ -150,7 +150,7 @@ class PDBFixer(object):
Notes
-----
Only one of structure, filename, file, url, or pdbid may be specified or an exception will be thrown.
Only one of structure, filename, pdbfile, url, or pdbid may be specified or an exception will be thrown.
Examples
--------
......@@ -160,7 +160,7 @@ class PDBFixer(object):
>>> pdbid = '1VII'
>>> url = 'http://www.rcsb.org/pdb/files/%s.pdb' % pdbid
>>> file = urlopen(url)
>>> fixer = PDBFixer(file=file)
>>> fixer = PDBFixer(pdbfile=file)
Start from a filename.
......@@ -182,17 +182,17 @@ class PDBFixer(object):
"""
# Check to make sure only one option has been specified.
if bool(filename) + bool(file) + bool(url) + bool(pdbid) != 1:
raise Exception("Exactly one option [filename, file, url, pdbid] must be specified.")
if bool(filename) + bool(pdbfile) + bool(url) + bool(pdbid) != 1:
raise Exception("Exactly one option [filename, pdbfile, url, pdbid] must be specified.")
if filename:
# A local file has been specified.
file = open(filename, 'r')
structure = PdbStructure(file)
file.close()
elif file:
elif pdbfile:
# A file-like object has been specified.
structure = PdbStructure(file)
structure = PdbStructure(pdbfile)
elif url:
# A URL has been specified.
file = urlopen(url)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment