Skip to content

Commit

Permalink
Eliminated Biopython PDB Reader/Writer and Parser (#777)
Browse files Browse the repository at this point in the history
- 'permissive'=False has no effect anymore
- Added deprecation warnings for Primitive Readers/Writers and Parsers.
- Changed doc strings to eliminate references to
  BioPython Reader/Writer.
- Updated CHANGELOG to reflect changes.
  • Loading branch information
jdetle authored and orbeckst committed Apr 22, 2016
1 parent 9ce60e6 commit ecc8239
Show file tree
Hide file tree
Showing 9 changed files with 271 additions and 479 deletions.
1 change: 1 addition & 0 deletions package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Fixes

Changes

* PDB parsers/readers/writers replaced by permissive counterparts (Issue #777)
* Generalized contact analysis class added. (Issue #702)

Deprecations (Issue #599)
Expand Down
324 changes: 54 additions & 270 deletions package/MDAnalysis/coordinates/PDB.py

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions package/MDAnalysis/coordinates/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,8 @@
| | | | optional `netcdf4-python`_ module (coordinates and |
| | | | velocities). Module :mod:`MDAnalysis.coordinates.TRJ`|
+---------------+-----------+-------+------------------------------------------------------+
| Brookhaven | pdb | r/w | a simplified PDB format (as used in MD simulations) |
| [#a]_ | | | is read by default; the full format can be read by |
| | | | supplying the `permissive=False` flag to |
| | | | :class:`MDAnalysis.Universe`. Multiple frames (MODEL)|
| Brookhaven | pdb | r/w | a relaxed PDB format (as used in MD simulations) |
| [#a]_ | | | is read by default; Multiple frames (MODEL) |
| | | | are supported but require the *multiframe* keyword. |
| | | | Module :mod:`MDAnalysis.coordinates.PDB` |
+---------------+-----------+-------+------------------------------------------------------+
Expand Down Expand Up @@ -265,7 +263,7 @@
- 2015-01-15 Timestep._init_unitcell() method added
- 2015-06-11 Reworked Timestep init. Base Timestep now does Vels & Forces
- 2015-07-21 Major changes to Timestep and Reader API (release 0.11.0)
- 2016-04-03 Removed references to Strict Readers for PDBS [jdetle]
.. _Issue 49: https://github.com/MDAnalysis/mdanalysis/issues/49
.. _Context Manager: http://docs.python.org/2/reference/datamodel.html#context-managers
Expand Down
10 changes: 6 additions & 4 deletions package/MDAnalysis/coordinates/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ def get_reader_for(filename, permissive=False, format=None):
filename of the input trajectory or coordinate file
permissive : bool
If set to ``True``, a reader is selected that is more tolerant of the
input (currently only implemented for PDB). [``False``]
input (currently a deprecated feature only implemented for PDB).
[``False``]
kwargs
Keyword arguments for the selected Reader class.
Expand All @@ -67,7 +68,7 @@ def get_reader_for(filename, permissive=False, format=None):
if format is None:
format = util.guess_format(filename)
format = format.upper()
if permissive and format == 'PDB':
if format == 'PDB' and permissive:
return _READERS['Permissive_PDB']
try:
return _READERS[format]
Expand Down Expand Up @@ -101,6 +102,7 @@ def reader(filename, **kwargs):
filename : str or tuple
filename (or tuple of filenames) of the input coordinate file
permissive : bool
If set to ``True``, a reader is selected that is more tolerant of the
input (currently only implemented for PDB). [``False``]
kwargs
Expand All @@ -113,8 +115,8 @@ def reader(filename, **kwargs):
.. SeeAlso:: For trajectory formats: :class:`~DCD.DCDReader`,
:class:`~XTC.XTCReader`, :class:`~TRR.TRRReader`,
:class:`~XYZ.XYZReader`. For single frame formats:
:class:`~CRD.CRDReader`, :class:`~PDB.PDBReader` and
:class:`~PDB.PrimitivePDBReader`, :class:`~GRO.GROReader`,
:class:`~CRD.CRDReader`, and
:class:`~PDB.PDBReader`, :class:`~GRO.GROReader`,
"""
if isinstance(filename, tuple):
Reader = get_reader_for(filename[0],
Expand Down
11 changes: 7 additions & 4 deletions package/MDAnalysis/core/AtomGroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4195,10 +4195,10 @@ def __init__(self, *args, **kwargs):
topology) is always required.
*permissive*
currently only relevant for PDB files: Set to ``True`` in order to ignore most errors
and read typical MD simulation PDB files; set to ``False`` to read with the Bio.PDB reader,
which can be useful for real Protein Databank PDB files. ``None`` selects the
MDAnalysis default (which is set in :class:`MDAnalysis.core.flags`) [``None``]
currently only relevant to PDBs, Readers and Writers and Parsers
returned by setting ::permisive = False are depecrated in favor
of their ::permissive = True counterparts
*topology_format*
provide the file format of the topology file; ``None`` guesses it from the file
extension [``None``]
Expand Down Expand Up @@ -4260,6 +4260,9 @@ def __init__(self, *args, **kwargs):
.. versionchanged:: 0.11.0
Added the *is_anchor* and *anchor_name* keywords for finer behavior
control when unpickling instances of :class:`MDAnalysis.core.AtomGroup.AtomGroup`.
.. versionchanged:: 0.14.1
*permissive* set to ``True`` and set to ``False`` both yield permissive
PDB readers, writers and parsers
"""

from ..topology.core import get_parser_for
Expand Down
23 changes: 11 additions & 12 deletions package/MDAnalysis/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# MDAnalysis --- http://www.MDAnalysis.org
# Copyright (c) 2006-2015 Naveen Michaud-Agrawal, Elizabeth J. Denning, Oliver Beckstein
Expand Down Expand Up @@ -390,22 +390,21 @@ def __doc__(self):
>>> flags['%(name)s'] = value
The Bio.PDB reader (value=``False``) can deal with 'proper' PDB
files from the Protein Databank that contain special PDB features
such as insertion codes and it can auto-correct some common
mistakes; see :mod:`Bio.PDB` for details. However, Bio.PDB has been
known to read some simulation system PDB files **incompletely**; a
sure sign of problems is a warning that an atom has appeared twice
in a residue.
Therefore, the default for the PDB reader is ``True``, which
selects the "primitive" (or "permissive") reader
:class:`MDAnalysis.coordinates.PDB.PrimitivePDBReader`, which
The default for the PDB reader is ``True``, which
selects the (or "permissive") reader
:class:`MDAnalysis.coordinates.PDB.PDBReader`, which
essentially just reads ATOM and HETATM lines and puts atoms in a
list.
``False`` selects the :class:
`MDAnalysis.coordinates.PDB.PrimitivePDBReader` which is a copy of
the :class:`MDAnalysis.coordinates.PDB.PDBReader` deprecated in favor
of its counterpart
One can manually switch between the two by providing the *permissive*
keyword to :class:`MDAnalysis.Universe`.
"""
),
_Flag(
Expand Down
8 changes: 4 additions & 4 deletions package/MDAnalysis/topology/ExtendedPDBParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
This topology parser uses a PDB file to build a minimum internal structure
representation (list of atoms). The only difference from
:mod:`~MDAnalysis.topology.PrimitivePDBParser` is that this parser reads a
:mod:`~MDAnalysis.topology.PDBParser` is that this parser reads a
non-standard PDB-like format in which residue numbers can be five digits
instead of four.
Expand All @@ -37,7 +37,7 @@
.. SeeAlso::
* :mod:`MDAnalysis.topology.PrimitivePDBParser`
* :mod:`MDAnalysis.topology.PDBParser`
* :class:`MDAnalysis.coordinates.PDB.ExtendedPDBReader`
* :class:`MDAnalysis.core.AtomGroup.Universe`
Expand All @@ -51,10 +51,10 @@
"""
from __future__ import absolute_import

from . import PrimitivePDBParser
from . import PDBParser


class ExtendedPDBParser(PrimitivePDBParser.PrimitivePDBParser):
class ExtendedPDBParser(PDBParser.PDBParser):
"""Parser that obtains a list of atoms from an non-standard "extended" PDB file.
Extended PDB files (MDAnalysis format specifier *XPDB*) may contain residue
Expand Down
Loading

0 comments on commit ecc8239

Please sign in to comment.