Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes made while developing another project- quality of life. #14

Merged
merged 22 commits into from
Feb 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
cache: "pip"
- run: "pip install -e '.[dev]'"
- run: mypy src
black:
ruff-format:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
Expand All @@ -35,7 +35,7 @@ jobs:
python-version: "3.11"
cache: "pip"
- run: "pip install -e '.[dev]'"
- run: black --check .
- run: ruff format --check .
pytest:
# https://ericmjl.github.io/blog/2021/12/30/better-conda-environments-on-github-actions/
runs-on: ubuntu-22.04
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,5 @@ dmypy.json
# Version.
src/cgexplore/_version.py
testff_iterations.json
.vscode
.vscode
docs/source/_autosummary
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?= -W --keep-going
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/source/_templates/class.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{{ fullname | escape | underline}}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
:members:
:inherited-members:
:undoc-members:
:show-inheritance:


{% block methods %}
{% if methods %}
.. rubric:: {{ _('Methods') }}

.. autosummary::
:nosignatures:
{% for item in methods %}
{%- if not item.startswith('_') and item not in inherited_members %}
~{{ name }}.{{ item }}
{%- endif -%}
{%- endfor %}
{% endif %}
{% endblock %}

{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Attributes') }}

.. autosummary::
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
68 changes: 68 additions & 0 deletions docs/source/_templates/module.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{{ fullname | escape | underline}}

.. automodule:: {{ fullname }}

{% block attributes %}
{% if attributes %}
.. rubric:: Module attributes

.. autosummary::
:toctree:
{% for item in attributes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block functions %}
{% if functions %}
.. rubric:: {{ _('Functions') }}

.. autosummary::
:toctree:
:nosignatures:
{% for item in functions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block classes %}
{% if classes %}
.. rubric:: {{ _('Classes') }}

.. autosummary::
:toctree:
:template: class.rst
:nosignatures:
{% for item in classes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block exceptions %}
{% if exceptions %}
.. rubric:: {{ _('Exceptions') }}

.. autosummary::
:toctree:
{% for item in exceptions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block modules %}
{% if modules %}
.. rubric:: Modules

.. autosummary::
:toctree:
:template: module.rst
:recursive:
{% for item in modules %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
17 changes: 17 additions & 0 deletions docs/source/cgexplore.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
cgexplore
=========




Beads
-----

.. toctree::
:maxdepth: 1

CgBeads <_autosummary/cgexplore.CgBeads>



This docs are a huge WIP.
45 changes: 45 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
from __future__ import annotations

project = "CGExplore"
project_copyright = "2023, Andrew Tarzia"
author = "Andrew Tarzia"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
"sphinx.ext.doctest",
"sphinx.ext.napoleon",
"sphinx.ext.autosummary",
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
"sphinx_copybutton",
]

autosummary_imported_members = True

autodoc_typehints = "description"
autodoc_member_order = "groupwise"
autoclass_content = "class"

intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
}


templates_path = ["_templates"]
exclude_patterns: list[str] = []


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "furo"
html_static_path = ["_static"]
49 changes: 49 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
.. toctree::
:hidden:
:caption: CGExplore
:maxdepth: 2

cgexplore <cgexplore>

.. toctree::
:hidden:
:maxdepth: 2
:caption: Modules:

Modules <modules>

============
Introduction
============

| GitHub: https://www.github.com/andrewtarzia/CGExplore


:mod:`.CGExplore` is a Python library for doing something...




Installation
------------

TODO


Examples
--------

TODO


Acknowledgements
----------------

I developed much of this code when working in the Pavan group (https://www.gmpavanlab.com/).

Indices and tables
------------------

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
9 changes: 9 additions & 0 deletions docs/source/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Modules
=======

.. autosummary::
:toctree: _autosummary
:template: module.rst
:recursive:

cgexplore
26 changes: 13 additions & 13 deletions first_paper_example/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def analyse_cage(
conformer,
name,
output_dir,
force_field,
forcefield,
node_element,
ligand_element,
database,
Expand Down Expand Up @@ -157,7 +157,7 @@ def analyse_cage(

# This is matched to the existing analysis code. I recommend
# generalising in the future.
ff_targets = force_field.get_targets()
ff_targets = forcefield.get_targets()
if "6P8" in name:
torsions = "toff"
else:
Expand Down Expand Up @@ -206,8 +206,8 @@ def analyse_cage(
elif ("b1", "m1", "b1") in (cp, tuple(reversed(cp))):
clangle = at.angle.value_in_unit(openmm.unit.degrees)

force_field_dict = {
"ff_id": force_field.get_identifier(),
forcefield_dict = {
"ff_id": forcefield.get_identifier(),
"torsions": torsions,
"vdws": "von",
"clbb_bead1": "",
Expand Down Expand Up @@ -235,7 +235,7 @@ def analyse_cage(
"min_b2b_distance": min_b2b_distance,
"radius_gyration": radius_gyration,
"max_diameter": max_diameter,
"force_field_dict": force_field_dict,
"forcefield_dict": forcefield_dict,
}
with open(output_file, "w") as f:
json.dump(res_dict, f, indent=4)
Expand Down Expand Up @@ -624,27 +624,27 @@ def data_to_array(json_files, output_dir):
row["c2bb_name"] = c2bb_name
row["topology"] = t_str
row["ff_name"] = ff_name
row["torsions"] = res_dict["force_field_dict"]["torsions"]
row["vdws"] = res_dict["force_field_dict"]["vdws"]
row["torsions"] = res_dict["forcefield_dict"]["torsions"]
row["vdws"] = res_dict["forcefield_dict"]["vdws"]
row["run_number"] = 0

row["cltopo"] = int(clbb_name[0])
if t_str in cage_topology_options(
"2p3"
) or t_str in cage_topology_options("2p4"):
cltitle = "3C1" if row["cltopo"] == 3 else "4C1"
row["c2r0"] = res_dict["force_field_dict"]["c2r0"]
row["c2angle"] = res_dict["force_field_dict"]["c2angle"]
row["c2r0"] = res_dict["forcefield_dict"]["c2r0"]
row["c2angle"] = res_dict["forcefield_dict"]["c2angle"]
row["target_bite_angle"] = (row["c2angle"] - 90) * 2

elif t_str in cage_topology_options("3p4"):
cltitle = "4C1"
row["c3r0"] = res_dict["force_field_dict"]["c3r0"]
row["c3angle"] = res_dict["force_field_dict"]["c3angle"]
row["c3r0"] = res_dict["forcefield_dict"]["c3r0"]
row["c3angle"] = res_dict["forcefield_dict"]["c3angle"]

row["cltitle"] = cltitle
row["clr0"] = res_dict["force_field_dict"]["clr0"]
row["clangle"] = res_dict["force_field_dict"]["clangle"]
row["clr0"] = res_dict["forcefield_dict"]["clr0"]
row["clangle"] = res_dict["forcefield_dict"]["clangle"]

row["bbpair"] = clbb_name + c2bb_name + ff_name
row["optimised"] = res_dict["optimised"]
Expand Down
Loading
Loading