smsd 5.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. smsd-5.0.1/.github/workflows/maven.yml +31 -0
  2. smsd-5.0.1/.github/workflows/python-publish.yml +68 -0
  3. smsd-5.0.1/.github/workflows/release.yml +28 -0
  4. smsd-5.0.1/.gitignore +46 -0
  5. smsd-5.0.1/Dockerfile +11 -0
  6. smsd-5.0.1/HOWTO-INSTALL.md +39 -0
  7. smsd-5.0.1/LICENSE +190 -0
  8. smsd-5.0.1/LICENSE-HEADER-JAVA.txt +4 -0
  9. smsd-5.0.1/PKG-INFO +261 -0
  10. smsd-5.0.1/README.md +351 -0
  11. smsd-5.0.1/WHITEPAPER.md +354 -0
  12. smsd-5.0.1/benchmarks/README.md +96 -0
  13. smsd-5.0.1/benchmarks/benchmark_1000.py +656 -0
  14. smsd-5.0.1/benchmarks/benchmark_1000_java.java +355 -0
  15. smsd-5.0.1/benchmarks/benchmark_cpp.cpp +378 -0
  16. smsd-5.0.1/benchmarks/benchmark_java.sh +92 -0
  17. smsd-5.0.1/benchmarks/benchmark_rdkit.py +110 -0
  18. smsd-5.0.1/benchmarks/diverse_molecules.txt +1042 -0
  19. smsd-5.0.1/cpp/CMakeLists.txt +90 -0
  20. smsd-5.0.1/cpp/bindings/pybind11/smsd_bindings.cpp +519 -0
  21. smsd-5.0.1/cpp/cuda/batch_screen.cu +380 -0
  22. smsd-5.0.1/cpp/include/smsd/batch.hpp +458 -0
  23. smsd-5.0.1/cpp/include/smsd/mcs.hpp +1966 -0
  24. smsd-5.0.1/cpp/include/smsd/mol_graph.hpp +1335 -0
  25. smsd-5.0.1/cpp/include/smsd/mol_reader.hpp +949 -0
  26. smsd-5.0.1/cpp/include/smsd/rascal.hpp +34 -0
  27. smsd-5.0.1/cpp/include/smsd/smarts_parser.hpp +1571 -0
  28. smsd-5.0.1/cpp/include/smsd/smiles_parser.hpp +1615 -0
  29. smsd-5.0.1/cpp/include/smsd/smsd.hpp +13 -0
  30. smsd-5.0.1/cpp/include/smsd/vf2pp.hpp +947 -0
  31. smsd-5.0.1/cpp/src/rdkit_adapter.cpp +85 -0
  32. smsd-5.0.1/cpp/tests/test_batch.cpp +575 -0
  33. smsd-5.0.1/cpp/tests/test_main.cpp +167 -0
  34. smsd-5.0.1/pom.xml +312 -0
  35. smsd-5.0.1/pyproject.toml +52 -0
  36. smsd-5.0.1/python/README.md +233 -0
  37. smsd-5.0.1/python/pyproject.toml +53 -0
  38. smsd-5.0.1/python/smsd/__init__.py +194 -0
  39. smsd-5.0.1/python/tests/__init__.py +0 -0
  40. smsd-5.0.1/python/tests/test_smsd.py +515 -0
  41. smsd-5.0.1/src/main/java/com/bioinception/smsd/cli/SMSDcli.java +620 -0
  42. smsd-5.0.1/src/main/java/com/bioinception/smsd/core/ChemOptions.java +130 -0
  43. smsd-5.0.1/src/main/java/com/bioinception/smsd/core/McsEngine.java +56 -0
  44. smsd-5.0.1/src/main/java/com/bioinception/smsd/core/MolGraph.java +1043 -0
  45. smsd-5.0.1/src/main/java/com/bioinception/smsd/core/SMSD.java +227 -0
  46. smsd-5.0.1/src/main/java/com/bioinception/smsd/core/SearchEngine.java +2373 -0
  47. smsd-5.0.1/src/main/java/com/bioinception/smsd/core/Standardiser.java +180 -0
  48. smsd-5.0.1/src/main/java/com/bioinception/smsd/core/SubstructureEngine.java +384 -0
  49. smsd-5.0.1/src/scripts/smsd +128 -0
  50. smsd-5.0.1/src/scripts/smsd.bat +113 -0
  51. smsd-5.0.1/src/scripts/smsd.ps1 +17 -0
  52. smsd-5.0.1/src/test/java/com/bioinception/smsd/AdversarialTest.java +820 -0
  53. smsd-5.0.1/src/test/java/com/bioinception/smsd/BenchmarkComparison.java +219 -0
  54. smsd-5.0.1/src/test/java/com/bioinception/smsd/BenchmarkTest.java +118 -0
  55. smsd-5.0.1/src/test/java/com/bioinception/smsd/HeadToHeadBenchmark.java +261 -0
  56. smsd-5.0.1/src/test/java/com/bioinception/smsd/LargeMoleculeTest.java +732 -0
  57. smsd-5.0.1/src/test/java/com/bioinception/smsd/MolIOTest.java +157 -0
  58. smsd-5.0.1/src/test/java/com/bioinception/smsd/NewFeaturesTest.java +1876 -0
  59. smsd-5.0.1/src/test/java/com/bioinception/smsd/OptimizationTest.java +1174 -0
  60. smsd-5.0.1/src/test/java/com/bioinception/smsd/OutputUtilTest.java +180 -0
  61. smsd-5.0.1/src/test/java/com/bioinception/smsd/SMSDCasesTest.java +316 -0
  62. smsd-5.0.1/src/test/java/com/bioinception/smsd/SMSDComprehensiveTest.java +772 -0
  63. smsd-5.0.1/src/test/java/com/bioinception/smsd/SMSDRobustTest.java +184 -0
  64. smsd-5.0.1/src/test/java/com/bioinception/smsd/SMSDTest.java +405 -0
  65. smsd-5.0.1/src/test/java/com/bioinception/smsd/TestBase.java +24 -0
  66. smsd-5.0.1/web/pom.xml +114 -0
  67. smsd-5.0.1/web/src/main/java/com/bioinception/smsd/web/ApiHandler.java +249 -0
  68. smsd-5.0.1/web/src/main/java/com/bioinception/smsd/web/DepictService.java +175 -0
  69. smsd-5.0.1/web/src/main/java/com/bioinception/smsd/web/SmsdServer.java +48 -0
  70. smsd-5.0.1/web/src/main/resources/static/app.js +568 -0
  71. smsd-5.0.1/web/src/main/resources/static/index.html +299 -0
  72. smsd-5.0.1/web/src/main/resources/static/manifest.json +10 -0
  73. smsd-5.0.1/web/src/main/resources/static/style.css +1192 -0
