Repository navigation
Molecule signature #8252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Molecule signature #8252
Changes from 26 commits
24f696d
6b3b36e
d288426
dce534e
268d3ba
21ebe5e
5438387
56eac2e
dac8ea0
41b5188
61d307d
fc91af0
9d84e9c
90cc273
6143e96
cc9d8b6
3925d81
053e7e9
a23935d
587e966
c450914
17a434d
ac9b8f7
41aa70b
9c71952
6ed68e7
4f86b44
326943a
c46e7f7
fbfbd47
fb2818e
d88af0c
8630c8e
2fe4550
11fbe1b
56ee75f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| categories: | ||
| - Synthetic Biology | ||
| description: De Novo Molecular Design by Reverse Engineering Fingerprints | ||
| name: molsig | ||
| owner: iuc | ||
| remote_repository_url: https://github.com/galaxyproject/tools-iuc/tree/main/tools/molecule-signature | ||
| homepage_url: https://github.com/brsynth/molecule-signature | ||
| long_description: The algorithm uses an alphabet of small molecular environments — chemical Lego bricks. It searches for combinations whose summed fingerprint exactly matches the input ECFP, formulated as a system of linear Diophantine equations. Once compatible fragment combinations are found, the method reconnects them into chemically valid molecular graphs. | ||
| type: unrestricted | ||
| auto_tool_repositories: | ||
| name_template: "{{ tool_id }}" | ||
| description_template: "Wrapper for molsig: {{ tool_name }}." | ||
| suite: | ||
| name: "suite_molsig" | ||
| description: "A suite of tools that brings molecule-signature (molsig) into Galaxy." | ||
| long_description: | | ||
| The algorithm uses an alphabet of small molecular environments — chemical Lego bricks. It searches for combinations whose summed fingerprint exactly matches the input ECFP, formulated as a system of linear Diophantine equations. Once compatible fragment combinations are found, the method reconnects them into chemically valid molecular graphs. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| <tool id="molsig" name="Molecule signature" version="0.1.0+galaxy0" python_template_version="3.5" profile="21.05"> | ||
|
bernt-matthias marked this conversation as resolved.
Resolved
|
||
| <macros> | ||
| <xml name="alphabet_selector_block"> | ||
|
bernt-matthias marked this conversation as resolved.
Resolved
|
||
| <param name="alphabet_selector" type="select" label="Alphabet:" > | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indentation is off here. If we add a tool with a data table then we should maybe also add a data manager. The tool will be auto installed on usegalaxy.eu, without a data manager reference data would need to be installed manually be the admins. This will likely not happen without a data manager (and with one we could even automatize https://github.com/galaxyproject/idc/), i.e. usegalaxy would end up with a non-functional tool.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We chose .loc files instead of a data manager on Björn's advice, since the alphabet files should not change. That's why we went with this setup. I've never worked with data managers, but I understand the benefits they offer. I'll look into it to see if this is a feasible option that can be implemented quickly without having to start from scratch. For your information, it's intended for a specific instance on usegalaxy.fr |
||
| <options from_data_table="molsig_alphabets"> | ||
| <column name="value" index="0"/> | ||
| <column name="name" index="1"/> | ||
| <column name="version" index="2"/> | ||
| <column name="path" index="3"/> | ||
| </options> | ||
| </param> | ||
| </xml> | ||
|
|
||
| <xml name="smiles_checks"> | ||
| <sanitizer> | ||
| <valid initial="string.ascii_letters,string.digits"> | ||
| <add value="@+-[]()=#:/\.%*"/> | ||
| </valid> | ||
| </sanitizer> | ||
| <validator type="regex" message="Not a valid SMILES: only letters, digits and @ + - [ ] ( ) = # : / \ . % * are allowed.">^[A-Za-z0-9@+\-\[\]()=#:/\\.%*]+$</validator> | ||
|
bernt-matthias marked this conversation as resolved.
Resolved
|
||
| </xml> | ||
| </macros> | ||
|
|
||
| <requirements> | ||
| <requirement type="package" version="2.1.1">molecule-signature</requirement> | ||
| <requirement type="package" version="2026.03.2">rdkit</requirement> | ||
| </requirements> | ||
|
|
||
|
bernt-matthias marked this conversation as resolved.
Resolved
|
||
| <command detect_errors="exit_code"><![CDATA[ | ||
| #if $incl_input_alf=="true" | ||
|
bernt-matthias marked this conversation as resolved.
Resolved
|
||
| python3 '$__tool_directory__/static/update_alphabet.py' '$alphabet_selector.fields.path' updated_alphabet.npz '$input_text' && | ||
|
bernt-matthias marked this conversation as resolved.
Resolved
|
||
|
|
||
| #else | ||
| ln -s '$alphabet_selector.fields.path' updated_alphabet.npz && | ||
|
|
||
| #end if | ||
|
|
||
| molsig enumerate --smiles '$input_text' --alphabet updated_alphabet.npz --output analogues_smiles.tsv | ||
| ]]></command> | ||
|
|
||
| <inputs> | ||
| <!-- Modèle SMILES en entrée --> | ||
|
|
||
| <param name="input_text" type="text" optional="false" label="Smiles entry :"> | ||
| <help><![CDATA[Examples: Phenazinol <code>C1=CC=C2C(=C1)N=C3C=CC=C(C3=N2)O</code>, Linoleic acid <code>CCCCC/C=C/C/C=C/C/C=C/C/C=C/CCCCC(=O)O</code>]]></help> | ||
| <expand macro="smiles_checks"/> | ||
| </param> | ||
|
|
||
|
|
||
| <expand macro="alphabet_selector_block"/> | ||
|
|
||
| <param name="incl_input_alf" type="boolean" truevalue="true" falsevalue="false" checked="true" | ||
| label="Include input molecule in alphabet (recommended for molecular design)"/> | ||
|
|
||
| </inputs> | ||
| <outputs> | ||
| <data name="analogues_smiles" format="tsv" from_work_dir="analogues_smiles.tsv" /> | ||
| </outputs> | ||
| <tests> | ||
| <test> | ||
| <param name="input_text" value="C1=CC=C2C(=C1)N=C3C=CC=C(C3=N2)O"/> | ||
| <param name="incl_input_alf" value="true"/> | ||
|
bernt-matthias marked this conversation as resolved.
Resolved
|
||
| <param name="alphabet_selector" value="metanetx"/> | ||
| <output name="analogues_smiles" file="output/Galaxy1-[Molecular Design by Reverse Engineering].tsv" compare="sim_size"/> | ||
|
bernt-matthias marked this conversation as resolved.
Resolved
|
||
| </test> | ||
| </tests> | ||
|
|
||
| <help><![CDATA[ | ||
|
bernt-matthias marked this conversation as resolved.
Resolved
|
||
| **De Novo Molecular Design by Reverse Engineering Fingerprints** | ||
|
|
||
| **❔ How to use ?** | ||
|
|
||
| **SMILES** *(Compute the ECFP from molecule)* | ||
|
|
||
| -Example: *CCO* or *c1ccccc1* | ||
|
|
||
| Ready-to-copy SMILES examples: | ||
|
|
||
| - Phenazinol : ``C1=CC=C2C(=C1)N=C3C=CC=C(C3=N2)O`` | ||
| - Linoleic Acid : ``CCCCC/C=C/C/C=C/C/C=C/C/C=C/CCCCC(=O)O`` | ||
| - Ursolic Acid : ``C[C@@H]1CC[C@@]2(CC[C@@]3(C(=CC[C@H]4[C@]3(CC[C@@H]5[C@@]4(CC[C@@H](C5(C)C)O)C)C)[C@@H]2[C@H]1C)C)C(=O)O`` | ||
| - Orlistat : ``CCCCCCCCCCC[C@@H](C[C@H]1[C@@H](C(=O)O1)CCCCCC)OC(=O)C(CC(C)C)NC=O`` | ||
|
|
||
| ⟹ Find out more about SMILES: `Wikipedia - SMILES <https://en.wikipedia.org/wiki/Simplified_Molecular_Input_Line_Entry_System>`_ | ||
|
|
||
| **Alphabet**:: | ||
|
|
||
| -MetaNetX (Biology) – 227,717 fragments from 206,338 molecules | ||
| -eMolecules (Comerciales) – 570,421 fragments from 5 million molecules | ||
| -ChEMBL (Drug-like) – 712,244 fragments from 1,907,613 molecules | ||
| -DrugBank (Drugs) – 40,138 fragments from 9,516 molecules | ||
|
|
||
|
|
||
| .. class:: infomark | ||
|
|
||
| **How does the method work?** | ||
|
|
||
| Extended-Connectivity Fingerprints (**ECFPs**) are widely used molecular vectorizations in cheminformatics. They encode local atomic environments into numerical vectors and are commonly used for **QSAR/QSPR**, similarity search, virtual screening, and machine-learning models that predict molecular activities or properties. | ||
|
|
||
| Here, we address the inverse problem. Instead of starting from a molecule to predict properties, we start from a fingerprint and ask whether other molecular structures can produce exactly the same ECFP. Such molecules can be seen as fingerprint analogues and may share similar predicted properties in models relying on this representation. | ||
|
|
||
| The algorithm uses an **alphabet** of small molecular environments — chemical **Lego bricks**. It searches for combinations whose summed fingerprint exactly matches the input ECFP, formulated as a system of **linear Diophantine equations**. Once compatible fragment combinations are found, the method reconnects them into chemically valid molecular graphs. | ||
|
|
||
| .. class:: warningmark | ||
|
|
||
| In our experiments, ~91.3% of cases yield no analogue. ECFP collisions are rare, so requiring identical fingerprints imposes a very strong constraint on the molecular space. | ||
|
|
||
| Reference alphabet files (ChEMBL, DrugBank, eMolecules, MetaNetX) must be | ||
| installed by a Galaxy admin and referenced in tool-data/molsig_alphabets.loc. | ||
| Files are available at: https://zenodo.org/records/22691018 | ||
|
|
||
| ---- | ||
|
|
||
| **Tool source code**: `GitHub - molecule-signature <https://github.com/brsynth/molecule-signature>`_ | ||
|
|
||
| **Attribution** | ||
|
|
||
| This tool is part of the PEPR Bioproductions (B-BEST) program, supported by the France 2030 investment plan via the French National Research Agency (ANR) and co-led by INRAE and IFPEN [ANR-22-PEBB-0008]. | ||
|
|
||
| ]]></help> | ||
| <citations> | ||
| <citation type="doi"> | ||
| 10.1186/s13321-025-01074-5 | ||
| </citation> | ||
| </citations> | ||
| </tool> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import sys | ||
|
|
||
| from molsig.enumerate_utils import get_first_stereoisomer | ||
| from molsig.SignatureAlphabet import (load_alphabet, merge_alphabets, SignatureAlphabet) | ||
| from rdkit import Chem | ||
|
|
||
| RADIUS = 2 | ||
| NBITS = 2048 | ||
| USE_STEREO = True | ||
|
|
||
| alphabet_path = sys.argv[1] | ||
| output_path = sys.argv[2] | ||
| smiles_0 = sys.argv[3] | ||
|
|
||
| Alphabet = load_alphabet(alphabet_path) | ||
|
|
||
| mol = Chem.MolFromSmiles(smiles_0) | ||
| if mol is None: | ||
| sys.exit(f"SMILES is not validated by rdkit: {smiles_0}") | ||
| smiles = get_first_stereoisomer(smiles_0) | ||
|
|
||
| Alphabet_mol = SignatureAlphabet(radius=RADIUS, nBits=NBITS, use_stereo=USE_STEREO) | ||
| Alphabet_mol.fill([smiles], verbose=False) | ||
| Alphabet = merge_alphabets(Alphabet, Alphabet_mol) | ||
|
|
||
| Alphabet.save(output_path) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #value name version path | ||
| metanetx MetaNetX (test) 1.0 ${__HERE__}/mini_metanetx_alphabet.npz | ||
| emolecules eMolecules (test) 1.0 ${__HERE__}/mini_metanetx_alphabet.npz | ||
| chembl ChEMBL (test) 1.0 ${__HERE__}/mini_metanetx_alphabet.npz | ||
| drugbank DrugBank (test) 1.0 ${__HERE__}/mini_metanetx_alphabet.npz |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| SMILES | ||
| Oc1cccc2nc3ccccc2nc13 | ||
| Oc1ccccc2nc3cccc3nc12 | ||
| Oc1cccc2nc3ccccc3nc12 | ||
| Oc1ccccc2nc3cccc2nc13 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| ]1341;command_started;command=7072696e7466202723205265666572656e636520616c7068616265742066696c657320666f7220746865206d6f6c73696720746f6f6c2e5c6e27# Reference alphabet files for the molsig tool. | ||
| # Download the real .npz files from: https://zenodo.org/records/22691018 | ||
| # Then edit the paths below to point to where you stored them on this instance. | ||
| #value name version path | ||
| #chembl ChEMBL alphabet 1.0 /path/to/chembl_alphabet.npz | ||
| #drugbank DrugBank alphabet 1.0 /path/to/drugbank_alphabet.npz | ||
| #emolecules eMolecules alphabet 1.0 /path/to/emolecules_alphabet.npz | ||
| #metanetx MetaNetX alphabet 1.0 /path/to/metanetx_alphabet.npz |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| <tables> | ||
| <table name="molsig_alphabets" comment_char="#"> | ||
| <columns>value, name, version, path</columns> | ||
| <file path="tool-data/molsig_alphabets.loc" /> | ||
| </table> | ||
| </tables> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| <tables> | ||
| <table name="molsig_alphabets" comment_char="#"> | ||
| <columns>value, name, version, path</columns> | ||
| <file path="${__HERE__}/test-data/molsig_alphabets.loc" /> | ||
| </table> | ||
| </tables> |
Uh oh!
There was an error while loading. Please reload this page.