Skip to content

Commit

Permalink
Merge pull request #41 from BranniganLab/sphinx
Browse files Browse the repository at this point in the history
Sphinx & Plotting Documentation
  • Loading branch information
jhenin authored May 9, 2024
2 parents 2b6aa12 + 3e7f36b commit e59aa7d
Show file tree
Hide file tree
Showing 15 changed files with 562 additions and 139 deletions.
32 changes: 32 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.12"
# You can also specify other tool versions:
# nodejs: "19"
# rust: "1.64"
# golang: "1.19"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
# - epub

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/requirements.txt
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 ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
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)
Empty file added docs/_static/.gitkeep
Empty file.
36 changes: 36 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import sys
import os
# 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

project = 'safep'
copyright = '2024, Brannigan Lab'
author = 'Brannigan Lab'
release = '0.1.3'

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

extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.napoleon',
'autodocsumm',
'sphinx.ext.coverage'
]
auto_doc_default_options = {'autosummary': True}
templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

sys.path.insert(0, os.path.abspath('../safep'))

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

html_theme = 'sphinx_rtd_theme' # read the docs theme. This variable is 'default' by default.

html_static_path = ['_static']
37 changes: 37 additions & 0 deletions docs/getting-started.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
getting-started
===============

.. toctree::
:maxdepth: 4

Introduction
------------
SAFEP-related scripts and tools

These scripts and notebooks are broadly applicable to FEP analysis.

A complete tutorial is available at:
`SAFEP Tutorial <https://doi.org/10.33011/livecoms.5.1.2067>`_.

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

.. Installation:
0. Clone this repository
1. Enter the repository directory
2. Run ``pip install .``

OR

0. Run ``pip install git+https://github.com/BranniganLab/safep.git``

Notebooks
----------
- BAR_Estimator_Basic: General use FEP analysis. Includes cumulative dG estimates, error estimates, and measures of convergence.
- BAR_Estimator_Expanded: Extended functionality including bootstrapped error estimates, kernel estimation of dL distributions, and more.


Examples
----------
Sample data is available in Sample_Notebooks/Sample_Data or from the alchemtest package.

23 changes: 23 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.. safep documentation master file, created by
sphinx-quickstart on Wed Mar 27 13:57:58 2024.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to safep's documentation!
=================================

.. toctree::
:maxdepth: 2
:caption: Contents:

getting-started
modules



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
7 changes: 7 additions & 0 deletions docs/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
safep
=====

.. toctree::
:maxdepth: 4

safep
11 changes: 11 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
autodocsumm
sphinx_rtd_theme
safep
numpy
pandas
matplotlib
scipy
alchemlyb
pymbar
natsort
tqdm
69 changes: 69 additions & 0 deletions docs/safep.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
safep package
=============

Submodules
----------

safep.AFEP\_parse module
------------------------

.. automodule:: safep.AFEP_parse
:members:
:undoc-members:
:show-inheritance:

safep.TI module
---------------

.. automodule:: safep.TI
:members:
:undoc-members:
:show-inheritance:

safep.estimators module
-----------------------

.. automodule:: safep.estimators
:members:
:undoc-members:
:show-inheritance:

safep.fileIO module
-------------------

.. automodule:: safep.fileIO
:members:
:undoc-members:
:show-inheritance:

safep.helpers module
--------------------

.. automodule:: safep.helpers
:members:
:undoc-members:
:show-inheritance:

safep.plotting module
---------------------

.. automodule:: safep.plotting
:members:
:undoc-members:
:show-inheritance:

safep.processing module
-----------------------

.. automodule:: safep.processing
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: safep
:members:
:undoc-members:
:show-inheritance:
36 changes: 36 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[project]
dependencies = [
'numpy>=1.22.0',
'pandas>=1.4.0',
'alchemlyb==2.0.0',
'matplotlib>=3.5.0',
'natsort>=7.1.0',
'tqdm',
]

name = 'safep'
version = "0.1.4"

authors = [{name='Brannigan Lab', email='[email protected]'}]

description = 'Tools for Analyzing and Debugging (SA)FEP calculations'
readme = "README.md"

requires-python = ">=3.10"

classifiers = [
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3.12',
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Operating System :: OS Independent",
]

[project.urls]
Homepage = "https://github.com/BranniganLab/safep"
Issues = "https://github.com/BranniganLab/safep/issues"
6 changes: 3 additions & 3 deletions safep/fileIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ def read_FEPOUT(fileName, step=1):
if line[0] == '#':
frame = 0
#print(line)
Lambda = re.search('LAMBDA SET TO (\d+(\.\d+)*)', line)
Lambda2 = re.search('LAMBDA2 (\d+(\.\d+)*)', line)
LambdaIDWS = re.search('LAMBDA_IDWS (\d+(\.\d+)*)', line)
Lambda = re.search(r'LAMBDA SET TO (\d+(\.\d+)*)', line)
Lambda2 = re.search(r'LAMBDA2 (\d+(\.\d+)*)', line)
LambdaIDWS = re.search(r'LAMBDA_IDWS (\d+(\.\d+)*)', line)
if Lambda:
L = Lambda.group(1)
#print(f'L={L}')
Expand Down
Loading

0 comments on commit e59aa7d

Please sign in to comment.