Skip to content

Commit

Permalink
Merge pull request #24 from MoleculeResolver/spr/main/f034bebf
Browse files Browse the repository at this point in the history
Add docs website
  • Loading branch information
simonmb authored Jan 14, 2025
2 parents bcae787 + fda8147 commit 7cdd927
Show file tree
Hide file tree
Showing 13 changed files with 949 additions and 4 deletions.
Binary file added .DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ __pycache__/
moleculeresolver/molecule_cache.*
.venv/
*.db*
debug.log
debug.log
*build/
22 changes: 22 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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-24.04
tools:
python: "3.13"

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

# Optionally, 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

12 changes: 12 additions & 0 deletions .spr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
githubRepoOwner: MoleculeResolver
githubRepoName: molecule-resolver
githubHost: github.com
githubRemote: origin
githubBranch: main
requireChecks: true
requireApproval: true
mergeMethod: rebase
mergeQueue: false
forceFetchTags: false
showPrTitlesInStack: false
branchPushIndividually: false
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 = 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/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=source
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
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sphinx-autoapi>=3.4.0
28 changes: 28 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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 = 'MoleculeResolver'
copyright = '2025, Simon Muller and Kobi Felton'
author = 'Simon Muller and Kobi Felton'
release = '0.3.2'

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

extensions = ['autoapi.extension']

templates_path = ['_templates']
exclude_patterns = []

autoapi_dirs = ['../../moleculeresolver']

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

html_theme = 'alabaster'
html_static_path = ['_static']
17 changes: 17 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.. MoleculeResolver documentation master file, created by
sphinx-quickstart on Mon Jan 13 19:01:52 2025.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
MoleculeResolver documentation
==============================

Add your content using ``reStructuredText`` syntax. See the
`reStructuredText <https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_
documentation for details.


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

102 changes: 102 additions & 0 deletions molecule_test_set/benchmark_molecule_names.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
[
"Acetic Acid",
"Acetone",
"Acetylene",
"Acetylsalicylic Acid",
"Adenine",
"Adenosine Triphosphate",
"Adipic Acid",
"Aluminum(III) Oxide",
"Ammonia",
"Ascorbic Acid",
"Aspartame",
"Benzene",
"Benzoic Acid",
"Biphenyl ",
"Butane",
"Butene",
"Butyric Acid",
"Caffeine",
"Calcium Carbonate",
"Calcium Oxide",
"Calcium Sulfate",
"Carbon Dioxide",
"Carbon Monoxide",
"Chloroform",
"Chlorophyll",
"Cholesterol",
"Citric Acid",
"Cocaine",
"Cytosine",
"DDT",
"DEET",
"R-12",
"Dopamine",
"Adrenaline",
"Ethane",
"Ethylene",
"Ether",
"Ethanol",
"Ethylenediaminetetraacetic Acid",
"Fluoxetine",
"Formaldehyde",
"Formic Acid",
"Glucose",
"Glycerol",
"Guanine",
"Hydrochloric Acid",
"Hydrogen Peroxide",
"Hydrogen Sulfide",
"Ibuprofen",
"Indigo",
"Insulin",
"Iron(III) Oxide",
"Isooctane",
"Isoprene",
"l-Dopa",
"Methane",
"Methyl Alcohol",
"Methylphenidate",
"Monosodium Glutamate",
"Morphine",
"Naphthalene",
"Nicotine",
"Nitric Acid",
"Nitric Oxide",
"Nitrogen Dioxide",
"Nitrous Oxide",
"Nitroglycerin",
"Norethindrone",
"Penicillin",
"Phenol",
"Phosphoric Acid",
"Piperine",
"Potassium Carbonate",
"Potassium Nitrate",
"Propane",
"Propylene",
"Quinine",
"Saccharin",
"Silicon Dioxide",
"Sodium Bicarbonate",
"Sodium Carbonate",
"Sodium Chloride",
"Sodium Hydroxide",
"Sodium Hypochlorite",
"Strychnine",
"Styrene",
"Sucrose",
"Sulfuric Acid",
"Tetrafluoroethylene",
"Tetrahydrocannabinol",
"Thymine",
"Trinitrotoluene",
"Toluene",
"Triuranium Octaoxide",
"Uracil",
"Urea",
"Vanillin",
"Vinyl Chloride",
"Water",
"Xylene"
]
35 changes: 35 additions & 0 deletions molecule_test_set/get_data_generate_identifiers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

import json
import os
from moleculeresolver import MoleculeResolver
from rdkit import Chem

with open('benchmark_molecule_names.json', 'r') as f:
benchmark_molecule_names = json.load(f)

if not os.path.exists('benchmark_component_molecules.json'):

benchmark_component_molecules = {}
with MoleculeResolver(available_service_API_keys={"chemeo": 'YOUR_KEY'}, molecule_cache_db_path='molecule_cache.db') as mr:
mr._available_services.remove('cts')
temp = mr.find_multiple_molecules_parallelized(benchmark_molecule_names, [['name']] * len(benchmark_molecule_names))

for name, molecule in zip(benchmark_molecule_names, temp, strict=True):
molecule.found_molecules = []
molecule = molecule.__dict__
mol = Chem.MolFromSmiles(molecule['SMILES'])
pubchem_cid = [v.strip() for v in molecule['additional_information'].split(';') if 'pubchem' in v]
if pubchem_cid:
pubchem_cid = int(pubchem_cid[0].split(':')[-1])
else:
pubchem_cid = None

molecule['pubchem_cid'] = pubchem_cid
molecule['formula'] = Chem.rdMolDescriptors.CalcMolFormula(mol)
molecule['hill_formula'] = mr.to_hill_formula(mol)
molecule['inchi'] = Chem.MolToInchi(mol)
molecule['inchikey'] = Chem.InchiToInchiKey(molecule['inchi'])
benchmark_component_molecules[name] = molecule

with open('benchmark_component_molecules.json', 'w') as f:
json.dump(benchmark_component_molecules, f, indent=4)
Loading

0 comments on commit 7cdd927

Please sign in to comment.