Skip to content

Commit

Permalink
updating readme [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
GemmaTuron authored and ersilia-bot committed Mar 7, 2024
1 parent 83ce5e5 commit 58869e4
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 23 deletions.
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM bentoml/model-server:0.11.0-py37
FROM bentoml/model-server:0.11.0-py311
MAINTAINER ersilia

RUN pip install rdkit
RUN pip install rdkit==2023.9.5

WORKDIR /repo
COPY . /repo
44 changes: 42 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
# Ersilia Model In Progress
# ErG 2D Descriptors

This model is work in progress. Please edit the [metadata.json](metadata.json) file to complete the information about the model. This README file will be updated automatically based on the information contained in that folder.
The Extended Reduced Graph (ErG) approach uses the description of pharmacophore nodes to encode molecular properties, with the goal of correctly describing pharmacophoric properties, size and shape of molecules. It was benchmarked against Daylight fingerprints and outperformed them in 10 out of 11 cases. ErG descriptors are well suited for scaffold hopping approaches.

## Identifiers

* EOS model ID: `eos5guo`
* Slug: `erg-descs`

## Characteristics

* Input: `Compound`
* Input Shape: `Single`
* Task: `Representation`
* Output: `Descriptor`
* Output Type: `Integer`
* Output Shape: `List`
* Interpretation: Vector representing SMILES

## References

* [Publication](https://pubs.acs.org/doi/10.1021/ci050457y)
* [Source Code](https://www.rdkit.org/docs/source/rdkit.Chem.rdReducedGraphs.html)
* Ersilia contributor: [GemmaTuron](https://github.com/GemmaTuron)

## Ersilia model URLs
* [GitHub](https://github.com/ersilia-os/eos5guo)

## Citation

If you use this model, please cite the [original authors](https://pubs.acs.org/doi/10.1021/ci050457y) of the model and the [Ersilia Model Hub](https://github.com/ersilia-os/ersilia/blob/master/CITATION.cff).

## License

This package is licensed under a GPL-3.0 license. The model contained within this package is licensed under a BSD-3.0 license.

Notice: Ersilia grants access to these models 'as is' provided by the original authors, please refer to the original code repository and/or publication if you use the model in your research.

## About Us

The [Ersilia Open Source Initiative](https://ersilia.io) is a Non Profit Organization ([1192266](https://register-of-charities.charitycommission.gov.uk/charity-search/-/charity-details/5170657/full-print)) with the mission is to equip labs, universities and clinics in LMIC with AI/ML tools for infectious disease research.

[Help us](https://www.ersilia.io/donate) achieve our mission!
18 changes: 9 additions & 9 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"Identifier": "eos5guo",
"Slug": "erg-descs",
"Status": "In progress",
"Status": "Ready",
"Title": "ErG 2D Descriptors",
"Description": "The Extended Reduced Graph (ErG) approach uses the description of pharmacophore nodes to encode molecular properties, with the goal of correctly describing pharmacophoric properties, size and shape of molecules. It was benchmarked against Daylight fingerprints and outperformed them in 10 out of 11 cases. ErG descriptors are well suited for scaffold hopping approaches.",
"Mode": "",
"Task": [],
"Input": [],
"Input Shape": "",
"Output": [],
"Output Type": [],
"Output Shape": "",
"Interpretation": "",
"Mode": "Pretrained",
"Task": ["Representation"],
"Input": ["Compound"],
"Input Shape": "Single",
"Output": ["Descriptor"],
"Output Type": ["Integer"],
"Output Shape": "List",
"Interpretation": "Vector representing SMILES",
"Tag": [
"Descriptor",
"Fingerprint"
Expand Down
3 changes: 0 additions & 3 deletions mock.txt

This file was deleted.

Binary file added model/.DS_Store
Binary file not shown.
18 changes: 12 additions & 6 deletions model/framework/code/main.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# imports
import os
import csv
import numpy as np
import sys
from rdkit import Chem
from rdkit.Chem.Descriptors import MolWt
from rdkit.Chem import rdReducedGraphs


# parse arguments
input_file = sys.argv[1]
Expand All @@ -13,8 +15,11 @@
root = os.path.dirname(os.path.abspath(__file__))

# my model
def my_model(smiles_list):
return [MolWt(Chem.MolFromSmiles(smi)) for smi in smiles_list]
def erg_desc(smiles_list):
mols = [Chem.MolFromSmiles(smi) for smi in smiles_list]
ergfps = [rdReducedGraphs.GetErGFingerprint(mol) for mol in mols]
array_ergfps = [np.array(fp) for fp in ergfps]
return array_ergfps


# read SMILES from .csv file, assuming one column with header
Expand All @@ -24,16 +29,17 @@ def my_model(smiles_list):
smiles_list = [r[0] for r in reader]

# run model
outputs = my_model(smiles_list)
outputs = erg_desc(smiles_list)

#check input and output have the same lenght
input_len = len(smiles_list)
output_len = len(outputs)
assert input_len == output_len


# write output in a .csv file
with open(output_file, "w") as f:
writer = csv.writer(f)
writer.writerow(["value"]) # header
writer.writerow(["erg-{}".format(i) for i in range(len(outputs[0]))]) # header
for o in outputs:
writer.writerow([o])
writer.writerow(o)

0 comments on commit 58869e4

Please sign in to comment.