smartsexplore.molecules.routes module¶
Routes for uploading and retrieving molecules and SMARTS-molecule match data stored in the database, plus structure diagram images of these molecules.
-
smartsexplore.molecules.routes.attach_to_blueprint(blueprint: flask.blueprints.Blueprint)¶ Attaches all available routes to the given
flask.Blueprintobject.- Parameters
blueprint – The blueprint object to attach the commands to.
-
smartsexplore.molecules.routes.deliver_molecule_image(id)¶ A route that delivers the image for a molecule, given the molecule’s ID. Responds with 404 if the molecule or its image could not be found.
- Parameters
id – The ID of the molecule.
- Returns
A file response on success, a 404 response on error.
-
smartsexplore.molecules.routes.matches_for_molecule_set(id: int)¶ A route that retrieves all matches associated with a MoleculeSet instance. Responds with a JSON object containing the
molecule_set_id, as well as an array ofmatches. Each match inmatcheswill have amolecule_id, amolecule_nameand asmarts_id.- Parameters
id – The ID of the MoleculeSet instance.
- Returns
JSON as described above.
-
smartsexplore.molecules.routes.upload_molecule_set()¶ A route for uploading a set of molecules, given as a single SMILES file in the ‘file’ parameter.
On success, redirects to the route
matches_for_molecule_set()for the newly created MoleculeSet. Therefore, on success this returns the matches associated with the uploaded molecule set.On failure, responds with a 400 error and JSON containing a descriptive error string (key ‘error’). This string can be displayed directly in the frontend.