diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d192c9a..c2c7221 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,10 +7,11 @@ repos: - id: check-yaml - id: debug-statements - id: requirements-txt-fixer -- repo: https://github.com/DanielNoord/pydocstringformatter - rev: v0.7.3 +- repo: https://github.com/PyCQA/docformatter + rev: v1.7.1 hooks: - - id: pydocstringformatter + - id: docformatter + args: [--in-place] - repo: https://github.com/psf/black rev: 22.6.0 hooks: diff --git a/app/__init__.py b/app/__init__.py index 46f2261..f57ddd9 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -1,11 +1,18 @@ # -*- coding: utf-8 -*- -""" -Cheminformatics Microservice Python Modules. +"""Cheminformatics Microservice Python Modules. -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). +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). -For comments, bug reports or feature requests, -please raise an issue on our GitHub repository. +For comments, bug reports or feature requests, please raise an issue on +our GitHub repository. """ from __future__ import annotations diff --git a/app/exception_handlers.py b/app/exception_handlers.py index ae7e004..1a3a56a 100644 --- a/app/exception_handlers.py +++ b/app/exception_handlers.py @@ -11,8 +11,7 @@ def __init__(self, name: str, value: str): async def input_exception_handler(request: Request, exc: InvalidInputException): - """ - Custom exception handler for InvalidInputException. + """Custom exception handler for InvalidInputException. Args: request (Request): The FastAPI Request object. diff --git a/app/main.py b/app/main.py index 3a92a66..45dc547 100644 --- a/app/main.py +++ b/app/main.py @@ -103,8 +103,7 @@ async def root(): response_model=HealthCheck, ) def get_health() -> HealthCheck: - """ - ## Perform a Health Check. + """## Perform a Health Check. Endpoint to perform a health check on. This endpoint can primarily be used by Docker to ensure a robust container orchestration and management are in place. Other diff --git a/app/modules/all_descriptors.py b/app/modules/all_descriptors.py index 61f4bcf..5ef9ca4 100644 --- a/app/modules/all_descriptors.py +++ b/app/modules/all_descriptors.py @@ -20,8 +20,7 @@ def get_all_rdkit_descriptors(molecule: any) -> Union[tuple, str]: - """ - Calculate a selected set of molecular descriptors using RDKit. + """Calculate a selected set of molecular descriptors using RDKit. This function takes an input SMILES string and calculates various molecular descriptors using RDKit. @@ -79,8 +78,7 @@ def get_all_rdkit_descriptors(molecule: any) -> Union[tuple, str]: def get_all_cdk_descriptors(molecule: any) -> Union[tuple, str]: - """ - Calculate a set of molecular descriptors using the CDK. + """Calculate a set of molecular descriptors using the CDK. This function takes a SMILES string as input and calculates various molecular descriptors using the CDK. The calculated descriptors are returned as a tuple. @@ -196,8 +194,8 @@ def get_all_cdk_descriptors(molecule: any) -> Union[tuple, str]: def get_cdk_rdkit_combined_descriptors( smiles: str, ) -> Union[dict, str]: - """ - Calculate a selected set of molecular descriptors using CDK and RDKit for a given SMILES string. + """Calculate a selected set of molecular descriptors using CDK and RDKit + for a given SMILES string. Args: smiles (str): A SMILES string representing a chemical compound. @@ -252,8 +250,7 @@ def get_cdk_rdkit_combined_descriptors( def get_table(tanimoto_values: list) -> str: - """ - Convert a list of Tanimoto similarity values into an HTML table. + """Convert a list of Tanimoto similarity values into an HTML table. Args: tanimoto_values (list): A list of lists containing Tanimoto similarity values. @@ -282,8 +279,7 @@ def get_table(tanimoto_values: list) -> str: def get_tanimoto_similarity(smileslist: str, toolkit: str = "cdk") -> list: - """ - Calculate the Tanimoto similarity index between pairs of SMILES strings. + """Calculate the Tanimoto similarity index between pairs of SMILES strings. This function takes a list of SMILES strings, splits them, and calculates the Tanimoto similarity index between every pair of SMILES strings. diff --git a/app/modules/classyfire.py b/app/modules/classyfire.py index 9bfc42c..2652f1c 100644 --- a/app/modules/classyfire.py +++ b/app/modules/classyfire.py @@ -6,8 +6,8 @@ async def classify(smiles: str) -> dict: - """ - This function queries the ClassyFire API to classify a chemical compound. + """This function queries the ClassyFire API to classify a chemical + compound. represented by a SMILES string. @@ -43,8 +43,7 @@ async def classify(smiles: str) -> dict: async def result(id: str) -> dict: - """ - Fetches JSON response from the ClassyFire API for a given ID. + """Fetches JSON response from the ClassyFire API for a given ID. This function takes an ID and retrieves the corresponding chemical classification information from the ClassyFire API in JSON format. diff --git a/app/modules/coconut/descriptors.py b/app/modules/coconut/descriptors.py index f029eb2..afe9521 100644 --- a/app/modules/coconut/descriptors.py +++ b/app/modules/coconut/descriptors.py @@ -13,8 +13,7 @@ def get_descriptors(smiles: str, toolkit: str) -> Union[tuple, str]: - """ - Calculate descriptors using RDKit or CDK toolkit for the given SMILES. + """Calculate descriptors using RDKit or CDK toolkit for the given SMILES. Args: smiles (str): SMILES input. @@ -36,8 +35,8 @@ def get_descriptors(smiles: str, toolkit: str) -> Union[tuple, str]: def get_COCONUT_descriptors(smiles: str, toolkit: str) -> Union[Dict[str, float], str]: - """ - Calculate COCONUT descriptors using RDKit or CDK toolkit for the given SMILES. + """Calculate COCONUT descriptors using RDKit or CDK toolkit for the given + SMILES. Args: smiles (str): SMILES input. diff --git a/app/modules/coconut/preprocess.py b/app/modules/coconut/preprocess.py index 0180bde..dd2a710 100644 --- a/app/modules/coconut/preprocess.py +++ b/app/modules/coconut/preprocess.py @@ -10,8 +10,7 @@ def get_mol_block(input_text: str) -> str: - """ - Generate a Molblock from input text using CDK. + """Generate a Molblock from input text using CDK. Args: input_text (str): Input text (Mol/SMILES). @@ -38,8 +37,7 @@ def get_mol_block(input_text: str) -> str: def get_molecule_hash(molecule: any) -> dict: - """ - Return various molecule hashes for the provided SMILES. + """Return various molecule hashes for the provided SMILES. Args: smiles (str): Standardized SMILES string. @@ -65,8 +63,7 @@ def get_molecule_hash(molecule: any) -> dict: def get_representations(molecule: any) -> dict: - """ - Return COCONUT representations for the provided SMILES. + """Return COCONUT representations for the provided SMILES. Args: smiles (str): SMILES string. @@ -85,8 +82,8 @@ def get_representations(molecule: any) -> dict: def get_COCONUT_preprocessing(input_text: str) -> dict: - """ - Preprocess user input text suitable for the COCONUT database submission data. + """Preprocess user input text suitable for the COCONUT database submission + data. Args: input_text (str): Input text (Mol/str). diff --git a/app/modules/decimer.py b/app/modules/decimer.py index 5452885..a4c2c95 100644 --- a/app/modules/decimer.py +++ b/app/modules/decimer.py @@ -9,8 +9,8 @@ def convert_image(path: str) -> str: - """ - Convert a GIF image to PNG format, resize, and place on a white background. + """Convert a GIF image to PNG format, resize, and place on a white + background. Args: path (str): The path to the GIF image file. @@ -53,8 +53,8 @@ def convert_image(path: str) -> str: def get_segments(path: str) -> tuple: - """ - Takes an image file path and returns a set of paths and image names of segmented images. + """Takes an image file path and returns a set of paths and image names of + segmented images. Args: input_path (str): the path of an image. @@ -75,8 +75,7 @@ def get_segments(path: str) -> tuple: def get_predicted_segments(path: str) -> str: - """ - Get predicted SMILES representations for segments within an image. + """Get predicted SMILES representations for segments within an image. This function takes an image path, extracts segments, predicts SMILES representations for each segment, and returns a concatenated string of predicted SMILES. @@ -106,8 +105,8 @@ def get_predicted_segments(path: str) -> str: def get_predicted_segments_from_file(content: any, filename: str) -> tuple: - """ - Takes an image file path and returns a set of paths and image names of segmented images. + """Takes an image file path and returns a set of paths and image names of + segmented images. Args: input_path (str): the path of an image. diff --git a/app/modules/depiction.py b/app/modules/depiction.py index e67cfae..b8967a7 100644 --- a/app/modules/depiction.py +++ b/app/modules/depiction.py @@ -18,8 +18,7 @@ def get_cdk_depiction( CIP=True, unicolor=False, ): - """ - This function takes the user input SMILES and Depicts it. + """This function takes the user input SMILES and Depicts it. using the CDK Depiction Generator. @@ -91,8 +90,8 @@ def get_cdk_depiction( def get_rdkit_depiction(molecule: any, molSize=(512, 512), rotate=0, kekulize=True): - """ - This function takes the user input SMILES and Canonicalize it using the RDKit. + """This function takes the user input SMILES and Canonicalize it using the + RDKit. Args: molecule (Chem.Mol): RDKit molecule object. diff --git a/app/modules/npscorer.py b/app/modules/npscorer.py index 01932b6..c4f048b 100644 --- a/app/modules/npscorer.py +++ b/app/modules/npscorer.py @@ -23,8 +23,7 @@ def get_np_model(model_path) -> dict: - """ - Load the NP model from a pickle file. + """Load the NP model from a pickle file. Parameters: model_path (str): Path to the pickled model file. @@ -37,8 +36,7 @@ def get_np_model(model_path) -> dict: def score_mol_with_confidence(molecule) -> dict: - """ - Calculate NP-likeness score and confidence for a molecule. + """Calculate NP-likeness score and confidence for a molecule. Args: molecule (rdkit.Chem.rdchem.Mol): The input molecule. @@ -74,8 +72,7 @@ def score_mol_with_confidence(molecule) -> dict: def score_mol(molecule) -> float: - """ - Calculate the Natural Product Likeness score for a given molecule. + """Calculate the Natural Product Likeness score for a given molecule. Parameters: molecule (rdkit.Chem.Mol): RDKit molecule object. @@ -88,8 +85,8 @@ def score_mol(molecule) -> float: def get_np_score(molecule: any) -> str: - """ - Convert SMILES string to RDKit molecule object and generate the NP Score. + """Convert SMILES string to RDKit molecule object and generate the NP + Score. Parameters: molecule (Chem.Mol): RDKit molecule object. diff --git a/app/modules/toolkits/cdk_wrapper.py b/app/modules/toolkits/cdk_wrapper.py index 180f20f..d21c969 100644 --- a/app/modules/toolkits/cdk_wrapper.py +++ b/app/modules/toolkits/cdk_wrapper.py @@ -65,8 +65,7 @@ def get_CDK_IAtomContainer(smiles: str): - """ - This function takes the input SMILES and creates a CDK IAtomContainer. + """This function takes the input SMILES and creates a CDK IAtomContainer. Args: smiles (str): SMILES string as input. @@ -83,8 +82,7 @@ def get_CDK_IAtomContainer(smiles: str): def get_CDK_SDG(molecule: any): - """ - This function takes the input IAtomContainer and Creates a. + """This function takes the input IAtomContainer and Creates a. Structure Diagram Layout using the CDK. @@ -104,8 +102,8 @@ def get_CDK_SDG(molecule: any): def get_CDK_SDG_mol(molecule: any, V3000=False) -> str: - """ - Returns a mol block string with Structure Diagram Layout for the given SMILES. + """Returns a mol block string with Structure Diagram Layout for the given + SMILES. Args: molecule (IAtomContainer): molecule given by the user. @@ -125,8 +123,7 @@ def get_CDK_SDG_mol(molecule: any, V3000=False) -> str: def get_murko_framework(molecule: any) -> str: - """ - This function takes the user input SMILES and returns. + """This function takes the user input SMILES and returns. the Murko framework @@ -146,8 +143,7 @@ def get_murko_framework(molecule: any) -> str: def get_aromatic_ring_count(molecule) -> int: - """ - Calculate the number of aromatic rings present in a given molecule. + """Calculate the number of aromatic rings present in a given molecule. Args: molecule (IAtomContainer): molecule given by the user. @@ -178,8 +174,7 @@ def get_aromatic_ring_count(molecule) -> int: def get_vander_waals_volume(molecule: any) -> float: - """ - Calculate the Van der Waals volume of a given molecule. + """Calculate the Van der Waals volume of a given molecule. Args: molecule (IAtomContainer): molecule given by the user. @@ -199,16 +194,14 @@ def get_vander_waals_volume(molecule: any) -> float: def get_CDK_descriptors(molecule: any) -> Union[tuple, str]: - """ - Take an input SMILES and generate a selected set of molecular. + """Take an input SMILES and generate a selected set of molecular. descriptors generated using CDK as a list. - Args (str): - molecule (IAtomContainer): molecule given by the user. + Args (str): molecule (IAtomContainer): molecule given by the + user. - Returns (list): - A list of calculated descriptors. + Returns (list): A list of calculated descriptors. """ SDGMol = get_CDK_SDG(molecule) if SDGMol: @@ -309,8 +302,8 @@ def get_CDK_descriptors(molecule: any) -> Union[tuple, str]: def get_tanimoto_similarity_PubChem_CDK(mol1: any, mol2: any) -> str: - """ - Calculate the Tanimoto similarity index between two molecules using PubChem fingerprints. + """Calculate the Tanimoto similarity index between two molecules using + PubChem fingerprints. Args: mol1 (IAtomContainer): First molecule given by the user. @@ -367,8 +360,8 @@ def get_tanimoto_similarity_PubChem_CDK(mol1: any, mol2: any) -> str: def get_tanimoto_similarity_ECFP_CDK(mol1: any, mol2: any, ECFP: int = 2) -> str: - """ - Calculate the Tanimoto similarity index between two molecules using CircularFingerprinter fingerprints. + """Calculate the Tanimoto similarity index between two molecules using + CircularFingerprinter fingerprints. https://cdk.github.io/cdk/2.8/docs/api/org/openscience/cdk/fingerprint/CircularFingerprinter.html @@ -412,8 +405,8 @@ def get_tanimoto_similarity_CDK( fingerprinter: str = "PubChem", ECFP: int = 6, ) -> float: - """ - Calculate the Tanimoto similarity between two molecules using PubChem/CircularFingerprints in CDK. + """Calculate the Tanimoto similarity between two molecules using + PubChem/CircularFingerprints in CDK. Args: mol1 (IAtomContainer): First molecule given by the user. @@ -440,8 +433,8 @@ def get_tanimoto_similarity_CDK( def get_cip_annotation(molecule: any) -> str: - """ - Return the CIP (Cahn–Ingold–Prelog) annotations using the CDK CIP toolkit. + """Return the CIP (Cahn–Ingold–Prelog) annotations using the CDK CIP + toolkit. This function takes a SMILES (Simplified Molecular Input Line Entry System) string as input and returns a CIP annotated molecule block using the CDK CIP toolkit. @@ -557,8 +550,8 @@ def get_cip_annotation(molecule: any) -> str: def get_CXSMILES(molecule: any) -> str: - """ - Generate CXSMILES representation with 2D atom coordinates from the given SMILES. + """Generate CXSMILES representation with 2D atom coordinates from the given + SMILES. Args: molecule (IAtomContainer): molecule given by the user. @@ -576,8 +569,8 @@ def get_CXSMILES(molecule: any) -> str: def get_canonical_SMILES(molecule: any) -> str: - """ - Generate Canonical SMILES representation with 2D atom coordinates from the given SMILES. + """Generate Canonical SMILES representation with 2D atom coordinates from + the given SMILES. Args: molecule (IAtomContainer): molecule given by the user. @@ -595,8 +588,7 @@ def get_canonical_SMILES(molecule: any) -> str: def get_InChI(molecule: any, InChIKey=False) -> str: - """ - Generate InChI or InChIKey from the given SMILES string. + """Generate InChI or InChIKey from the given SMILES string. Args: molecule (IAtomContainer): molecule given by the user. @@ -617,8 +609,7 @@ def get_InChI(molecule: any, InChIKey=False) -> str: def get_smiles_opsin(input_text: str) -> str: - """ - Convert IUPAC chemical name to SMILES notation using OPSIN. + """Convert IUPAC chemical name to SMILES notation using OPSIN. Parameters: - input_text (str): The IUPAC chemical name to be converted. @@ -655,8 +646,7 @@ async def get_CDK_HOSE_codes( noOfSpheres: int, ringsize: bool, ) -> List[str]: - """ - Generate CDK-generated HOSECodes for the given SMILES. + """Generate CDK-generated HOSECodes for the given SMILES. Args: molecule (IAtomContainer): molecule given by the user. diff --git a/app/modules/toolkits/helpers.py b/app/modules/toolkits/helpers.py index e4e9b2f..57746d4 100644 --- a/app/modules/toolkits/helpers.py +++ b/app/modules/toolkits/helpers.py @@ -10,8 +10,7 @@ def parse_input(input: str, framework: str = "rdkit", standardize: bool = False): - """ - Parse and check if the input is valid. + """Parse and check if the input is valid. Args: input (str): Input string. @@ -29,8 +28,7 @@ def parse_input(input: str, framework: str = "rdkit", standardize: bool = False) def parse_SMILES(smiles: str, framework: str = "rdkit", standardize: bool = False): - """ - Check whether the input SMILES string is valid. + """Check whether the input SMILES string is valid. If not, attempt to standardize the molecule using the ChEMBL standardization pipeline. diff --git a/app/modules/toolkits/openbabel_wrapper.py b/app/modules/toolkits/openbabel_wrapper.py index 1e2565e..81264e3 100644 --- a/app/modules/toolkits/openbabel_wrapper.py +++ b/app/modules/toolkits/openbabel_wrapper.py @@ -7,8 +7,7 @@ def get_ob_canonical_SMILES(smiles: str) -> str: - """ - Convert a SMILES string to Canonical SMILES. + """Convert a SMILES string to Canonical SMILES. Args: smiles (str): Input SMILES string. @@ -34,8 +33,7 @@ def get_ob_canonical_SMILES(smiles: str) -> str: def get_ob_InChI(smiles: str, InChIKey: bool = False) -> str: - """ - Convert a SMILES string to InChI. + """Convert a SMILES string to InChI. Args: smiles (str): Input SMILES string. @@ -68,8 +66,7 @@ def get_ob_InChI(smiles: str, InChIKey: bool = False) -> str: def get_ob_mol(smiles: str, threeD: bool = False, depict: bool = False) -> str: - """ - Convert a SMILES string to a 2D/3D mol block. + """Convert a SMILES string to a 2D/3D mol block. Args: smiles (str): Input SMILES string. diff --git a/app/modules/toolkits/rdkit_wrapper.py b/app/modules/toolkits/rdkit_wrapper.py index 50c93b9..7e1bce0 100644 --- a/app/modules/toolkits/rdkit_wrapper.py +++ b/app/modules/toolkits/rdkit_wrapper.py @@ -22,8 +22,7 @@ def check_RO5_violations(molecule: any) -> int: - """ - Check the molecule for violations of Lipinski's Rule of Five. + """Check the molecule for violations of Lipinski's Rule of Five. Args: molecule (Chem.Mol): RDKit molecule object. @@ -44,8 +43,8 @@ def check_RO5_violations(molecule: any) -> int: def get_rdkit_descriptors(molecule: any) -> Union[tuple, str]: - """ - Calculate a selected set of molecular descriptors for the input SMILES string. + """Calculate a selected set of molecular descriptors for the input SMILES + string. Args: molecule (Chem.Mol): RDKit molecule object. @@ -98,8 +97,7 @@ def get_rdkit_descriptors(molecule: any) -> Union[tuple, str]: def get_3d_conformers(molecule: any, depict=True) -> Chem.Mol: - """ - Convert a SMILES string to an RDKit Mol object with 3D coordinates. + """Convert a SMILES string to an RDKit Mol object with 3D coordinates. Args: molecule (Chem.Mol): RDKit molecule object. @@ -135,8 +133,8 @@ def get_tanimoto_similarity_rdkit( radius=2, nBits=2048, ) -> Union[float, str]: - """ - Calculate the Tanimoto similarity index between two molecular structures represented as RDKit Mol objects. + """Calculate the Tanimoto similarity index between two molecular structures + represented as RDKit Mol objects. This function computes the Tanimoto similarity index, a measure of structural similarity, between two chemical compounds using various fingerprinting methods available in RDKit. @@ -189,8 +187,7 @@ def get_tanimoto_similarity_rdkit( async def get_rdkit_HOSE_codes(molecule: any, noOfSpheres: int) -> List[str]: - """ - Calculate and retrieve RDKit HOSE codes for a given SMILES string. + """Calculate and retrieve RDKit HOSE codes for a given SMILES string. This function takes a SMILES string as input and returns the calculated HOSE codes. @@ -214,8 +211,8 @@ async def get_rdkit_HOSE_codes(molecule: any, noOfSpheres: int) -> List[str]: def is_valid_molecule(input_text) -> Union[str, bool]: - """ - Check whether the input text represents a valid molecule in SMILES or Molblock format. + """Check whether the input text represents a valid molecule in SMILES or + Molblock format. Args: input_text (str): SMILES string or Molblock. @@ -238,8 +235,7 @@ def is_valid_molecule(input_text) -> Union[str, bool]: def has_stereochemistry(molecule: any) -> bool: - """ - Check if the given SMILES string contains stereochemistry information. + """Check if the given SMILES string contains stereochemistry information. Args: molecule (Chem.Mol): RDKit molecule object. @@ -259,8 +255,7 @@ def has_stereochemistry(molecule: any) -> bool: def get_2d_mol(molecule: any) -> str: - """ - Generate a 2D Mol block representation from a given SMILES string. + """Generate a 2D Mol block representation from a given SMILES string. Args: molecule (Chem.Mol): RDKit molecule object. @@ -277,8 +272,8 @@ def get_2d_mol(molecule: any) -> str: def get_rdkit_CXSMILES(molecule: any) -> str: - """ - Generate CXSMILES representation with coordinates from a given SMILES string. + """Generate CXSMILES representation with coordinates from a given SMILES + string. Args: molecule (Chem.Mol): RDKit molecule object. @@ -294,8 +289,7 @@ def get_rdkit_CXSMILES(molecule: any) -> str: def get_properties(sdf_file) -> dict: - """ - Extracts properties from a single molecule contained in an SDF file. + """Extracts properties from a single molecule contained in an SDF file. This function uses the RDKit library to read an SDF (Structure-Data File) and extract properties from the first molecule in the file. It checks if the supplied SDF file contains a valid molecule @@ -327,8 +321,7 @@ def get_properties(sdf_file) -> dict: def get_sas_score(molecule: any) -> float: - """ - Calculate the Synthetic Accessibility Score (SAS) for a given molecule. + """Calculate the Synthetic Accessibility Score (SAS) for a given molecule. The Synthetic Accessibility Score is a measure of how easy or difficult it is to synthesize a given molecule. A higher score indicates a molecule that is more challenging to synthesize, while a lower score suggests a molecule @@ -360,8 +353,7 @@ def get_sas_score(molecule: any) -> float: def get_PAINS(molecule: any) -> Union[bool, Tuple[str, str]]: - """ - Check if a molecule contains a PAINS (Pan Assay INterference compoundS). + """Check if a molecule contains a PAINS (Pan Assay INterference compoundS). substructure. @@ -392,8 +384,7 @@ def get_PAINS(molecule: any) -> Union[bool, Tuple[str, str]]: def get_GhoseFilter(molecule: any) -> bool: - """ - Determine if a molecule satisfies Ghose's filter criteria. + """Determine if a molecule satisfies Ghose's filter criteria. Ghose's filter is a set of criteria for drug-like molecules. This function checks if a given molecule meets the criteria defined by Ghose. @@ -428,8 +419,7 @@ def get_GhoseFilter(molecule: any) -> bool: def get_VeberFilter(molecule: any) -> bool: - """ - Apply the Veber filter to evaluate the drug-likeness of a molecule. + """Apply the Veber filter to evaluate the drug-likeness of a molecule. The Veber filter assesses drug-likeness based on two criteria: the number of rotatable bonds and the polar surface area (TPSA). A molecule is considered @@ -462,8 +452,8 @@ def get_VeberFilter(molecule: any) -> bool: def get_REOSFilter(molecule: any) -> bool: - """ - Determine if a molecule passes the REOS (Rapid Elimination Of Swill) filter. + """Determine if a molecule passes the REOS (Rapid Elimination Of Swill) + filter. The REOS filter is a set of criteria that a molecule must meet to be considered a viable drug-like compound. This function takes a molecule as input and checks @@ -506,8 +496,7 @@ def get_REOSFilter(molecule: any) -> bool: def get_RuleofThree(molecule: any) -> bool: - """ - Check if a molecule meets the Rule of Three criteria. + """Check if a molecule meets the Rule of Three criteria. The Rule of Three is a guideline for drug-likeness in chemical compounds. It suggests that a molecule is more likely to be a good drug candidate if it @@ -537,8 +526,8 @@ def get_RuleofThree(molecule: any) -> bool: def get_ertl_functional_groups(molecule: any) -> list: - """ - This function takes an organic molecule as input and uses the algorithm proposed by Peter Ertl to. + """This function takes an organic molecule as input and uses the algorithm + proposed by Peter Ertl to. identify functional groups within the molecule. The identification is based on the analysis of chemical fragments present in the molecular structure. diff --git a/app/modules/tools/sugar_removal.py b/app/modules/tools/sugar_removal.py index 7596d0d..fbd07d7 100644 --- a/app/modules/tools/sugar_removal.py +++ b/app/modules/tools/sugar_removal.py @@ -4,8 +4,8 @@ def get_sugar_info(molecule: any) -> tuple: - """ - Analyzes a molecule represented by a SMILES string to determine if it contains sugars. + """Analyzes a molecule represented by a SMILES string to determine if it + contains sugars. This function utilizes the Sugar Removal Utility to check for the presence of circular or linear sugars. @@ -36,8 +36,8 @@ def get_sugar_info(molecule: any) -> tuple: def remove_linear_sugar(molecule: any) -> str: - """ - Detects and removes linear sugars from a given SMILES string using the CDK-based. + """Detects and removes linear sugars from a given SMILES string using the + CDK-based. sugar removal utility. @@ -80,8 +80,8 @@ def remove_linear_sugar(molecule: any) -> str: def remove_circular_sugar(molecule: any) -> str: - """ - Detects and removes circular sugars from a given SMILES string using the CDK-based sugar removal utility. + """Detects and removes circular sugars from a given SMILES string using the + CDK-based sugar removal utility. Args: molecule (IAtomContainer): CDK molecule object. @@ -121,7 +121,8 @@ def remove_circular_sugar(molecule: any) -> str: def remove_linear_and_circular_sugar(molecule: any): - """This fucntion detects and removes linear and circular sugars from a give. + """This fucntion detects and removes linear and circular sugars from a + give. SMILES string. Uses the CDK based sugar removal utility. diff --git a/app/modules/tools/surge.py b/app/modules/tools/surge.py index 81b9e4a..3b9b8bf 100644 --- a/app/modules/tools/surge.py +++ b/app/modules/tools/surge.py @@ -7,8 +7,7 @@ def get_heavy_atom_count(formula: str) -> int: - """ - Calculate the heavy atom count from a given molecular formula. + """Calculate the heavy atom count from a given molecular formula. Args: formula (str): The molecular formula of the molecule. @@ -36,8 +35,8 @@ def get_heavy_atom_count(formula: str) -> int: def generate_structures_SURGE(molecular_formula: str) -> Union[list, str]: - """ - Generate chemical structures using the surge tool based on the canonical generation path method. + """Generate chemical structures using the surge tool based on the canonical + generation path method. Args: molecular_formula (str): Molecular formula provided by the user. diff --git a/app/routers/chem.py b/app/routers/chem.py index 6cf4019..24775b6 100644 --- a/app/routers/chem.py +++ b/app/routers/chem.py @@ -89,8 +89,7 @@ response_model=HealthCheck, ) def get_health() -> HealthCheck: - """ - ## Perform a Health Check. + """## Perform a Health Check. Endpoint to perform a health check on. This endpoint can primarily be used by Docker to ensure a robust container orchestration and management are in place. Other @@ -131,8 +130,8 @@ async def get_stereoisomers( }, ), ): - """ - For a given SMILES string this function enumerates all possible stereoisomers. + """For a given SMILES string this function enumerates all possible + stereoisomers. Parameters: - **SMILES**: required (query parameter): The SMILES string to be enumerated. @@ -189,8 +188,7 @@ async def get_descriptors( description="Cheminformatics toolkit used in the backend", ), ): - """ - Generates standard descriptors for the input molecule (SMILES). + """Generates standard descriptors for the input molecule (SMILES). Parameters: - **SMILES**: required (query): The SMILES representation of the molecule. @@ -272,8 +270,7 @@ async def get_multiple_descriptors( description="Cheminformatics toolkit used in the backend", ), ): - """ - Retrieve multiple descriptors for a list of SMILES strings. + """Retrieve multiple descriptors for a list of SMILES strings. Parameters: - **SMILES**: required (query): Comma-separated list of SMILES strings. @@ -357,8 +354,7 @@ async def hose_codes( description="Determines whether to include information about ring sizes", ), ): - """ - Generates HOSE codes for a given SMILES string. + """Generates HOSE codes for a given SMILES string. Parameters: - **SMILES**: required (query): The SMILES string represents the chemical compound. @@ -424,8 +420,7 @@ async def standardize_mol( ), ], ): - """ - Standardize molblock using the ChEMBL curation pipeline. + """Standardize molblock using the ChEMBL curation pipeline. and return the standardized molecule, SMILES, InChI, and InCHI-Key. @@ -508,8 +503,8 @@ async def check_errors( description="Flag indicating whether to fix the issues by standardizing the SMILES.", ), ): - """ - Check a given SMILES string and the represented structure for issues and standardize it using the ChEMBL curation pipeline. + """Check a given SMILES string and the represented structure for issues and + standardize it using the ChEMBL curation pipeline. Parameters: - **SMILES**: required (str, query) The SMILES string to check and standardize. @@ -594,8 +589,8 @@ async def np_likeness_score( }, ), ): - """ - Calculates the natural product likeness score based on the RDKit implementation. + """Calculates the natural product likeness score based on the RDKit + implementation. Parameters: - **SMILES**: required (query): The SMILES representation of the molecule. @@ -662,8 +657,8 @@ async def tanimoto_similarity( description="ECFP 2/4/6 are allowed for using CDK Circular fingerprinter. The default is 6", ), ): - """ - Calculate the Tanimoto similarity index for a pair of SMILES strings using specified parameters. + """Calculate the Tanimoto similarity index for a pair of SMILES strings + using specified parameters. Args: smiles (str): A comma-separated pair of SMILES strings for the molecules to compare. @@ -761,8 +756,9 @@ async def coconut_preprocessing( }, ), ): - """ - Generates an Input JSON file with information on different molecular representations and descriptors suitable for submission to the COCONUT database. + """Generates an Input JSON file with information on different molecular + representations and descriptors suitable for submission to the COCONUT + database. Parameters: - **SMILES**: required (query): The SMILES string represents a chemical compound. @@ -818,8 +814,7 @@ async def classyfire_classify( }, ), ): - """ - Generate ClassyFire-based classifications using SMILES as input. + """Generate ClassyFire-based classifications using SMILES as input. Parameters: - **SMILES**: required (query): The SMILES representation of the compound to be classified. @@ -855,8 +850,8 @@ async def classyfire_classify( }, ) async def classyfire_result(jobid: str): - """ - Retrieve the ClassyFire classification results based on the provided Job ID. + """Retrieve the ClassyFire classification results based on the provided Job + ID. To obtain the results from ClassyFire, please initiate a new request and obtain a unique job ID. Once you have the job ID, you need to submit another request using this ID in order to retrieve the desired outcome. @@ -1068,8 +1063,8 @@ async def get_functional_groups( }, ), ): - """ - For a given SMILES string this function generates a list of identified functional groups. + """For a given SMILES string this function generates a list of identified + functional groups. Parameters: - **SMILES**: required (query parameter): The SMILES string to be checked for functional groups. diff --git a/app/routers/converters.py b/app/routers/converters.py index 290fe30..6e90f96 100644 --- a/app/routers/converters.py +++ b/app/routers/converters.py @@ -63,8 +63,7 @@ include_in_schema=False, ) def get_health() -> HealthCheck: - """ - ## Perform a Health Check. + """## Perform a Health Check. Endpoint to perform a health check on. This endpoint can primarily be used by Docker to ensure a robust container orchestration and management are in place. Other @@ -109,8 +108,8 @@ async def create2d_coordinates( description="Cheminformatics toolkit used in the backend", ), ): - """ - Generates 2D Coordinates using the CDK Structure diagram generator/RDKit/Open Babel and returns the mol block. + """Generates 2D Coordinates using the CDK Structure diagram + generator/RDKit/Open Babel and returns the mol block. Parameters: - **SMILES**: required (str): The SMILES string. @@ -177,8 +176,8 @@ async def create3d_coordinates( description="Cheminformatics toolkit used in the backend", ), ): - """ - Generates a random 3D conformer from SMILES using the specified molecule toolkit. + """Generates a random 3D conformer from SMILES using the specified molecule + toolkit. Parameters: - **SMILES**: required (str): The SMILES representation of the molecule. @@ -244,8 +243,7 @@ async def iupac_name_or_selfies_to_smiles( description="Required type of converter for IUPAC", ), ): - """ - Generate SMILES from a given IUPAC name or a SELFIES representation. + """Generate SMILES from a given IUPAC name or a SELFIES representation. Parameters: - **input_text**: required (str): The input text containing either the IUPAC name or SELFIES representation. @@ -318,8 +316,7 @@ async def smiles_canonicalise( description="Cheminformatics toolkit used in the backend", ), ): - """ - Canonicalizes a given SMILES string according to the allowed toolkits. + """Canonicalizes a given SMILES string according to the allowed toolkits. Parameters: - **SMILES**: required (str): The input SMILES string to be canonicalized. @@ -377,8 +374,7 @@ async def smiles_to_cxsmiles( description="Cheminformatics toolkit used in the backend", ), ): - """ - Convert SMILES to CXSMILES. + """Convert SMILES to CXSMILES. For more information: - https://docs.chemaxon.com/display/docs/chemaxon-extended-smiles-and-smarts-cxsmiles-and-cxsmarts.md @@ -443,8 +439,7 @@ async def smiles_to_inchi( description="Cheminformatics toolkit used in the backend", ), ): - """ - Convert SMILES to InChI. + """Convert SMILES to InChI. Parameters: - **SMILES**: required (str): The input SMILES string to convert. @@ -508,8 +503,7 @@ async def smiles_to_inchikey( description="Cheminformatics toolkit used in the backend", ), ): - """ - Convert SMILES to InChI-Key. + """Convert SMILES to InChI-Key. Parameters: - **SMILES**: required (str): The input SMILES string to convert. @@ -570,8 +564,7 @@ async def smiles_to_iupac_name( }, ), ): - """ - Generates IUPAC name using STOUT package. + """Generates IUPAC name using STOUT package. For more information: - Rajan, K., Zielesny, A. & Steinbeck, C. STOUT: SMILES to IUPAC names using neural machine translation. J Cheminform 13, 34 (2021). https://doi.org/10.1186/s13321-021-00512-4 @@ -633,8 +626,7 @@ async def encode_selfies( }, ), ): - """ - Generates SELFIES string for a given SMILES string. + """Generates SELFIES string for a given SMILES string. For more information: - Krenn et al, SELFIES and the future of molecular string representations, Patterns, https://doi.org/10.1016/j.patter.2022.100588. @@ -694,8 +686,7 @@ async def smiles_convert_to_formats( description="Cheminformatics toolkit used in the backend", ), ): - """ - Convert SMILES to various molecular formats using different toolkits. + """Convert SMILES to various molecular formats using different toolkits. Parameters: - **SMILES**: required (str): The input SMILES string to convert. diff --git a/app/routers/depict.py b/app/routers/depict.py index 30bc3b0..0814626 100644 --- a/app/routers/depict.py +++ b/app/routers/depict.py @@ -49,8 +49,7 @@ include_in_schema=False, ) def get_health() -> HealthCheck: - """ - ## Perform a Health Check. + """## Perform a Health Check. Endpoint to perform a health check on. This endpoint can primarily be used by Docker to ensure a robust container orchestration and management are in place. Other @@ -120,8 +119,8 @@ async def depict_2d_molecule( description="Whether to use a single colour for the molecule.", ), ): - """ - Generates a 2D depiction of a molecule using CDK or RDKit with the given parameters. + """Generates a 2D depiction of a molecule using CDK or RDKit with the given + parameters. Parameters: - **SMILES**: required (query): The SMILES representation of the molecule. [required] @@ -205,8 +204,7 @@ async def depict_3d_molecule( description="Cheminformatics toolkit used in the backend", ), ): - """ - Generate 3D depictions of molecules using OpenBabel or RDKit. + """Generate 3D depictions of molecules using OpenBabel or RDKit. Parameters: - **SMILES**: required (str): The SMILES string representing the molecule to depict. diff --git a/app/routers/ocsr.py b/app/routers/ocsr.py index 42fe75f..697ec9c 100644 --- a/app/routers/ocsr.py +++ b/app/routers/ocsr.py @@ -45,8 +45,7 @@ include_in_schema=False, ) def get_health() -> HealthCheck: - """ - ## Perform a Health Check. + """## Perform a Health Check. Endpoint to perform a health check on. This endpoint can primarily be used by Docker to ensure a robust container orchestration and management are in place. Other @@ -98,8 +97,8 @@ async def Extract_ChemicalInfo_From_File( description="Image: Bytes content of the chemical structure depiction image", ), ): - """ - Detect, segment and convert a chemical structure depiction into a SMILES string using the DECIMER modules. + """Detect, segment and convert a chemical structure depiction into a SMILES + string using the DECIMER modules. Parameters: - **path**: optional if img is provided (str): Local or Remote path to the image file. @@ -166,8 +165,8 @@ async def Extract_ChemicalInfo_From_File( async def extract_chemicalinfo_from_upload( file: Annotated[UploadFile, File(description="Chemical structure depiction image")], ): - """ - Detect, segment and convert a chemical structure depiction in the uploaded image file into a SMILES string using the DECIMER modules. + """Detect, segment and convert a chemical structure depiction in the + uploaded image file into a SMILES string using the DECIMER modules. Parameters: - **file**: required (File): Chemical structure depiction image diff --git a/app/routers/tools.py b/app/routers/tools.py index 68c8740..3251ac7 100644 --- a/app/routers/tools.py +++ b/app/routers/tools.py @@ -45,8 +45,7 @@ include_in_schema=False, ) def get_health() -> HealthCheck: - """ - ## Perform a Health Check. + """## Perform a Health Check. Endpoint to perform a health check on. This endpoint can primarily be used by Docker to ensure a robust container orchestration and management are in place. Other @@ -84,8 +83,8 @@ async def generate_structures( }, ), ): - """ - Generates structures using the chemical structure generator based on the canonical generation path method. + """Generates structures using the chemical structure generator based on the + canonical generation path method. For more information refer to: - McKay, B.D., Yirik, M.A. & Steinbeck, C. Surge: a fast open-source chemical graph generator. J Cheminform 14, 24 (2022). https://doi.org/10.1186/s13321-022-00604-9 @@ -143,8 +142,8 @@ async def get_sugar_information( }, ), ): - """ - Get information on whether a given molecule has circular or linear sugars. + """Get information on whether a given molecule has circular or linear + sugars. For more information refer to: - Schaub, J., Zielesny, A., Steinbeck, C. et al. Too sweet: cheminformatics for deglycosylation in natural products. J Cheminform 12, 67 (2020). https://doi.org/10.1186/s13321-020-00467-y. @@ -205,8 +204,8 @@ async def remove_linear_sugars( }, ), ): - """ - Detect and remove linear sugars from a given SMILES string using Sugar Removal Utility. + """Detect and remove linear sugars from a given SMILES string using Sugar + Removal Utility. Parameters: - **SMILES string**: (str): SMILES: string representation of the molecule (required, query parameter) @@ -254,8 +253,8 @@ async def remove_circular_sugars( }, ), ): - """ - Detect and remove circular sugars from a given SMILES string using Sugar Removal Utility. + """Detect and remove circular sugars from a given SMILES string using Sugar + Removal Utility. Parameters: - **SMILES string**: (str): SMILES: string representation of the molecule (required, query parameter) @@ -306,8 +305,8 @@ async def remove_linear_and_circular_sugars( }, ), ): - """ - Detect and remove linear and circular sugars from a given SMILES string using Sugar Removal Utility. + """Detect and remove linear and circular sugars from a given SMILES string + using Sugar Removal Utility. Parameters: - **SMILES string**: (str): SMILES: string representation of the molecule (required, query parameter) diff --git a/app/schemas/chem_schema.py b/app/schemas/chem_schema.py index 35fb46d..2e252ce 100644 --- a/app/schemas/chem_schema.py +++ b/app/schemas/chem_schema.py @@ -9,8 +9,8 @@ class GenerateStereoisomersResponse(BaseModel): - """ - Represents a response containing enumerated stereo isomers for a molecule. + """Represents a response containing enumerated stereo isomers for a + molecule. Properties: - stereoisomers (List[str]): A list of stereoisomer SMILES strings. @@ -23,8 +23,7 @@ class GenerateStereoisomersResponse(BaseModel): ) class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. @@ -42,8 +41,7 @@ class Config: class GenerateDescriptorsResponse(BaseModel): - """ - Represents a successful response containing descriptors for a molecule. + """Represents a successful response containing descriptors for a molecule. Properties: - descriptors (dict): A dictionary of descriptors and their values. @@ -56,8 +54,7 @@ class GenerateDescriptorsResponse(BaseModel): ) class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. @@ -75,8 +72,8 @@ class Config: class GenerateMultipleDescriptorsResponse(BaseModel): - """ - Represents a response containing multiple descriptors for a list of SMILES strings. + """Represents a response containing multiple descriptors for a list of + SMILES strings. Properties: - descriptors (dict): A dictionary with each SMILES as the key and the corresponding descriptors as the value. @@ -89,8 +86,7 @@ class GenerateMultipleDescriptorsResponse(BaseModel): ) class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. @@ -108,8 +104,7 @@ class Config: class GenerateHOSECodeResponse(BaseModel): - """ - Represents a response containing HOSE codes for a molecule. + """Represents a response containing HOSE codes for a molecule. Properties: - hose_codes (List[str]): A list of HOSE codes for each atom in the molecule. @@ -122,8 +117,7 @@ class GenerateHOSECodeResponse(BaseModel): ) class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. @@ -141,8 +135,7 @@ class Config: class GenerateStandardizeResponse(BaseModel): - """ - Represents a response containing standardized molecule information. + """Represents a response containing standardized molecule information. Properties: - standardized_mol (str): The standardized molblock of the molecule. @@ -173,8 +166,7 @@ class GenerateStandardizeResponse(BaseModel): ) class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. @@ -197,8 +189,7 @@ class Config: class NPlikelinessScoreResponse(BaseModel): - """ - Represents a response containing the natural product likeness score. + """Represents a response containing the natural product likeness score. Properties: - np_score (float): The calculated natural product likeness score. @@ -211,8 +202,7 @@ class NPlikelinessScoreResponse(BaseModel): ) class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. @@ -230,8 +220,7 @@ class Config: class TanimotoSimilarityResponse(BaseModel): - """ - Represents the Tanimoto similarity index for a pair of SMILES strings. + """Represents the Tanimoto similarity index for a pair of SMILES strings. Properties: - similarity (float): The Tanimoto similarity index. @@ -244,8 +233,7 @@ class TanimotoSimilarityResponse(BaseModel): ) class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. @@ -263,8 +251,7 @@ class Config: class TanimotoMatrixResponse(BaseModel): - """ - Response model for Tanimoto similarity matrix. + """Response model for Tanimoto similarity matrix. Attributes: - similarity_matrix (List[List[float]]): A 2D list representing the Tanimoto similarity matrix. @@ -279,8 +266,7 @@ class TanimotoMatrixResponse(BaseModel): ) class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. @@ -298,8 +284,7 @@ class Config: class FilteredMoleculesResponse(BaseModel): - """ - Represents a response containing standardized molecule information. + """Represents a response containing standardized molecule information. Properties: - filtered_smiles (str): The canonical SMILES representation of the molecule. @@ -318,8 +303,7 @@ class FilteredMoleculesResponse(BaseModel): ) class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. @@ -337,8 +321,8 @@ class Config: class GenerateFunctionalGroupResponse(BaseModel): - """ - Represents a response containing a list of identified functional groups in the molecule. + """Represents a response containing a list of identified functional groups + in the molecule. Properties: - stereoisomers (List[str]): a list of identified functional groups in the molecule @@ -351,8 +335,7 @@ class GenerateFunctionalGroupResponse(BaseModel): ) class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. diff --git a/app/schemas/chemblstandardizer.py b/app/schemas/chemblstandardizer.py index d10f7c1..8e0a367 100644 --- a/app/schemas/chemblstandardizer.py +++ b/app/schemas/chemblstandardizer.py @@ -4,8 +4,7 @@ class SMILESValidationResult(BaseModel): - """ - Represents the result of validating a SMILES string. + """Represents the result of validating a SMILES string. Attributes: smi (str): The SMILES string. @@ -17,8 +16,7 @@ class SMILESValidationResult(BaseModel): class SMILESStandardizedResult(BaseModel): - """ - Represents the original and standardized versions of a molecule. + """Represents the original and standardized versions of a molecule. Attributes: original (SMILESValidationResult): The original SMILES validation result. @@ -30,8 +28,7 @@ class SMILESStandardizedResult(BaseModel): class StandardizedResult(BaseModel): - """ - Represents a standardized result for a molecule. + """Represents a standardized result for a molecule. Attributes: standardized_mol (str): The standardized molecule representation. diff --git a/app/schemas/classyfire.py b/app/schemas/classyfire.py index 4138188..088c43f 100644 --- a/app/schemas/classyfire.py +++ b/app/schemas/classyfire.py @@ -8,8 +8,7 @@ class ClassyFireJob(BaseModel): - """ - Represents a ClassyFire job. + """Represents a ClassyFire job. Attributes: id (int): The ID of the job. @@ -45,8 +44,7 @@ class ClassyFireJob(BaseModel): class Kingdom(BaseModel): - """ - Represents a Kingdom in ClassyFire taxonomy. + """Represents a Kingdom in ClassyFire taxonomy. Attributes: name (str): The name of the Kingdom. @@ -62,8 +60,7 @@ class Kingdom(BaseModel): class Superclass(BaseModel): - """ - Represents a Superclass in ClassyFire taxonomy. + """Represents a Superclass in ClassyFire taxonomy. Attributes: name (str): The name of the Superclass. @@ -79,8 +76,7 @@ class Superclass(BaseModel): class Class(BaseModel): - """ - Represents a Class in ClassyFire taxonomy. + """Represents a Class in ClassyFire taxonomy. Attributes: name (str): The name of the Class. @@ -96,8 +92,7 @@ class Class(BaseModel): class Subclass(BaseModel): - """ - Represents a Subclass within a classification. + """Represents a Subclass within a classification. Attributes: name (str): The name of the subclass. @@ -113,8 +108,7 @@ class Subclass(BaseModel): class DirectParent(BaseModel): - """ - Represents a Direct Parent within a classification. + """Represents a Direct Parent within a classification. Attributes: name (str): The name of the direct parent. @@ -130,8 +124,7 @@ class DirectParent(BaseModel): class ExternalDescriptor(BaseModel): - """ - Represents an External Descriptor associated with an Entity. + """Represents an External Descriptor associated with an Entity. Attributes: source (str): The source of the external descriptor. @@ -145,8 +138,7 @@ class ExternalDescriptor(BaseModel): class Entity(BaseModel): - """ - Represents a chemical Entity with classification information. + """Represents a chemical Entity with classification information. Attributes: identifier (str): Unique identifier for the entity. @@ -190,8 +182,7 @@ class Entity(BaseModel): class ClassyFireResult(BaseModel): - """ - Represents a classification result from ClassyFire. + """Represents a classification result from ClassyFire. Attributes: id (int): Identifier for the result. diff --git a/app/schemas/coconut.py b/app/schemas/coconut.py index 2db05c7..d9e89e6 100644 --- a/app/schemas/coconut.py +++ b/app/schemas/coconut.py @@ -5,8 +5,7 @@ class MoleculeHash(BaseModel): - """ - Represents a molecule's hash information. + """Represents a molecule's hash information. Attributes: Formula (str): Chemical formula of the molecule. @@ -20,8 +19,7 @@ class MoleculeHash(BaseModel): class Representations(BaseModel): - """ - Represents different representations of a molecule. + """Represents different representations of a molecule. Attributes: InChI (str): IUPAC International Chemical Identifier (InChI) representation. @@ -35,8 +33,7 @@ class Representations(BaseModel): class Descriptors(BaseModel): - """ - Represents a collection of molecular descriptors. + """Represents a collection of molecular descriptors. This class provides a structure for storing various molecular descriptors that characterize a molecule's chemical properties. @@ -91,8 +88,7 @@ class Descriptors(BaseModel): class Parent(BaseModel): - """ - Represents the parent molecule with various properties. + """Represents the parent molecule with various properties. Attributes: field_2D_mol (str): The 2D molecular structure of the parent molecule. @@ -110,8 +106,7 @@ class Parent(BaseModel): class COCONUTPreprocessingModel(BaseModel): - """ - Represents a molecule after CocoNut preprocessing. + """Represents a molecule after CocoNut preprocessing. Attributes: original_mol (str): Original molecule information. diff --git a/app/schemas/converters_schema.py b/app/schemas/converters_schema.py index 1aacc4c..a9bcadb 100644 --- a/app/schemas/converters_schema.py +++ b/app/schemas/converters_schema.py @@ -5,8 +5,7 @@ class TwoDCoordinatesResponse(BaseModel): - """ - Represents a response containing 2D coordinates for a molecule. + """Represents a response containing 2D coordinates for a molecule. Properties: - molblock (str): The generated mol block with 2D coordinates. @@ -19,8 +18,7 @@ class TwoDCoordinatesResponse(BaseModel): ) class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. @@ -45,8 +43,7 @@ class Config: class ThreeDCoordinatesResponse(BaseModel): - """ - Represents a response containing 3D coordinates for a molecule. + """Represents a response containing 3D coordinates for a molecule. Properties: - molblock (str): The generated mol block with 3D coordinates. @@ -59,8 +56,7 @@ class ThreeDCoordinatesResponse(BaseModel): ) class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. @@ -86,8 +82,7 @@ class Config: class GenerateSMILESResponse(BaseModel): - """ - Represents a response containing a generated SMILES string. + """Represents a response containing a generated SMILES string. Properties: - smiles (str): The generated SMILES string. @@ -100,8 +95,7 @@ class GenerateSMILESResponse(BaseModel): ) class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. @@ -119,8 +113,7 @@ class Config: class GenerateCanonicalResponse(BaseModel): - """ - Represents a response containing a generated SMILES string. + """Represents a response containing a generated SMILES string. Properties: - smiles (str): The generated Canonical SMILES string. @@ -133,8 +126,7 @@ class GenerateCanonicalResponse(BaseModel): ) class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. @@ -152,8 +144,7 @@ class Config: class GenerateCXSMILESResponse(BaseModel): - """ - Represents a response containing a generated CXSMILES string. + """Represents a response containing a generated CXSMILES string. Properties: - smiles (str): The generated CXSMILES string. @@ -166,8 +157,7 @@ class GenerateCXSMILESResponse(BaseModel): ) class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. @@ -185,8 +175,7 @@ class Config: class GenerateInChIResponse(BaseModel): - """ - Represents a response containing a generated InChI string. + """Represents a response containing a generated InChI string. Properties: - inchi (str): The generated InChI string. @@ -199,8 +188,7 @@ class GenerateInChIResponse(BaseModel): ) class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. @@ -218,8 +206,7 @@ class Config: class GenerateInChIKeyResponse(BaseModel): - """ - Represents a response containing a generated InChI Key string. + """Represents a response containing a generated InChI Key string. Properties: - inchikey (str): The generated InChI Key string. @@ -232,8 +219,7 @@ class GenerateInChIKeyResponse(BaseModel): ) class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. @@ -251,8 +237,7 @@ class Config: class GenerateIUPACResponse(BaseModel): - """ - Represents a response containing a generated IUPAC string. + """Represents a response containing a generated IUPAC string. Properties: - iupac (str): The generated IUPAC name. @@ -265,8 +250,7 @@ class GenerateIUPACResponse(BaseModel): ) class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. @@ -284,8 +268,7 @@ class Config: class GenerateSELFIESResponse(BaseModel): - """ - Represents a response containing a generated SELFIES string. + """Represents a response containing a generated SELFIES string. Properties: - iupac (str): The generated SELFIES string. @@ -298,8 +281,7 @@ class GenerateSELFIESResponse(BaseModel): ) class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. @@ -317,8 +299,7 @@ class Config: class GenerateFormatsResponse(BaseModel): - """ - Represents a response containing a generated SELFIES string. + """Represents a response containing a generated SELFIES string. Properties: - iupac (str): The generated SELFIES string. @@ -331,8 +312,7 @@ class GenerateFormatsResponse(BaseModel): ) class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. diff --git a/app/schemas/depict_schema.py b/app/schemas/depict_schema.py index e31a07f..ed3f44b 100644 --- a/app/schemas/depict_schema.py +++ b/app/schemas/depict_schema.py @@ -4,8 +4,7 @@ class Depict2DResponse(BaseModel): - """ - A Pydantic model representing a successful response. + """A Pydantic model representing a successful response. Attributes: message (str): A message indicating the success status (default: "Success"). @@ -16,8 +15,7 @@ class Depict2DResponse(BaseModel): output: str class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. @@ -31,8 +29,7 @@ class Config: class Depict3DResponse(BaseModel): - """ - A Pydantic model representing a successful response. + """A Pydantic model representing a successful response. Attributes: message (str): A message indicating the success status (default: "Success"). @@ -43,8 +40,7 @@ class Depict3DResponse(BaseModel): output: str class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. diff --git a/app/schemas/error.py b/app/schemas/error.py index 8aea3bd..3dd7334 100644 --- a/app/schemas/error.py +++ b/app/schemas/error.py @@ -4,8 +4,7 @@ class ErrorResponse(BaseModel): - """ - Represents an error response. + """Represents an error response. Attributes: detail (str): A description of the error. This attribute contains a human-readable description of the error. @@ -15,8 +14,7 @@ class ErrorResponse(BaseModel): class BadRequestModel(BaseModel): - """ - Represents a Bad Request response in an API. + """Represents a Bad Request response in an API. Args: detail (str): A detailed message describing the nature of the bad request. @@ -27,8 +25,7 @@ class BadRequestModel(BaseModel): class NotFoundModel(BaseModel): - """ - Represents a Not Found response in an API. + """Represents a Not Found response in an API. Args: detail (str): A detailed message indicating that the requested resource was not found. diff --git a/app/schemas/healthcheck.py b/app/schemas/healthcheck.py index e116818..2b3acae 100644 --- a/app/schemas/healthcheck.py +++ b/app/schemas/healthcheck.py @@ -4,8 +4,8 @@ class HealthCheck(BaseModel): - """ - Represents the response model for validating and returning the result of a health check. + """Represents the response model for validating and returning the result of + a health check. Attributes: status (str): The status of the health check. The default is "OK". diff --git a/app/schemas/msg.py b/app/schemas/msg.py index c1cf6b5..1c169d5 100644 --- a/app/schemas/msg.py +++ b/app/schemas/msg.py @@ -4,8 +4,7 @@ class Msg(BaseModel): - """ - A Pydantic model class representing a message. + """A Pydantic model class representing a message. Attributes: msg (str): The message content. diff --git a/app/schemas/ocsr_schema.py b/app/schemas/ocsr_schema.py index e772715..3d5ebfe 100644 --- a/app/schemas/ocsr_schema.py +++ b/app/schemas/ocsr_schema.py @@ -4,8 +4,7 @@ class ExtractChemicalInfoResponse(BaseModel): - """ - A Pydantic model representing a successful response. + """A Pydantic model representing a successful response. Attributes: message (str): A message indicating the success status (default: "Success"). diff --git a/app/schemas/tools_schema.py b/app/schemas/tools_schema.py index 08df3a1..e56e759 100644 --- a/app/schemas/tools_schema.py +++ b/app/schemas/tools_schema.py @@ -6,8 +6,7 @@ class GenerateStructuresResponse(BaseModel): - """ - A Pydantic model representing a successful response. + """A Pydantic model representing a successful response. Attributes: message (str): A message indicating the success status (default: "Success"). @@ -18,8 +17,7 @@ class GenerateStructuresResponse(BaseModel): output: List[str] class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. @@ -37,8 +35,7 @@ class Config: class GetSugarInformationResponse(BaseModel): - """ - A Pydantic model representing a successful response. + """A Pydantic model representing a successful response. Attributes: message (str): A message indicating the success status (default: "Success"). @@ -49,8 +46,7 @@ class GetSugarInformationResponse(BaseModel): output: str class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. @@ -68,8 +64,7 @@ class Config: class GetLinearSugarResponse(BaseModel): - """ - A Pydantic model representing a successful response. + """A Pydantic model representing a successful response. Attributes: message (str): A message indicating the success status (default: "Success"). @@ -80,8 +75,7 @@ class GetLinearSugarResponse(BaseModel): output: str class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. @@ -99,8 +93,7 @@ class Config: class GetCircularSugarResponse(BaseModel): - """ - A Pydantic model representing a successful response. + """A Pydantic model representing a successful response. Attributes: message (str): A message indicating the success status (default: "Success"). @@ -111,8 +104,7 @@ class GetCircularSugarResponse(BaseModel): output: str class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure. @@ -130,8 +122,7 @@ class Config: class GetCircularandLinearSugarResponse(BaseModel): - """ - A Pydantic model representing a successful response. + """A Pydantic model representing a successful response. Attributes: message (str): A message indicating the success status (default: "Success"). @@ -142,8 +133,7 @@ class GetCircularandLinearSugarResponse(BaseModel): output: str class Config: - """ - Pydantic model configuration. + """Pydantic model configuration. JSON Schema Extra: - Includes examples of the response structure.