Skip to content

Commit

Permalink
Update documentation according to feedback and fix formatting for PEP8
Browse files Browse the repository at this point in the history
  • Loading branch information
lunamorrow committed Oct 23, 2024
1 parent 2610489 commit c7138fd
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 143 deletions.
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,5 @@
intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None),
"mdanalysis": ("https://docs.mdanalysis.org/stable/", None),
"openbabel": ("https://openbabel.org/", None),
}
59 changes: 18 additions & 41 deletions mda_openbabel_converter/OpenBabel.py
Original file line number Diff line number Diff line change
@@ -1,46 +1,23 @@
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# MDAnalysis --- https://www.mdanalysis.org
# Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
# Released under the GNU Public Licence, v2 or any higher version
#
# Please cite your use of MDAnalysis in published work:
#
# R. J. Gowers, M. Linke, J. Barnoud, T. J. E. Reddy, M. N. Melo, S. L. Seyler,
# D. L. Dotson, J. Domanski, S. Buchoux, I. M. Kenney, and O. Beckstein.
# MDAnalysis: A Python package for the rapid analysis of molecular dynamics
# simulations. In S. Benthall and S. Rostrup editors, Proceedings of the 15th
# Python in Science Conference, pages 102-109, Austin, TX, 2016. SciPy.
# doi: 10.25080/majora-629e541a-00e
#
# N. Michaud-Agrawal, E. J. Denning, T. B. Woolf, and O. Beckstein.
# MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations.
# J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787
#

"""OpenBabel molecule I/O --- :mod:`MDAnalysis.MDAKits.mdakits.open-babel-converter`
================================================================
Read coordinates data from an `OpenBabel <http://openbabel.org/api/3.0/classOpenBabel_1_1OBMol.shtml>`_ :class:`openbabel.openbabel.OBMol` with
:class:`OpenBabelReader` into an MDAnalysis Universe. Convert it back to a
:class:`openbabel.openbabel.OBMol` with :class:`OpenBabelConverter`.
"""OpenBabel molecule I/O --- :mod:`mda_openbabel_converter.OpenBabel`
======================================================================
Read coordinates data from an
`OpenBabel <http://openbabel.org/api/3.0/classOpenBabel_1_1OBMol.shtml>`_
:class:`openbabel.openbabel.OBMol` with :class:`OpenBabelReader` into an
MDAnalysis Universe. Convert it back to a :class:`openbabel.openbabel.OBMol`
with :class:`OpenBabelConverter`.
Example
-------
To read an OpenBabel OBMol and then convert the AtomGroup back to an OpenBabel
OBMol::
>>> import openbabel
>>> from openbabel import openbabel as ob
>>> from openbabel.openbabel import OBMol, OBConversion, GetSymbol
>>> import MDAnalysis as mda
>>> obConversion = ob.OBConversion()
>>> obconversion.SetInFormat("pdb")
>>> mol = OBMol()
>>> obconversion = ob.OBConversion()
>>> obconversion.SetInFormat("pdb")
>>> mol = ob.OBMol()
>>> obconversion.ReadFile(mol, "1crn.pdb")
>>> u = mda.Universe(mol)
>>> u
Expand Down Expand Up @@ -91,9 +68,9 @@ class OpenBabelReader(MemoryReader):
Inherits from MemoryReader and converts OpenBabel OBMol Coordinates to a
MDAnalysis Trajectory which is used to build a Universe. This reader
does NOT work in the reverse direction.
See :class:`mda_openbabel_converter.OpenBabelConverter` for MDAnalysis
Universe to OpenBabel OBMol conversion.
See :class:`mda_openbabel_converter.OpenBabel.OpenBabelConverter` for
MDAnalysis Universe to OpenBabel OBMol conversion.
"""
format = 'OPENBABEL'

Expand Down Expand Up @@ -146,10 +123,10 @@ def __init__(self, filename: OBMol, **kwargs):

class OpenBabelConverter(ConverterBase):
"""
Inherits from ConverterBase and converts a MDAnalysis Universe to an
OpenBabel OBMol. This converter does NOT work in the opposite direction.
See :class:`mda_openbabel_converter.OpenBabelReader` for OpenBabel OBMol
Inherits from ConverterBase and converts a MDAnalysis Universe to an
OpenBabel OBMol. This converter does NOT work in the opposite direction.
See :class:`mda_openbabel_converter.OpenBabelReader` for OpenBabel OBMol
to MDAnalysis Universe conversion.
"""
def __repr__(self, **kwargs):
Expand Down
39 changes: 9 additions & 30 deletions mda_openbabel_converter/OpenBabelParser.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,15 @@
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# MDAnalysis --- https://www.mdanalysis.org
# Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
# Released under the GNU Public Licence, v2 or any higher version
#
# Please cite your use of MDAnalysis in published work:
#
# R. J. Gowers, M. Linke, J. Barnoud, T. J. E. Reddy, M. N. Melo, S. L. Seyler,
# D. L. Dotson, J. Domanski, S. Buchoux, I. M. Kenney, and O. Beckstein.
# MDAnalysis: A Python package for the rapid analysis of molecular dynamics
# simulations. In S. Benthall and S. Rostrup editors, Proceedings of the 15th
# Python in Science Conference, pages 102-109, Austin, TX, 2016. SciPy.
# doi: 10.25080/majora-629e541a-00e
#
# N. Michaud-Agrawal, E. J. Denning, T. B. Woolf, and O. Beckstein.
# MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations.
# J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787
#

"""
OpenBabel topology parser --- :mod:`MDAnalysis.converters.RDKitParser`
==================================================================
OpenBabel topology parser --- :mod:`mda_openbabel_converter.OpenBabel`
======================================================================
Converts an `OpenBabel <http://openbabel.org/api/3.0/classOpenBabel_1_1OBMol.shtml>`_ :class:`openbabel.openbabel.OBMol` into a :class:`MDAnalysis.core.Topology`.
Converts an
`OpenBabel <http://openbabel.org/api/3.0/classOpenBabel_1_1OBMol.shtml>`_
:class:`openbabel.openbabel.OBMol` into a :class:`MDAnalysis.core.Topology`.
See Also
--------
:mod:`MDAnalysis.MDAKits.mdakits.open-babel-converter`
:mod:`mda_openbabel_converter.OpenBabel`
Classes
Expand Down Expand Up @@ -92,7 +71,7 @@ class OpenBabelParser(TopologyReaderBase):
MDAnalysis Topology or adds it to a pre-existing Topology. This parser
does not work in the reverse direction.
For use examples, please see OpenBabel Class documentation
For use examples, please see :class:`mda_openbabel_converter.OpenBabel`
Creates the following Attributes:
- Atomids
Expand All @@ -109,7 +88,7 @@ class OpenBabelParser(TopologyReaderBase):
- Charges
- Resnames
- ICodes
Guesses the following:
- Atomnames
Expand Down Expand Up @@ -161,7 +140,7 @@ class OpenBabelParser(TopologyReaderBase):
Raises
------
ValueError
If only some of the atoms have ResidueInfo, from resid.GetNum(),
If only some of the atoms have ResidueInfo, from resid.GetNum(),
available
"""
Expand Down
23 changes: 0 additions & 23 deletions mda_openbabel_converter/tests/test_mda_openbabel_converter.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,3 @@
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# MDAnalysis --- https://www.mdanalysis.org
# Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
# Released under the GNU Public Licence, v2 or any higher version
#
# Please cite your use of MDAnalysis in published work:
#
# R. J. Gowers, M. Linke, J. Barnoud, T. J. E. Reddy, M. N. Melo, S. L. Seyler,
# D. L. Dotson, J. Domanski, S. Buchoux, I. M. Kenney, and O. Beckstein.
# MDAnalysis: A Python package for the rapid analysis of molecular dynamics
# simulations. In S. Benthall and S. Rostrup editors, Proceedings of the 15th
# Python in Science Conference, pages 102-109, Austin, TX, 2016. SciPy.
# doi: 10.25080/majora-629e541a-00e
#
# N. Michaud-Agrawal, E. J. Denning, T. B. Woolf, and O. Beckstein.
# MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations.
# J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787
#

"""
Base tests for the mda_openbabel_converter package.
"""
Expand Down
25 changes: 1 addition & 24 deletions mda_openbabel_converter/tests/test_openbabel_parser.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,6 @@
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# MDAnalysis --- https://www.mdanalysis.org
# Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
# Released under the GNU Public Licence, v2 or any higher version
#
# Please cite your use of MDAnalysis in published work:
#
# R. J. Gowers, M. Linke, J. Barnoud, T. J. E. Reddy, M. N. Melo, S. L. Seyler,
# D. L. Dotson, J. Domanski, S. Buchoux, I. M. Kenney, and O. Beckstein.
# MDAnalysis: A Python package for the rapid analysis of molecular dynamics
# simulations. In S. Benthall and S. Rostrup editors, Proceedings of the 15th
# Python in Science Conference, pages 102-109, Austin, TX, 2016. SciPy.
# doi: 10.25080/majora-629e541a-00e
#
# N. Michaud-Agrawal, E. J. Denning, T. B. Woolf, and O. Beckstein.
# MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations.
# J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787
#

"""
Test suite for the OpenBabel Parser that converts an OBMol's attributes to an
MDAnalysis topology, alongside the OpenBabel Reader, that can be used to
MDAnalysis topology, alongside the OpenBabel Reader, that can be used to
construct an MDAnalysis Universe.
"""

Expand Down
27 changes: 2 additions & 25 deletions mda_openbabel_converter/tests/test_openbabel_reader.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,6 @@
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# MDAnalysis --- https://www.mdanalysis.org
# Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
# Released under the GNU Public Licence, v2 or any higher version
#
# Please cite your use of MDAnalysis in published work:
#
# R. J. Gowers, M. Linke, J. Barnoud, T. J. E. Reddy, M. N. Melo, S. L. Seyler,
# D. L. Dotson, J. Domanski, S. Buchoux, I. M. Kenney, and O. Beckstein.
# MDAnalysis: A Python package for the rapid analysis of molecular dynamics
# simulations. In S. Benthall and S. Rostrup editors, Proceedings of the 15th
# Python in Science Conference, pages 102-109, Austin, TX, 2016. SciPy.
# doi: 10.25080/majora-629e541a-00e
#
# N. Michaud-Agrawal, E. J. Denning, T. B. Woolf, and O. Beckstein.
# MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations.
# J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787
#

"""
Test suite for the OpenBabel Reader that converts an OBMol's atom coordinates
to an MDAnalysis topology, alongside the OpenBabel Parser, that can be used to
Test suite for the OpenBabel Reader that converts an OBMol's atom coordinates
to an MDAnalysis topology, alongside the OpenBabel Parser, that can be used to
construct an MDAnalysis Universe.
"""

Expand Down

0 comments on commit c7138fd

Please sign in to comment.