@@ -0,0 +1,31 @@
1
+ name: maven
2
+
3
+ on:
4
+ push:
5
+ branches: [ main, master ]
6
+ pull_request:
7
+ branches: [ main, master ]
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - name: Set up JDK 17
15
+ uses: actions/setup-java@v4
16
+ with:
17
+ distribution: temurin
18
+ java-version: '17'
19
+ cache: maven
20
+ - name: Build with Maven
21
+ run: mvn -U -B -DskipTests=false clean verify
22
+ - name: Package
23
+ run: mvn -B -DskipTests=false package
24
+ - name: Upload fat JAR and launchers
25
+ uses: actions/upload-artifact@v4
26
+ with:
27
+ name: smsd-jar-and-launchers
28
+ path: |
29
+ target/*-jar-with-dependencies.jar
30
+ src/scripts/
31
+
@@ -0,0 +1,68 @@
1
+ name: Publish Python Package to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ build:
10
+ name: Build wheels on ${{ matrix.os }}
11
+ runs-on: ${{ matrix.os }}
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ os: [ubuntu-latest, macos-latest, windows-latest]
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Build wheels
21
+ uses: pypa/cibuildwheel@v2.21
22
+ with:
23
+ package-dir: .
24
+ env:
25
+ CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-*"
26
+ CIBW_SKIP: "*-musllinux_* *-win32 *-manylinux_i686"
27
+ CIBW_BEFORE_BUILD: "pip install pybind11 scikit-build-core cmake"
28
+ CIBW_BUILD_VERBOSITY: "1"
29
+ CIBW_REPAIR_WHEEL_COMMAND_MACOS: ""
30
+ CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: ""
31
+ CIBW_ENVIRONMENT: "CMAKE_ARGS='-DCMAKE_BUILD_TYPE=Release -DSMSD_BUILD_PYTHON=ON -DSMSD_BUILD_TESTS=OFF -DSMSD_BUILD_OPENMP=OFF'"
32
+ CIBW_TEST_COMMAND: "python -c \"import smsd; print('SMSD imported OK'); m = smsd.parse_smiles('c1ccccc1'); print(f'Benzene: {len(m)} atoms')\""
33
+
34
+ - uses: actions/upload-artifact@v4
35
+ with:
36
+ name: wheels-${{ matrix.os }}
37
+ path: wheelhouse/*.whl
38
+
39
+ build-sdist:
40
+ name: Build source distribution
41
+ runs-on: ubuntu-latest
42
+ steps:
43
+ - uses: actions/checkout@v4
44
+ - name: Build sdist
45
+ run: |
46
+ pip install build
47
+ python -m build --sdist
48
+ - uses: actions/upload-artifact@v4
49
+ with:
50
+ name: sdist
51
+ path: dist/*.tar.gz
52
+
53
+ publish:
54
+ name: Publish to PyPI
55
+ needs: [build, build-sdist]
56
+ runs-on: ubuntu-latest
57
+ environment: pypi
58
+ permissions:
59
+ id-token: write
60
+
61
+ steps:
62
+ - uses: actions/download-artifact@v4
63
+ with:
64
+ path: dist
65
+ merge-multiple: true
66
+
67
+ - name: Publish to PyPI
68
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,28 @@
1
+ name: release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ jobs:
9
+ release:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - name: Set up JDK 17
14
+ uses: actions/setup-java@v4
15
+ with:
16
+ distribution: temurin
17
+ java-version: '17'
18
+ cache: maven
19
+ - name: Build
20
+ run: mvn -U -B -DskipTests=true clean package
21
+ - name: Create GitHub Release
22
+ uses: softprops/action-gh-release@v2
23
+ with:
24
+ files: |
25
+ target/*-jar-with-dependencies.jar
26
+ env:
27
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28
+
smsd-5.0.1/.gitignore ADDED
@@ -0,0 +1,46 @@
1
+ # Build artifacts
2
+ target/
3
+ dependency-reduced-pom.xml
4
+ *.jar
5
+ *.war
6
+ *.ear
7
+ hs_err_pid*
8
+ *.log
9
+
10
+ # Python
11
+ __pycache__/
12
+ *.pyc
13
+ *.egg-info/
14
+ .venv/
15
+ venv/
16
+ dist/
17
+ build/
18
+ *.so
19
+ *.pyd
20
+
21
+ # C++ build
22
+ cpp/build/
23
+ cpp/cmake-build*/
24
+ *.o
25
+ *.a
26
+ *.dylib
27
+
28
+ # IDE
29
+ .idea/
30
+ *.iml
31
+ .vscode/
32
+ *.swp
33
+
34
+ # OS
35
+ .DS_Store
36
+ Thumbs.db
37
+
38
+ # Generated (rebuild anytime)
39
+ api/
40
+ docs/
41
+ src/scripts/lib/
42
+ src/scripts/repo/
43
+
44
+ # Not for public repo
45
+ paper/
46
+ legacy/
smsd-5.0.1/Dockerfile ADDED
@@ -0,0 +1,11 @@
1
+ FROM maven:3.9.9-eclipse-temurin-17 AS build
2
+ WORKDIR /app
3
+ COPY . .
4
+ RUN mvn -U -B -DskipTests=false clean package
5
+
6
+ FROM eclipse-temurin:17-jre
7
+ WORKDIR /work
8
+ COPY --from=build /app/target/smsd-5.0.0-jar-with-dependencies.jar /usr/local/bin/smsd.jar
9
+ # Run the fat JAR directly (jar-first UX)
10
+ ENTRYPOINT ["java","-jar","/usr/local/bin/smsd.jar"]
11
+ CMD ["--help"]
@@ -0,0 +1,39 @@
1
+ # How to Build and Run
2
+
3
+ ## Requirements
4
+ - Java 11+ (JDK 17 recommended)
5
+ - Maven 3.9+
6
+
7
+ ## Build
8
+
9
+ ```bash
10
+ mvn -U clean package
11
+ ```
12
+
13
+ This produces `target/smsd-5.0.0-jar-with-dependencies.jar` (fat JAR with all dependencies).
14
+
15
+ ## Run Tests
16
+
17
+ ```bash
18
+ mvn clean test
19
+ ```
20
+
21
+ ## Run the CLI
22
+
23
+ ```bash
24
+ java -jar target/smsd-*-jar-with-dependencies.jar \
25
+ --Q SMI --q "CCN" \
26
+ --T SMI --t "CCCNC" \
27
+ -m --json - --json-pretty
28
+ ```
29
+
30
+ ## Docker
31
+
32
+ ```bash
33
+ docker build -t smsd .
34
+ docker run --rm smsd --Q SMI --q "c1ccccc1" --T SMI --t "c1ccc(O)cc1" --json -
35
+ ```
36
+
37
+ ## Notes
38
+ - The test suite exercises substructure and MCS across 420 cases, including recursive SMARTS, adversarial edge cases, and large molecules.
39
+ - Cross-platform launcher scripts are generated at `src/scripts/smsd` and `src/scripts/smsd.bat`.
smsd-5.0.1/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by the Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2025-2026 BioInception PVT LTD
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,4 @@
1
+ /*
2
+ * SPDX-License-Identifier: Apache-2.0
3
+ * © 2025 BioInception PVT LTD.
4
+ */
smsd-5.0.1/PKG-INFO ADDED
@@ -0,0 +1,261 @@
1
+ Metadata-Version: 2.1
2
+ Name: smsd
3
+ Version: 5.0.1
4
+ Summary: SMSD -- Substructure & MCS search for chemical graphs
5
+ Keywords: cheminformatics,mcs,substructure,graph-matching,chemistry,smiles
6
+ Author-Email: Syed Asad Rahman <asad.rahman@bioinceptionlabs.com>
7
+ License: Apache-2.0
8
+ Classifier: Development Status :: 5 - Production/Stable
9
+ Classifier: Intended Audience :: Science/Research
10
+ Classifier: License :: OSI Approved :: Apache Software License
11
+ Classifier: Programming Language :: C++
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Scientific/Engineering :: Chemistry
19
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
20
+ Project-URL: Homepage, https://github.com/asad/SMSD
21
+ Project-URL: Repository, https://github.com/asad/SMSD
22
+ Project-URL: Bug Tracker, https://github.com/asad/SMSD/issues
23
+ Requires-Python: >=3.8
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest>=7.0; extra == "dev"
26
+ Requires-Dist: pytest-timeout>=2.0; extra == "dev"
27
+ Description-Content-Type: text/markdown
28
+
29
+ # SMSD Python Bindings
30
+
31
+ Python interface for **SMSD** (Small Molecule Substructure Detector) -- a high-performance
32
+ library for substructure search, Maximum Common Substructure (MCS), and molecular similarity.
33
+
34
+ ## Features
35
+
36
+ - **SMILES parsing and writing** -- built-in OpenSMILES parser, no RDKit or CDK required
37
+ - **Substructure search** -- VF2++ subgraph isomorphism
38
+ - **MCS search** -- McSplit with seed-and-extend, orbit pruning, coverage-driven termination
39
+ - **Tautomer-aware matching** -- keto/enol, amide, imidazole tautomer equivalence
40
+ - **RASCAL screening** -- O(V+E) Tanimoto-like similarity upper bound
41
+ - **Fingerprints** -- path-based and MCS-aware fingerprints for pre-screening
42
+
43
+ ## Requirements
44
+
45
+ - Python >= 3.8
46
+ - C++17 compiler (GCC 7+, Clang 5+, MSVC 2019+)
47
+ - CMake >= 3.15
48
+ - pybind11 >= 2.12
49
+
50
+ ## Installation
51
+
52
+ ### From source (recommended)
53
+
54
+ ```bash
55
+ cd python/
56
+ pip install .
57
+ ```
58
+
59
+ ### Development install
60
+
61
+ ```bash
62
+ pip install -e ".[dev]"
63
+ ```
64
+
65
+ ### Build with specific compiler
66
+
67
+ ```bash
68
+ CMAKE_ARGS="-DCMAKE_CXX_COMPILER=g++-13" pip install .
69
+ ```
70
+
71
+ ## Quick Start
72
+
73
+ ```python
74
+ from smsd import parse_smiles, find_mcs, is_substructure, similarity
75
+
76
+ # Parse SMILES strings
77
+ benzene = parse_smiles("c1ccccc1")
78
+ phenol = parse_smiles("c1ccc(O)cc1")
79
+
80
+ # Substructure search
81
+ assert is_substructure(benzene, phenol) # benzene is in phenol
82
+
83
+ # Maximum Common Substructure
84
+ mcs = find_mcs(benzene, phenol)
85
+ print(f"MCS size: {len(mcs)} atoms") # 6
86
+
87
+ # Similarity
88
+ sim = similarity(benzene, phenol)
89
+ print(f"Similarity: {sim:.3f}") # ~0.857
90
+ ```
91
+
92
+ ## API Reference
93
+
94
+ ### SMILES Parsing
95
+
96
+ ```python
97
+ from smsd import parse_smiles, to_smiles
98
+
99
+ mol = parse_smiles("c1ccccc1")
100
+ print(mol.n) # 6 atoms
101
+ print(mol.atomic_num) # [6, 6, 6, 6, 6, 6]
102
+ print(mol.aromatic) # [True, True, True, True, True, True]
103
+
104
+ smi = to_smiles(mol) # canonical SMILES string
105
+ ```
106
+
107
+ ### Substructure Search
108
+
109
+ ```python
110
+ from smsd import is_substructure, find_substructure, ChemOptions
111
+
112
+ query = parse_smiles("c1ccccc1")
113
+ target = parse_smiles("c1ccc(O)cc1")
114
+
115
+ # Boolean check
116
+ if is_substructure(query, target):
117
+ print("Query is a substructure of target")
118
+
119
+ # Get atom mapping
120
+ mapping = find_substructure(query, target)
121
+ # Returns list of (query_atom, target_atom) pairs
122
+ for qi, ti in mapping:
123
+ print(f" query atom {qi} -> target atom {ti}")
124
+
125
+ # Custom options
126
+ opts = ChemOptions()
127
+ opts.ring_matches_ring_only = True
128
+ is_substructure(query, target, opts=opts, timeout_ms=5000)
129
+ ```
130
+
131
+ ### MCS Search
132
+
133
+ ```python
134
+ from smsd import find_mcs, ChemOptions, McsOptions
135
+
136
+ g1 = parse_smiles("CC(=O)Oc1ccccc1C(=O)O") # aspirin
137
+ g2 = parse_smiles("CC(=O)Nc1ccc(O)cc1") # acetaminophen
138
+
139
+ # Default MCS
140
+ mapping = find_mcs(g1, g2)
141
+ print(f"MCS size: {len(mapping)}")
142
+
143
+ # Tautomer-aware MCS
144
+ taut = ChemOptions.tautomer_profile()
145
+ mapping = find_mcs(g1, g2, chem=taut)
146
+
147
+ # With MCS options
148
+ mcs_opts = McsOptions()
149
+ mcs_opts.timeout_ms = 5000
150
+ mcs_opts.connected_only = True
151
+ mapping = find_mcs(g1, g2, opts=mcs_opts)
152
+
153
+ # Convenience wrapper (accepts SMILES strings directly)
154
+ from smsd import mcs
155
+ mapping = mcs("c1ccccc1", "Cc1ccccc1", tautomer_aware=True)
156
+ ```
157
+
158
+ ### Similarity and Screening
159
+
160
+ ```python
161
+ from smsd import similarity_upper_bound, screen_targets, similarity
162
+
163
+ g1 = parse_smiles("c1ccccc1")
164
+ g2 = parse_smiles("Cc1ccccc1")
165
+
166
+ # Single pair
167
+ sim = similarity_upper_bound(g1, g2)
168
+ print(f"Similarity: {sim:.3f}")
169
+
170
+ # Convenience wrapper (accepts SMILES)
171
+ sim = similarity("c1ccccc1", "Cc1ccccc1")
172
+
173
+ # Batch screening
174
+ library = [parse_smiles(s) for s in smiles_list]
175
+ query = parse_smiles("c1ccccc1")
176
+ hits = screen_targets(query, library, threshold=0.5)
177
+ # Returns indices of molecules with similarity >= 0.5
178
+ ```
179
+
180
+ ### Fingerprints
181
+
182
+ ```python
183
+ from smsd import (
184
+ path_fingerprint, mcs_fingerprint,
185
+ fingerprint_subset, analyze_fp_quality,
186
+ fingerprint, tanimoto,
187
+ )
188
+
189
+ mol = parse_smiles("c1ccccc1")
190
+
191
+ # Path fingerprint (returns set bit positions)
192
+ fp = path_fingerprint(mol, path_length=7, fp_size=2048)
193
+
194
+ # MCS-aware fingerprint
195
+ fp_mcs = mcs_fingerprint(mol, path_length=7, fp_size=2048)
196
+
197
+ # Subset check (for substructure pre-screening)
198
+ query_fp = path_fingerprint(parse_smiles("c1ccccc1"))
199
+ target_fp = path_fingerprint(parse_smiles("c1ccc(O)cc1"))
200
+ assert fingerprint_subset(query_fp, target_fp)
201
+
202
+ # Quality analysis
203
+ quality = analyze_fp_quality(fp)
204
+ print(quality) # {'set_bits': 12, 'density': 0.006, ...}
205
+
206
+ # Convenience wrappers
207
+ fp = fingerprint("CCO", kind="mcs")
208
+ sim = tanimoto(fp, fingerprint("CCCO"))
209
+ ```
210
+
211
+ ### MolGraph Builder
212
+
213
+ Build molecules directly without SMILES:
214
+
215
+ ```python
216
+ from smsd import MolGraphBuilder
217
+
218
+ builder = MolGraphBuilder(6) # 6 atoms
219
+ for i in range(6):
220
+ builder.atom(i, 6, charge=0, aromatic=True, in_ring=True)
221
+ for i in range(6):
222
+ builder.bond(i, (i + 1) % 6, order=1, in_ring=True, aromatic=True)
223
+ benzene = builder.build()
224
+ ```
225
+
226
+ ### Configuration
227
+
228
+ ```python
229
+ from smsd import ChemOptions, McsOptions, BondOrderMode, RingFusionMode
230
+
231
+ # ChemOptions controls atom/bond matching
232
+ chem = ChemOptions()
233
+ chem.match_atom_type = True
234
+ chem.match_formal_charge = True
235
+ chem.tautomer_aware = True
236
+ chem.complete_rings_only = True
237
+ chem.match_bond_order = BondOrderMode.LOOSE
238
+ chem.ring_fusion_mode = RingFusionMode.STRICT
239
+
240
+ # Named profiles
241
+ chem = ChemOptions.tautomer_profile() # tautomer-aware defaults
242
+ chem = ChemOptions.profile("strict") # strict matching
243
+
244
+ # McsOptions controls MCS algorithm behavior
245
+ opts = McsOptions()
246
+ opts.connected_only = True
247
+ opts.timeout_ms = 10000
248
+ opts.maximize_bonds = True # MCES mode
249
+ ```
250
+
251
+ ## Running Tests
252
+
253
+ ```bash
254
+ cd python/
255
+ pip install -e ".[dev]"
256
+ pytest tests/ -v
257
+ ```
258
+
259
+ ## License
260
+
261
+ Apache 2.0. Copyright (c) 2009-2026 Syed Asad Rahman, BioInception Labs.