diff --git a/.gitignore b/.gitignore index c5c3476..d058f26 100644 --- a/.gitignore +++ b/.gitignore @@ -131,5 +131,8 @@ docs/.vitepress/cache docs/.vitepress/cache/* node_modules +# Sphinx documentation +docs/_build/ + #grafana grafana_data/ \ No newline at end of file diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000..9228889 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,29 @@ +# Read the Docs configuration file for Sphinx projects +# 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.11" + + +# 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: + - 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 + - requirements: docs/extra-requirements.txt + ignore_dependencies: true \ No newline at end of file diff --git a/CITATION.cff b/CITATION.cff index 421a95d..9aeb0a9 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -11,7 +11,7 @@ authors: given-names: "Kohulan" orcid: "https://orcid.org/0000-0003-1066-7792" title: "cheminformatics-python-microservice" -version: v0.3.0 - prerelease -doi: 10.5281/zenodo.7747862 +version: V1.0.0 +doi: 10.5281/zenodo.8112749 date-released: 2023-03-16 url: "https://github.com/Steinbeck-Lab/cheminformatics-python-microservice" diff --git a/README.md b/README.md index 99790a6..78ec0f6 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,8 @@ ![Workflow](https://github.com/Steinbeck-Lab/cheminformatics-python-microservice/actions/workflows/release-please.yml/badge.svg) [![framework](https://img.shields.io/badge/Framework-FastAPI-blue?style)](https://fastapi.tiangolo.com/) [![FastAPI Documentation](https://img.shields.io/badge/docs-fastapi-blue)](https://api.naturalproducts.net/v1/docs#/) -[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7747862.svg)](https://doi.org/10.5281/zenodo.7747862) +[![Documentation Status](https://readthedocs.org/projects/cheminformatics-python-microservice/badge/?version=latest)](https://cheminformatics-python-microservice.readthedocs.io/en/latest/?badge=latest) +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.8112749.svg)](https://doi.org/10.5281/zenodo.8112749) ## Overview of Cheminformatics Python Microservice This set of essential and valuable microservices is designed to be accessed via API calls to support cheminformatics. Generally, it is designed to work with SMILES-based inputs and could be used to translate between different machine-readable representations, get Natural Product (NP) likeliness scores, visualize chemical structures, and generate descriptors. In addition, the microservices also host an instance of [STOUT](https://github.com/Kohulan/Smiles-TO-iUpac-Translator) and another instance of [DECIMER](https://github.com/Kohulan/DECIMER-Image_Transformer) (two deep learning models for IUPAC name generation and optical chemical structure recognition, respectively). @@ -33,7 +34,7 @@ This project is licensed under the MIT License - see the [LICENSE](https://githu ## Citation -Venkata, C., Sharma, N., & Rajan, K. (2023). Cheminformatics Python Microservice (Version v0.9.0 - prerelease) [Computer software]. https://doi.org/10.5281/zenodo.7747862 +Venkata, C., Sharma, N., & Rajan, K. (2023). Cheminformatics Python Microservice (Version V1.0.0) [Computer software]. https://doi.org/10.5281/zenodo.7747862 ## Maintained by diff --git a/app/modules/coconut/preprocess.py b/app/modules/coconut/preprocess.py index 457bb34..5f47570 100644 --- a/app/modules/coconut/preprocess.py +++ b/app/modules/coconut/preprocess.py @@ -7,9 +7,13 @@ def getMolBlock(input_text: str): """ This function generates a molblock from the - input text. - Args (str): Input text (mol / SMILES) - returns (str): molblock + input text using CDK. + + Args (str): + Input text (mol / SMILES) + Returns (str): + molblock + """ check = rdkitmodules.is_valid_molecule(input_text) @@ -25,8 +29,12 @@ def getMolBlock(input_text: str): def getMolculeHash(smiles: str): """ This function returns a set of molecule hashes defined. - Args (str): SMILES string (strandardised is preferred). - Returns (dict): molecule_hash + + Args (str): + SMILES string (strandardised is preferred). + Returns (dict): + molecule_hash + """ mol = Chem.MolFromSmiles(smiles) if mol: @@ -46,8 +54,12 @@ def getRepresentations(smiles: str): """ This functions returns COCONUT representations. InChI, InChi key and Murko framework. - Args (str): SMILES string. - Returns (dict): dictionary of InChI, InChi key and Murko framework. + + Args (str): + SMILES string. + Returns (dict): + dictionary of InChI, InChi key and Murko framework. + """ mol = Chem.MolFromSmiles(smiles) if mol: @@ -57,11 +69,15 @@ def getRepresentations(smiles: str): return {"InChI": InChI, "InChI_Key": InChI_Key, "Murko": Murko} -def COCONUTpreprocessing(input_text: str): +def getCOCONUTpreprocessing(input_text: str): """ This function takes a user input text and returns a dictionary for COCONUT input. - Args (str): input_text (mol/str). - Returns (dict): COCONUT preprocessed data. + + Args (str): + input_text (mol/str). + Returns (dict): + COCONUT preprocessed data. + """ original_mol = getMolBlock(input_text) standarised_mol_block = rdkitmodules.standardizer.standardize_molblock(original_mol) diff --git a/app/modules/decimer.py b/app/modules/decimer.py index ec5fb78..7a0af9f 100644 --- a/app/modules/decimer.py +++ b/app/modules/decimer.py @@ -7,6 +7,7 @@ def convert_image(path: str): """Takes an image filepath of GIF image and returns Hi Res PNG image. + Args: input_path (str): path of an image. @@ -31,6 +32,7 @@ def convert_image(path: str): def get_segments(path: str): """Takes an image filepath and returns a set of paths and image name of segmented images. + Args: input_path (str): path of an image. @@ -50,6 +52,7 @@ def get_segments(path: str): def getPredictedSegments(path: str): """Takes an image filepath and returns predicted SMILES for segmented images. + Args: input_path (str): path of an image. diff --git a/app/modules/toolkits/cdk_wrapper.py b/app/modules/toolkits/cdk_wrapper.py index 929aedd..a64f196 100644 --- a/app/modules/toolkits/cdk_wrapper.py +++ b/app/modules/toolkits/cdk_wrapper.py @@ -43,10 +43,11 @@ def getCDKSDG(smiles: str): """This function takes the user input SMILES and Creates a Structure Diagram Layout using the CDK. + Args: - smiles (string): SMILES string given by the user. + smiles (string): SMILES string given by the user. Returns: - mol object : mol object with CDK SDG. + mol object : mol object with CDK SDG. """ if any(char.isspace() for char in smiles): smiles = smiles.replace(" ", "+") @@ -63,10 +64,11 @@ def getCDKSDG(smiles: str): def getMurkoFramework(smiles: str): """This function takes the user input SMILES and returns the Murko framework + Args: - smiles (string): SMILES string given by the user. + smiles (string): SMILES string given by the user. Returns: - smiles (string) : Murko Framework as SMILES. + smiles (string) : Murko Framework as SMILES. """ if any(char.isspace() for char in smiles): smiles = smiles.replace(" ", "+") @@ -84,11 +86,13 @@ def getMurkoFramework(smiles: str): def getCDKSDGMol(smiles: str, V3000=False): """This function takes the user input SMILES and returns a mol block as a string with Structure Diagram Layout. + Args: - smiles (string): SMILES string given by the user. - V3000 (boolean): Gives an option to return V3000 mol. + smiles (string): SMILES string given by the user. + V3000 (boolean): Gives an option to return V3000 mol. Returns: - mol object (string): CDK Structure Diagram Layout mol block. + mol object (string): CDK Structure Diagram Layout mol block. + """ if any(char.isspace() for char in smiles): smiles = smiles.replace(" ", "+") @@ -107,8 +111,12 @@ def getAromaticRingCount(mol): """This function is adapted from CDK to calculate the number of Aromatic Rings present in a given molecule. - Args (mol): CDK mol object as input. - Returns (int): Number if aromatic rings present + + Args (mol): + CDK mol object as input. + Returns (int): + Number if aromatic rings present. + """ Cycles = JClass(cdk_base + ".graph.Cycles") ElectronDonation = JClass(cdk_base + ".aromaticity.ElectronDonation") @@ -133,8 +141,12 @@ def getAromaticRingCount(mol): def getCDKDescriptors(smiles: str): """Take an input SMILES and generate a selected set of molecular descriptors generated using CDK as a list. - Args (str): SMILES string - Returns (list): a list of calculated descriptors + + Args (str): + SMILES string. + Returns (list): + A list of calculated descriptors. + """ Mol = getCDKSDG(smiles) if Mol: @@ -229,8 +241,11 @@ def getTanimotoSimilarityCDK(smiles1: str, smiles2: str): Take two SMILES strings and calculate Tanimoto similarity index using Pubchem Fingerprints. - Args (str,str): SMILES strings. - Returns (float): Tanimoto similarity. + + Args (str,str): + SMILES strings. + Returns (float): + Tanimoto similarity. """ Tanimoto = JClass(cdk_base + ".similarity.Tanimoto") SCOB = JClass(cdk_base + ".silent.SilentChemObjectBuilder") @@ -289,8 +304,12 @@ def getCIPAnnotation(smiles: str): """ The function return the CIP annotations using the CDK CIP toolkit. - Args: mol block - Returns: CIP annotated mol block + + Args (str): + SMILES string as input. + Returns (str): + CIP annotated mol block. + """ mol = getCDKSDG(smiles) centres_base = "com.simolecule.centres" @@ -392,10 +411,11 @@ def getCIPAnnotation(smiles: str): def getCXSMILES(smiles: str): """This function takes the user input SMILES and creates a CXSMILES string with 2D atom coordinates + Args: - smiles (string): SMILES string given by the user. + smiles (str): SMILES string given by the user. Returns: - smiles (string): CXSMILES string. + smiles (str): CXSMILES string. """ moleculeSDG = getCDKSDG(smiles) @@ -410,10 +430,11 @@ def getCXSMILES(smiles: str): def getCanonSMILES(smiles: str): """This function takes the user input SMILES and creates a Canonical SMILES string with 2D atom coordinates + Args: - smiles (string): SMILES string given by the user. + smiles (str): SMILES string given by the user. Returns: - smiles (string): Canonical SMILES string. + smiles (str): Canonical SMILES string. """ moleculeSDG = getCDKSDG(smiles) @@ -426,10 +447,11 @@ def getCanonSMILES(smiles: str): def getInChI(smiles: str, InChIKey=False): """This function takes the user input SMILES and creates a InChI string + Args: - smiles (string): SMILES string given by the user. + smiles (str): SMILES string given by the user. Returns: - smiles (string): InChI/InChIKey string. + smiles (str): InChI/InChIKey string. """ moleculeSDG = getCDKSDG(smiles) @@ -450,10 +472,12 @@ def getInChI(smiles: str, InChIKey=False): async def getCDKHOSECodes(smiles: str, noOfSpheres: int, ringsize: bool): """This function takes the user input SMILES and returns a mol block as a string with Structure Diagram Layout. + Args: - smiles(str), noOfSpheres(int), ringsize(bool): SMILES string, No of Spheres and the ringsize given by the user. + smiles(str), noOfSpheres(int), ringsize(bool): SMILES string, No of Spheres and the ringsize given by the user. Returns: - HOSECodes (string): CDK generted HOSECodes. + HOSECodes (str): CDK generted HOSECodes. + """ if any(char.isspace() for char in smiles): smiles = smiles.replace(" ", "+") diff --git a/app/modules/toolkits/rdkit_wrapper.py b/app/modules/toolkits/rdkit_wrapper.py index 365e228..bc04753 100644 --- a/app/modules/toolkits/rdkit_wrapper.py +++ b/app/modules/toolkits/rdkit_wrapper.py @@ -9,6 +9,12 @@ def checkSMILES(smiles: str): """This functions checks whether or not the SMILES is valid. If not, it attempts to standardize the molecule using the ChEMBL standardization pipeline. + + Args (str): + SMILES string as input. + Returns (str): + Molblock/ Error message. + """ if any(char.isspace() for char in smiles): smiles = smiles.replace(" ", "+") @@ -25,8 +31,12 @@ def checkSMILES(smiles: str): def checkRo5Violations(mol): """Takes a molecule and checks whether the molecule violates Lipinski's Rule of Five. - Args : molecules rdkit.Chem.rdmol.Mol: rdkit_mol Objects - Returns (int): A number of violations of Lipinski Rules. + + Args : + molecules rdkit.Chem.rdmol.Mol: rdkit_mol Objects + Returns (int): + A number of violations of Lipinski Rules. + """ num_of_violations = 0 if Descriptors.MolLogP(mol) > 5: @@ -43,8 +53,12 @@ def checkRo5Violations(mol): def getRDKitDescriptors(smiles: str): """Take an input SMILES and generate a selected set of molecular descriptors as a dictionary. - Args (str): SMILES string - Returns (dict): a dictionary of calculated descriptors + + Args (str): + SMILES string + Returns (dict): + a dictionary of calculated descriptors + """ mol = checkSMILES(smiles) if mol: @@ -89,10 +103,13 @@ def getRDKitDescriptors(smiles: str): def get3Dconformers(smiles, depict=True): - """Convert SMILES to Mol with 3D coordinates - Args (str): SMILES string. - Returns (rdkil.mol): A mol object with 3D coordinates. - optimized with MMFF94 forcefield. + """Convert SMILES to Mol with 3D coordinates. + + Args (str): + SMILES string. + Returns (rdkil.mol): + A mol object with 3D coordinates. Optimized with MMFF94 forcefield. + """ if any(char.isspace() for char in smiles): smiles = smiles.replace(" ", "+") @@ -123,8 +140,11 @@ def getTanimotoSimilarityRDKit(smiles1, smiles2): Take two SMILES strings and calculate Tanimoto similarity index using Morgan Fingerprints. - Args (str,str): SMILES strings. - Returns (float): Tanimoto similarity. + + Args (str,str): + SMILES strings. + Returns (float): + Tanimoto similarity. """ # create two example molecules mol1 = checkSMILES(smiles1) @@ -146,8 +166,11 @@ async def getRDKitHOSECodes(smiles: str, noOfSpheres: int): """ This function takes a SMILES string as input and returns the calculated HOSEcodes - Args (smiles: str, noOfSpheres: int): SMILES string and No of Spheres as int. - Returns: hosecodes + + Args (smiles: str, noOfSpheres: int): + SMILES string and No of Spheres as int. + Returns: + HOSECodes """ if any(char.isspace() for char in smiles): @@ -165,8 +188,11 @@ def is_valid_molecule(input_text): """ This functions checks whether the input text is a molblock or SMILES. - Args (str): SMILES string or molblock. - Returns (str): SMILES/Mol flag. + + Args (str): + SMILES string or molblock. + Returns (str): + SMILES/Mol flag. """ try: molecule = Chem.MolFromSmiles(input_text) @@ -185,8 +211,12 @@ def is_valid_molecule(input_text): def has_stereochemistry(smiles: str): """ This function checks whether the input has stereochemistry or not. - Args (str) : SMILES string. - Returns (bool): True or false. + + Args (str) : + SMILES string. + Returns (bool): + True or false. + """ mol = Chem.MolFromSmiles(smiles) @@ -204,8 +234,12 @@ def has_stereochemistry(smiles: str): def get2Dmol(smiles: str): """This function takes an input as a SMILES string and returns a 2D mol block. - Args (str): SMILES string. - Returns (str): 2D Mol block. + + Args (str): + SMILES string. + Returns (str): + 2D Mol block. + """ if any(char.isspace() for char in smiles): smiles = smiles.replace(" ", "+") @@ -222,8 +256,12 @@ def get2Dmol(smiles: str): def getRDKitCXSMILES(smiles: str): """This function takes an input as a SMILES string and returns a CXSMILES with coordinates. - Args (str): SMILES string. - Returns (str): CXSMILES with coordinates. + + Args (str): + SMILES string. + Returns (str): + CXSMILES with coordinates. + """ if any(char.isspace() for char in smiles): smiles = smiles.replace(" ", "+") diff --git a/app/modules/tools/sugarremoval.py b/app/modules/tools/sugarremoval.py index db1f3f9..b7c8331 100644 --- a/app/modules/tools/sugarremoval.py +++ b/app/modules/tools/sugarremoval.py @@ -4,10 +4,12 @@ def getSugarInfo(smiles: str): """This function uses the sugar removal utility and checks whether a molecule has circular or linear sugars + Args: - smiles (string): SMILES string given by the user. + smiles (str): SMILES string given by the user. Returns: (boolean): True or false values whtehr or not molecule has sugar. + """ if any(char.isspace() for char in smiles): smiles = smiles.replace(" ", "+") @@ -33,10 +35,12 @@ def getSugarInfo(smiles: str): def removeLinearSugar(smiles: str): """This fucntion detects and removes linear sugars from a give SMILES string. Uses the CDK based sugar removal utility. + Args: - smiles (string): SMILES string given by the user. + smiles (str): SMILES string given by the user. Returns: - smiles (string): SMILES string without linear sugars. + smiles (str): SMILES string without linear sugars. + """ cdk_base = "org.openscience.cdk" SCOB = cdk.JClass(cdk_base + ".silent.SilentChemObjectBuilder") @@ -66,10 +70,12 @@ def removeLinearSugar(smiles: str): def removeCircularSugar(smiles: str): """This fucntion detects and removes circular sugars from a give SMILES string. Uses the CDK based sugar removal utility. + Args: - smiles (string): SMILES string given by the user. + smiles (str): SMILES string given by the user. Returns: - smiles (string): SMILES string without circular sugars. + smiles (str): SMILES string without circular sugars. + """ cdk_base = "org.openscience.cdk" SCOB = cdk.JClass(cdk_base + ".silent.SilentChemObjectBuilder") @@ -100,10 +106,12 @@ def removeCircularSugar(smiles: str): def removeLinearandCircularSugar(smiles: str): """This fucntion detects and removes linear and circular sugars from a give SMILES string. Uses the CDK based sugar removal utility. + Args: - smiles (string): SMILES string given by the user. + smiles (str): SMILES string given by the user. Returns: - smiles (string): SMILES string without linear and circular sugars. + smiles (str): SMILES string without linear and circular sugars. + """ cdk_base = "org.openscience.cdk" SCOB = cdk.JClass(cdk_base + ".silent.SilentChemObjectBuilder") diff --git a/app/modules/tools/surge.py b/app/modules/tools/surge.py index 6c987a8..89f0cb1 100644 --- a/app/modules/tools/surge.py +++ b/app/modules/tools/surge.py @@ -10,7 +10,8 @@ def getHeavyAtomCount(formula: str) -> int: formula (str): The molecular formula of the molecule. Returns: - int: The number of heavy atoms in the molecule. + count (int): The number of heavy atoms in the molecule. + """ elements = re.findall(r"[A-Z][a-z]*\d*", formula) @@ -33,11 +34,13 @@ def getHeavyAtomCount(formula: str) -> int: def generateStructures(molecular_formula: str): """This function uses surge - chemical structure generator that generates - structures based on the canonical generation path method + structures based on the canonical generation path method. + Args: molecular_formula (string): molecular_formula string given by the user. Returns: - (array): array of SMILEs generated for the given MF + (array): array of SMILEs generated for the given molecular_formula + """ smiles = [] if getHeavyAtomCount(molecular_formula) <= 10: diff --git a/app/routers/chem.py b/app/routers/chem.py index 7730ddd..6ab25af 100644 --- a/app/routers/chem.py +++ b/app/routers/chem.py @@ -19,7 +19,7 @@ ) from app.modules.coconut.descriptors import getCOCONUTDescriptors from app.modules.alldescriptors import getTanimotoSimilarity -from app.modules.coconut.preprocess import COCONUTpreprocessing +from app.modules.coconut.preprocess import getCOCONUTpreprocessing import pandas as pd from fastapi.templating import Jinja2Templates @@ -365,7 +365,7 @@ async def COCONUT_Preprocessing(smiles: str): """ if smiles: - data = COCONUTpreprocessing(smiles) + data = getCOCONUTpreprocessing(smiles) return JSONResponse(content=data) else: return "Error reading SMILES string, check again." diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d4bb2cb --- /dev/null +++ b/docs/Makefile @@ -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) diff --git a/docs/coconut.rst b/docs/coconut.rst new file mode 100644 index 0000000..36befc1 --- /dev/null +++ b/docs/coconut.rst @@ -0,0 +1,18 @@ +COCONUT Modules +=============== + +app.modules.coconut.preprocess module +------------------------------------- + +.. automodule:: app.modules.coconut.preprocess + :members: + :undoc-members: + :show-inheritance: + +app.modules.coconut.descriptors module +-------------------------------------- + +.. automodule:: app.modules.coconut.descriptors + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..71ffc4d --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,104 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +import os +import sys + +sys.path.insert(0, os.path.abspath("..")) + +# -- Project information ----------------------------------------------------- + +project = "Cheminformatics Python Microservice" +copyright = "2023, Venkata Chandrasekhar, Nisha Sharma & Kohulan Rajan" +author = "Venkata Chandrasekhar, Nisha Sharma & Kohulan Rajan" + +# The full version, including alpha/beta/rc tags +release = "1.1.0" + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named "sphinx.ext.*") or your custom +# ones. +extensions = [ + "sphinx.ext.autodoc", + "sphinx_autodoc_typehints", + "sphinx.ext.autosummary", + "nbsphinx", + "sphinx.ext.mathjax", + "sphinx.ext.githubpages", + "sphinx.ext.viewcode", +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = ".rst" + +# The master toctree document. +master_doc = "index" + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = [] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = "sphinx" + +# Decides the language used for syntax highlighting of code blocks. +highlight_language = "python3" + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = False + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = "furo" + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# Material theme options (see theme.conf for more information) +html_theme_options = { + "light_css_variables": { + "color-brand-primary": "red", + "color-brand-content": "#CC3333", + "color-admonition-background": "orange", + }, + "sidebar_hide_name": True, + "navigation_with_keys": True, + "top_of_page_button": "edit", +} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ["public"] +html_favicon = "public/logo.png" +html_logo = "public/logo_light.png" +# Custom sidebar templates, must be a dictionary that maps document names +# to template names. +# +# The default sidebars (for documents that don't match any pattern) are +# defined by theme itself. Builtin themes are using these templates by +# default: ``['localtoc.html', 'relations.html', 'sourcelink.html', +# 'searchbox.html']``. diff --git a/docs/extra-requirements.txt b/docs/extra-requirements.txt new file mode 100644 index 0000000..7df066a --- /dev/null +++ b/docs/extra-requirements.txt @@ -0,0 +1,3 @@ +decimer-segmentation +decimer>=2.2.0 +STOUT-pypi>=2.0.5 diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..c51373e --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,30 @@ +.. Cheminformatics Python Microservice documentation master file, created by + Kohulan Rajan on Tue Jul 4 11:00:09 2023. + +Welcome to Cheminformatics Python Microservice's documentation! +=============================================================== + +.. image:: https://github.com/Steinbeck-Lab/cheminformatics-python-microservice/blob/main/docs/public/logo_big_light.png?raw=true + :width: 500 + :align: center + +This set of essential and valuable microservices is designed to be accessed via API calls to support cheminformatics. Generally, it is designed to work with SMILES-based inputs and could be used to translate between different machine-readable representations, get Natural Product (NP) likeliness scores, visualize chemical structures, and generate descriptors. In addition, the microservices also host an instance of STOUT and another instance of DECIMER (two deep learning models for IUPAC name generation and optical chemical structure recognition, respectively). + +How to access +============= + +https://steinbeck-lab.github.io/cheminformatics-python-microservice/ + + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + modules + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..32bb245 --- /dev/null +++ b/docs/make.bat @@ -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 diff --git a/docs/modules.rst b/docs/modules.rst new file mode 100644 index 0000000..81af80a --- /dev/null +++ b/docs/modules.rst @@ -0,0 +1,12 @@ +Cheminformatics Python Microservice +=================================== + +.. toctree:: + :maxdepth: 4 + + python_modules + tools + toolkits + coconut + + diff --git a/docs/public/logo_big_light.png b/docs/public/logo_big_light.png new file mode 100644 index 0000000..4d15a39 Binary files /dev/null and b/docs/public/logo_big_light.png differ diff --git a/docs/python_modules.rst b/docs/python_modules.rst new file mode 100644 index 0000000..b351850 --- /dev/null +++ b/docs/python_modules.rst @@ -0,0 +1,42 @@ +Python Submodules +================= + +app.modules.npscorer module +--------------------------- + +.. automodule:: app.modules.npscorer + :members: + :undoc-members: + :show-inheritance: + +app.modules.depiction module +---------------------------- + +.. automodule:: app.modules.depiction + :members: + :undoc-members: + :show-inheritance: + +app.modules.decimer module +---------------------------- + +.. automodule:: app.modules.decimer + :members: + :undoc-members: + :show-inheritance: + +app.modules.classyfire module +----------------------------- + +.. automodule:: app.modules.classyfire + :members: + :undoc-members: + :show-inheritance: + +app.modules.alldescriptors module +--------------------------------- + +.. automodule:: app.modules.alldescriptors + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..f5e3ced --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,33 @@ +uvicorn>=0.15.0,<0.16.0 +fastapi>=0.80.0 +fastapi-pagination==0.10.0 +fastapi-versioning>=0.10.0 +prometheus-fastapi-instrumentator +jpype1==1.4.1 +jinja2 +pandas +chembl_structure_pipeline +HOSE_code_generator @ git+https://github.com/Ratsemaat/HOSE_code_generator +websockets==10.4 +pillow==9.4.0 +opencv-python==4.7.0.68 +matplotlib==3.4.3 +scikit-image +pdf2image==1.16.2 +IPython +pystow>=0.4.9 +unicodedata2==15.0.0 +efficientnet +tensorflow>=2.10.1 +pillow-heif==0.10.0 +selfies>=2.1.1 +httpx>=0.24.1 +keras_preprocessing==1.1.2 +nbsphinx +sphinx-autodoc-typehints +sphinx_rtd_theme +furo +openbabel-wheel +imantics==0.1.12 +rdkit + diff --git a/docs/toolkits.rst b/docs/toolkits.rst new file mode 100644 index 0000000..d13ca1e --- /dev/null +++ b/docs/toolkits.rst @@ -0,0 +1,26 @@ +Toolkits +======== + +app.modules.toolkits.rdkit_wrapper module +----------------------------------------- + +.. automodule:: app.modules.toolkits.rdkit_wrapper + :members: + :undoc-members: + :show-inheritance: + +app.modules.toolkits.cdk_wrapper module +----------------------------------------- + +.. automodule:: app.modules.toolkits.cdk_wrapper + :members: + :undoc-members: + :show-inheritance: + +app.modules.toolkits.openbabel_wrapper module +--------------------------------------------- + +.. automodule:: app.modules.toolkits.openbabel_wrapper + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/tools.rst b/docs/tools.rst new file mode 100644 index 0000000..51147f8 --- /dev/null +++ b/docs/tools.rst @@ -0,0 +1,18 @@ +Tools +===== + +app.modules.tools.surge module +------------------------------ + +.. automodule:: app.modules.tools.surge + :members: + :undoc-members: + :show-inheritance: + +app.modules.tools.sugarremoval module +------------------------------------- + +.. automodule:: app.modules.tools.sugarremoval + :members: + :undoc-members: + :show-inheritance: