tyche-core 0.1.0__py3-none-any.whl

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.
tyche/__init__.py ADDED
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env python
2
+
3
+ """
4
+ TYCHE: exhaustive randomization of SMILES and SELFIES strings
5
+
6
+ TYCHE is a lightweight implementation on top of the SELFIES package that
7
+ allows to perform exhaustive randomization of SMILES strings. It randomizes
8
+ the spanning tree, the starting node, the branch priorities, the kekulization
9
+ and the stereochemical labels.
10
+
11
+ The code presented here is a concrete application of TYCHE in chemistry, for
12
+ generating synonymous string representations.
13
+
14
+ Typical usage example:
15
+ import tyche as tc
16
+
17
+ benzene = r'C1=CC=CC=C1'
18
+ benzene_randomized = tc.randomize_smiles(benzene)
19
+
20
+ For comments, bug reports or feature ideas, please send an email to
21
+ r.pollice@rug.nl
22
+ """
23
+
24
+ __version__ = "0.1.0"
25
+
26
+ # Define the __all__ variable
27
+ __all__ = ["randomize", "main", "randomize_smiles_tyche"]
28
+
29
+ # Define up-imports
30
+ from tyche.randomize import randomize_smiles
31
+ from tyche.randomize import randomize_smiles_tyche
tyche/exceptions.py ADDED
@@ -0,0 +1,5 @@
1
+ class KekulizationError(Exception):
2
+ """Exception raised by :func:`tyche.randomize_smiles`.
3
+ """
4
+
5
+ pass
tyche/main.py ADDED
@@ -0,0 +1,33 @@
1
+ import argparse as ap
2
+
3
+ import selfies as sf
4
+
5
+ from tyche.randomize import randomize_smiles
6
+
7
+
8
+ def main():
9
+ """Main function to use TYCHE as a command line tool
10
+ """
11
+
12
+ # parse arguments
13
+ parser = ap.ArgumentParser()
14
+ parser.add_argument("smiles", type=str, help="SMILES string to be randomized.")
15
+ parser.add_argument("--selfies_output", type=bool, default=False, required=False, help="Toggle SELFIES string output.")
16
+ arguments = parser.parse_args()
17
+
18
+ # generate randomized smiles
19
+ randomized_smiles = randomize_smiles(arguments.smiles)
20
+
21
+ # print output
22
+ if arguments.selfies_output:
23
+ # print SELFIES output
24
+ print(sf.encoder(randomized_smiles))
25
+ else:
26
+ # print SMILES output
27
+ print(randomized_smiles)
28
+
29
+ return
30
+
31
+
32
+ if __name__ == "__main__":
33
+ main()