schemist 0.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.
- schemist-0.0.1/LICENSE +21 -0
- schemist-0.0.1/PKG-INFO +140 -0
- schemist-0.0.1/README.md +87 -0
- schemist-0.0.1/pyproject.toml +61 -0
- schemist-0.0.1/schemist/__init__.py +3 -0
- schemist-0.0.1/schemist/cleaning.py +27 -0
- schemist-0.0.1/schemist/cli.py +535 -0
- schemist-0.0.1/schemist/collating.py +317 -0
- schemist-0.0.1/schemist/converting.py +369 -0
- schemist-0.0.1/schemist/features.py +271 -0
- schemist-0.0.1/schemist/generating.py +262 -0
- schemist-0.0.1/schemist/io.py +149 -0
- schemist-0.0.1/schemist/rest_lookup.py +118 -0
- schemist-0.0.1/schemist/splitting.py +205 -0
- schemist-0.0.1/schemist/tables.py +228 -0
- schemist-0.0.1/schemist/typing.py +7 -0
- schemist-0.0.1/schemist/utils.py +1 -0
- schemist-0.0.1/schemist.egg-info/PKG-INFO +140 -0
- schemist-0.0.1/schemist.egg-info/SOURCES.txt +23 -0
- schemist-0.0.1/schemist.egg-info/dependency_links.txt +1 -0
- schemist-0.0.1/schemist.egg-info/entry_points.txt +2 -0
- schemist-0.0.1/schemist.egg-info/requires.txt +9 -0
- schemist-0.0.1/schemist.egg-info/top_level.txt +1 -0
- schemist-0.0.1/setup.cfg +4 -0
- schemist-0.0.1/test/tests.py +6 -0
schemist-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [year] [fullname]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
schemist-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: schemist
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Organizing and processing tables of chemical structures.
|
|
5
|
+
Author-email: Eachan Johnson <eachan.johnson@crick.ac.uk>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) [year] [fullname]
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
Project-URL: Homepage, https://github.com/scbirlab/schemist
|
|
28
|
+
Project-URL: Repository, https://github.com/scbirlab/schemist.git
|
|
29
|
+
Project-URL: Bug Tracker, https://github.com/scbirlab/schemist/issues
|
|
30
|
+
Project-URL: Documentation, https://readthedocs.org/schemist
|
|
31
|
+
Keywords: science,chemistry,SMILES,SELFIES,cheminformatics
|
|
32
|
+
Classifier: Development Status :: 3 - Alpha
|
|
33
|
+
Classifier: Intended Audience :: Science/Research
|
|
34
|
+
Classifier: Topic :: Scientific/Engineering :: Chemistry
|
|
35
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
40
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
41
|
+
Requires-Python: >=3.8
|
|
42
|
+
Description-Content-Type: text/markdown
|
|
43
|
+
License-File: LICENSE
|
|
44
|
+
Requires-Dist: carabiner-tools[pd]>=0.0.3.post1
|
|
45
|
+
Requires-Dist: datamol
|
|
46
|
+
Requires-Dist: descriptastorus==2.6.1
|
|
47
|
+
Requires-Dist: nemony
|
|
48
|
+
Requires-Dist: openpyxl==3.1.0
|
|
49
|
+
Requires-Dist: pandas
|
|
50
|
+
Requires-Dist: rdkit
|
|
51
|
+
Requires-Dist: requests
|
|
52
|
+
Requires-Dist: selfies
|
|
53
|
+
|
|
54
|
+
# ⬢⬢⬢ schemist
|
|
55
|
+
|
|
56
|
+

|
|
57
|
+

|
|
58
|
+

