{"id":22582447,"url":"https://github.com/paccmann/chemical_representation_learning_for_toxicity_prediction","last_synced_at":"2025-04-10T19:11:56.165Z","repository":{"id":44894199,"uuid":"294080599","full_name":"PaccMann/chemical_representation_learning_for_toxicity_prediction","owner":"PaccMann","description":"Chemical representation learning paper in Digital Discovery","archived":false,"fork":false,"pushed_at":"2024-05-22T20:38:48.000Z","size":998,"stargazers_count":59,"open_issues_count":0,"forks_count":16,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-24T16:53:10.669Z","etag":null,"topics":["chemoinformatics","deep-learning","property-prediction","pytorch","qsar","toxicity-prediction"],"latest_commit_sha":null,"homepage":"https://pubs.rsc.org/en/content/articlelanding/2023/dd/d2dd00099g","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PaccMann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-09T10:33:35.000Z","updated_at":"2025-03-07T19:27:00.000Z","dependencies_parsed_at":"2024-05-17T16:35:25.445Z","dependency_job_id":"db5cf8c4-66e3-4427-85e7-9a1529d57486","html_url":"https://github.com/PaccMann/chemical_representation_learning_for_toxicity_prediction","commit_stats":null,"previous_names":["paccmann/toxsmi"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaccMann%2Fchemical_representation_learning_for_toxicity_prediction","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaccMann%2Fchemical_representation_learning_for_toxicity_prediction/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaccMann%2Fchemical_representation_learning_for_toxicity_prediction/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaccMann%2Fchemical_representation_learning_for_toxicity_prediction/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PaccMann","download_url":"https://codeload.github.com/PaccMann/chemical_representation_learning_for_toxicity_prediction/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248279799,"owners_count":21077408,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chemoinformatics","deep-learning","property-prediction","pytorch","qsar","toxicity-prediction"],"created_at":"2024-12-08T06:09:58.832Z","updated_at":"2025-04-10T19:11:56.146Z","avatar_url":"https://github.com/PaccMann.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://github.com/PaccMann/toxsmi/actions/workflows/build.yml/badge.svg)](https://github.com/PaccMann/toxsmi/actions/workflows/build.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Gradio demo](https://img.shields.io/website-up-down-green-red/https/hf.space/gradioiframe/GT4SD/molecular_properties/+.svg?label=demo%20status)](https://huggingface.co/spaces/GT4SD/molecular_properties)\n\n## Chemical Representation Learning for Toxicity Prediction\n\nPyTorch implementation related to the paper *Chemical Representation Learning for Toxicity Prediction* ([Born et al, 2023, *Digital Discovery*](https://pubs.rsc.org/en/content/articlehtml/2023/dd/d2dd00099g)).\n\n# Inference\nWe released pretrained models for the Tox21, the ClinTox and the SIDER dataset.\n\n## Demo with UI\n🤗 A gradio demo with a simple UI is available on [HuggingFace spaces](https://huggingface.co/spaces/GT4SD/molecular_properties)\n![Summary](assets/demo.png)\n\n## Python API\nThe pretrained models are available via the [GT4SD](https://github.com/GT4SD), the Generative Toolkit for Scientific Discovery. See the paper [here](https://arxiv.org/abs/2207.03928).\nWe recommend to use [GT4SD](https://github.com/GT4SD/gt4sd-core) for inference. Once you install that library, use as follows:\n```py\nfrom gt4sd.properties import PropertyPredictorRegistry\ntox21 = PropertyPredictorRegistry.get_property_predictor('tox21', {'algorithm_version': 'v0'})\ntox21('CCO')\n```\n\nThe other models are the SIDER model and the ClinTox model from the [MoleculeNet](https://moleculenet.org/datasets-1) benchmark:\n```py\nfrom gt4sd.properties import PropertyPredictorRegistry\nsider = PropertyPredictorRegistry.get_property_predictor('sider', {'algorithm_version': 'v0'})\nclintox = PropertyPredictorRegistry.get_property_predictor('clintox', {'algorithm_version': 'v0'})\nprint(f\"SIDE effect predictions: {sider('CCO')}\")\nprint(f\"Clinical toxicitiy predictions: {clintox('CCO')}\")\n```\n\n\n# Training your own model\n\n### Setup\nThe library itself has few dependencies (see [setup.py](setup.py)) with loose requirements. \n```sh\npip install -e .\n```\n\n### Start a training\n\nIn the `scripts` directory is a training script [train_tox](./scripts/train_tox).\n\nDownload sample data from the Tox21 database and store it in a folder called `data`\n[here](https://ibm.box.com/s/kahxnlg2k2s0x3z0r5fa6y67tmfhs6or). \n\n```console\n(toxsmi) $ python3 scripts/train_tox \\\n--train data/tox21_train.csv \\\n--test data/tox21_score.csv \\\n--smi data/tox21.smi \\\n--params params/mca.json \\\n--model path_to_model_folder \\\n--name debug\n```\n\n**Features**:\n- Set ```--finetune``` to the path to a `.pt` file to start from a pretrained model\n- Set ```--embedding_path``` to the path of pretrained embeddings\n\nType `python scripts/train_tox -h` for further help.\n\n### Evaluate a model\nIn the `scripts` directory is an evaluation script [eval_tox.py](./scripts/eval_tox.py).\nAssume you have a trained model, use as follows:\n\n```console\n(toxsmi) $ python3 scripts/eval_tox.py \\\n-model path_to_model_folder \\\n-smi data/tox21.smi \\\n-labels data/tox21_test.csv \\\n-checkpoint RMSE\"\n```\n\nwhere `-checkpoint` specifies which `.pt` file to pick for the evaluation (based on substring matching)\n\n## Attention visualization\nThe model uses a self-attention mechanism that can highlight chemical motifs used for the predictions.\nIn [notebooks/toxicity_attention_plot.ipynb](notebooks/toxicity_attention_plot.ipynb) we share a tutorial on how to create such plots:\n![Attention](assets/attention.gif \"toxicophore attention\")\n\n\n## Citation\nIf you use this code in your projects, please cite the following:\n\n```bib\n@article{born2023chemical,\n    author = {Born, Jannis and Markert, Greta and Janakarajan, Nikita and Kimber, Talia B. and Volkamer, Andrea and Martínez, María Rodríguez and Manica, Matteo},\n    title = {Chemical representation learning for toxicity prediction},\n    journal = {Digital Discovery},\n    year = {2023},\n    pages = {-},\n    publisher = {RSC},\n    doi = {10.1039/D2DD00099G},\n    url = {http://dx.doi.org/10.1039/D2DD00099G}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaccmann%2Fchemical_representation_learning_for_toxicity_prediction","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaccmann%2Fchemical_representation_learning_for_toxicity_prediction","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaccmann%2Fchemical_representation_learning_for_toxicity_prediction/lists"}