|
|
59
|
+
[](https://huggingface.co/spaces/scbirlab/chem-converter)
|
|
60
|
+
|
|
61
|
+
Cleaning, collating, and augmenting chemical datasets.
|
|
62
|
+
|
|
63
|
+
- [Installation](#installation)
|
|
64
|
+
- [Command-line usage](#command-line-usage)
|
|
65
|
+
- [Python API](#python-api)
|
|
66
|
+
- [Documentation](#documentation)
|
|
67
|
+
|
|
68
|
+
## Installation
|
|
69
|
+
|
|
70
|
+
### The easy way
|
|
71
|
+
|
|
72
|
+
Install the pre-compiled version from PyPI:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pip install schemist
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### From source
|
|
79
|
+
|
|
80
|
+
Clone the repository, then `cd` into it. Then run:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
pip install -e .
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Command-line usage
|
|
87
|
+
|
|
88
|
+
**schemist** provides command-line utlities. The list of commands can be checked like so:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
$ schemist --help
|
|
92
|
+
usage: schemist [-h] [--version] {clean,convert,featurize,collate,dedup,enumerate,react,split} ...
|
|
93
|
+
|
|
94
|
+
Tools for cleaning, collating, and augmenting chemical datasets.
|
|
95
|
+
|
|
96
|
+
options:
|
|
97
|
+
-h, --help show this help message and exit
|
|
98
|
+
--version, -v show program's version number and exit
|
|
99
|
+
|
|
100
|
+
Sub-commands:
|
|
101
|
+
{clean,convert,featurize,collate,dedup,enumerate,react,split}
|
|
102
|
+
Use these commands to specify the tool you want to use.
|
|
103
|
+
clean Clean and normalize SMILES column of a table.
|
|
104
|
+
convert Convert between string representations of chemical structures.
|
|
105
|
+
featurize Convert between string representations of chemical structures.
|
|
106
|
+
collate Collect disparate tables or SDF files of libraries into a single table.
|
|
107
|
+
dedup Deduplicate chemical structures and retain references.
|
|
108
|
+
enumerate Enumerate bio-chemical structures within length and sequence constraints.
|
|
109
|
+
react React compounds in silico in indicated columns using a named reaction.
|
|
110
|
+
split Split table based on chosen algorithm, optionally taking account of chemical structure during splits.
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Each command is designed to work on large data files in a streaming fashion, so that the entire file is not held in memory at once. One caveat is that the scaffold-based splits are very slow with tables of millions of rows.
|
|
114
|
+
|
|
115
|
+
All commands (except `collate`) take from the input table a named column with a SMILES, SELFIES, amino-acid sequence, HELM, or InChI representation of compounds.
|
|
116
|
+
|
|
117
|
+
The tools complete specific tasks which
|
|
118
|
+
can be easily composed into analysis pipelines, because the TSV table output goes to
|
|
119
|
+
`stdout` by default so they can be piped from one tool to another.
|
|
120
|
+
|
|
121
|
+
To get help for a specific command, do
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
schemist <command> --help
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
For the Python API, [see below](#python-api).
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
## Python API
|
|
131
|
+
|
|
132
|
+
**schemist** can be imported into Python to help make custom analyses.
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
>>> import schemist as sch
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Documentation
|
|
139
|
+
|
|
140
|
+
Full API documentation is at [ReadTheDocs](https://schemist.readthedocs.org).
|
schemist-0.0.1/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# ⬢⬢⬢ schemist
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
[](https://huggingface.co/spaces/scbirlab/chem-converter)
|
|
7
|
+
|
|
8
|
+
Cleaning, collating, and augmenting chemical datasets.
|
|
9
|
+
|
|
10
|
+
- [Installation](#installation)
|
|
11
|
+
- [Command-line usage](#command-line-usage)
|
|
12
|
+
- [Python API](#python-api)
|
|
13
|
+
- [Documentation](#documentation)
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
### The easy way
|
|
18
|
+
|
|
19
|
+
Install the pre-compiled version from PyPI:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install schemist
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### From source
|
|
26
|
+
|
|
27
|
+
Clone the repository, then `cd` into it. Then run:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install -e .
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Command-line usage
|
|
34
|
+
|
|
35
|
+
**schemist** provides command-line utlities. The list of commands can be checked like so:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
$ schemist --help
|
|
39
|
+
usage: schemist [-h] [--version] {clean,convert,featurize,collate,dedup,enumerate,react,split} ...
|
|
40
|
+
|
|
41
|
+
Tools for cleaning, collating, and augmenting chemical datasets.
|
|
42
|
+
|
|
43
|
+
options:
|
|
44
|
+
-h, --help show this help message and exit
|
|
45
|
+
--version, -v show program's version number and exit
|
|
46
|
+
|
|
47
|
+
Sub-commands:
|
|
48
|
+
{clean,convert,featurize,collate,dedup,enumerate,react,split}
|
|
49
|
+
Use these commands to specify the tool you want to use.
|
|
50
|
+
clean Clean and normalize SMILES column of a table.
|
|
51
|
+
convert Convert between string representations of chemical structures.
|
|
52
|
+
featurize Convert between string representations of chemical structures.
|
|
53
|
+
collate Collect disparate tables or SDF files of libraries into a single table.
|
|
54
|
+
dedup Deduplicate chemical structures and retain references.
|
|
55
|
+
enumerate Enumerate bio-chemical structures within length and sequence constraints.
|
|
56
|
+
react React compounds in silico in indicated columns using a named reaction.
|
|
57
|
+
split Split table based on chosen algorithm, optionally taking account of chemical structure during splits.
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Each command is designed to work on large data files in a streaming fashion, so that the entire file is not held in memory at once. One caveat is that the scaffold-based splits are very slow with tables of millions of rows.
|
|
61
|
+
|
|
62
|
+
All commands (except `collate`) take from the input table a named column with a SMILES, SELFIES, amino-acid sequence, HELM, or InChI representation of compounds.
|
|
63
|
+
|
|
64
|
+
The tools complete specific tasks which
|
|
65
|
+
can be easily composed into analysis pipelines, because the TSV table output goes to
|
|
66
|
+
`stdout` by default so they can be piped from one tool to another.
|
|
67
|
+
|
|
68
|
+
To get help for a specific command, do
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
schemist <command> --help
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
For the Python API, [see below](#python-api).
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
## Python API
|
|
78
|
+
|
|
79
|
+
**schemist** can be imported into Python to help make custom analyses.
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
>>> import schemist as sch
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Documentation
|
|
86
|
+
|
|
87
|
+
Full API documentation is at [ReadTheDocs](https://schemist.readthedocs.org).
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "schemist"
|
|
3
|
+
version = "0.0.1"
|
|
4
|
+
authors = [
|
|
5
|
+
{ name="Eachan Johnson", email="eachan.johnson@crick.ac.uk" },
|
|
6
|
+
]
|
|
7
|
+
description = "Organizing and processing tables of chemical structures."
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
requires-python = ">=3.8"
|
|
10
|
+
license = {file = "LICENSE"}
|
|
11
|
+
keywords = ["science", "chemistry", "SMILES", "SELFIES", "cheminformatics"]
|
|
12
|
+
|
|
13
|
+
classifiers = [
|
|
14
|
+
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
|
|
17
|
+
# Indicate who your project is intended for
|
|
18
|
+
"Intended Audience :: Science/Research",
|
|
19
|
+
"Topic :: Scientific/Engineering :: Chemistry",
|
|
20
|
+
|
|
21
|
+
"License :: OSI Approved :: MIT License",
|
|
22
|
+
|
|
23
|
+
"Programming Language :: Python :: 3.8",
|
|
24
|
+
"Programming Language :: Python :: 3.9",
|
|
25
|
+
"Programming Language :: Python :: 3.10",
|
|
26
|
+
"Programming Language :: Python :: 3.11",
|
|
27
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
dependencies = [
|
|
31
|
+
"carabiner-tools[pd]>=0.0.3.post1",
|
|
32
|
+
"datamol",
|
|
33
|
+
"descriptastorus==2.6.1",
|
|
34
|
+
"nemony",
|
|
35
|
+
"openpyxl==3.1.0",
|
|
36
|
+
"pandas",
|
|
37
|
+
"rdkit",
|
|
38
|
+
"requests",
|
|
39
|
+
"selfies",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
[project.urls]
|
|
43
|
+
"Homepage" = "https://github.com/scbirlab/schemist"
|
|
44
|
+
"Repository" = "https://github.com/scbirlab/schemist.git"
|
|
45
|
+
"Bug Tracker" = "https://github.com/scbirlab/schemist/issues"
|
|
46
|
+
"Documentation" = "https://readthedocs.org/schemist"
|
|
47
|
+
|
|
48
|
+
[project.scripts] # Optional
|
|
49
|
+
schemist = "schemist.cli:main"
|
|
50
|
+
|
|
51
|
+
[tool.setuptools]
|
|
52
|
+
packages = ["schemist"]
|
|
53
|
+
# If there are data files included in your packages that need to be
|
|
54
|
+
# installed, specify them here.
|
|
55
|
+
# package-data = {"" = ["*.yml"]}
|
|
56
|
+
|
|
57
|
+
[build-system]
|
|
58
|
+
# These are the assumed default build requirements from pip:
|
|
59
|
+
# https://pip.pypa.io/en/stable/reference/pip/#pep-517-and-518-support
|
|
60
|
+
requires = ["setuptools>=43.0.0", "wheel"]
|
|
61
|
+
build-backend = "setuptools.build_meta"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""Chemical structure cleaning routines."""
|
|
2
|
+
|
|
3
|
+
from carabiner.decorators import vectorize
|
|
4
|
+
|
|
5
|
+
from datamol import sanitize_smiles
|
|
6
|
+
import selfies as sf
|
|
7
|
+
|
|
8
|
+
@vectorize
|
|
9
|
+
def clean_smiles(smiles: str,
|
|
10
|
+
*args, **kwargs) -> str:
|
|
11
|
+
|
|
12
|
+
"""Sanitize a SMILES string or list of SMILES strings.
|
|
13
|
+
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
return sanitize_smiles(smiles, *args, **kwargs)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@vectorize
|
|
20
|
+
def clean_selfies(selfies: str,
|
|
21
|
+
*args, **kwargs) -> str:
|
|
22
|
+
|
|
23
|
+
"""Sanitize a SELFIES string or list of SELFIES strings.
|
|
24
|
+
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
return sf.encode(sanitize_smiles(sf.decode(selfies), *args, **kwargs))
|