synkit 0.0.7__tar.gz → 0.0.8__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.
- synkit-0.0.8/Data/Figure/synkit.png +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/PKG-INFO +1 -1
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/ITS/test_its_construction.py +4 -4
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/ITS/test_its_expand.py +1 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/IO/test_chemical_converter.py +8 -2
- synkit-0.0.8/build-doc.sh +31 -0
- {synkit-0.0.7 → synkit-0.0.8}/doc/api.rst +44 -9
- {synkit-0.0.7 → synkit-0.0.8}/doc/io.rst +12 -12
- {synkit-0.0.7 → synkit-0.0.8}/pyproject.toml +1 -1
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Chem/Reaction/aam_validator.py +3 -3
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/Hyrogen/hcomplete.py +1 -1
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/ITS/its_construction.py +105 -1
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/ITS/its_expand.py +1 -2
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/ITS/normalize_aam.py +0 -1
- {synkit-0.0.7 → synkit-0.0.8}/synkit/IO/chem_converter.py +47 -12
- synkit-0.0.8/synkit/IO/data_io.py +335 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/IO/debug.py +21 -27
- {synkit-0.0.7 → synkit-0.0.8}/synkit/IO/gml_to_nx.py +34 -2
- {synkit-0.0.7 → synkit-0.0.8}/synkit/IO/graph_to_mol.py +36 -19
- synkit-0.0.8/synkit/IO/mol_to_graph.py +353 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/IO/nx_to_gml.py +78 -73
- synkit-0.0.7/Data/Figure/synkit.png +0 -0
- synkit-0.0.7/synkit/IO/data_io.py +0 -356
- synkit-0.0.7/synkit/IO/mol_to_graph.py +0 -282
- {synkit-0.0.7 → synkit-0.0.8}/.github/workflows/build-doc.yml +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/.github/workflows/publish-package.yml +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/.github/workflows/test-and-lint.yml +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/.gitignore +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Data/Testcase/Compose/ComposeRule/data.txt +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Data/Testcase/Compose/SingleRule/R0/0.gml +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Data/Testcase/Compose/SingleRule/R0/1.gml +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Data/Testcase/Compose/SingleRule/R0/2.gml +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/LICENSE +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Makefile +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/README.md +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Chem/Fingerprint/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Chem/Fingerprint/test_fp_calculator.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Chem/Fingerprint/test_smiles_featurizer.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Chem/Fingerprint/test_transformation_fp.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Chem/Molecule/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Chem/Molecule/test_standardize.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Chem/Reaction/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Chem/Reaction/test_aam_utils.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Chem/Reaction/test_aam_validator.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Chem/Reaction/test_balance_checker.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Chem/Reaction/test_canon_rsmi.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Chem/Reaction/test_cleanning.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Chem/Reaction/test_deionize.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Chem/Reaction/test_fix_aam.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Chem/Reaction/test_neutralize.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Chem/Reaction/test_rsmi_utils.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Chem/Reaction/test_standardize.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Chem/Reaction/test_tautomerize.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Chem/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/Context/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/Context/test_hier_context.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/Context/test_radius_expand.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/Feature/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/Feature/test_graph_descriptors.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/Feature/test_graph_fps.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/Feature/test_graph_signature.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/Feature/test_hash_fps.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/Feature/test_morgan_fps.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/Feature/test_path_fps.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/Hydrogen/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/Hydrogen/test_graph_hydrogen.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/Hydrogen/test_hcomplete.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/Hydrogen/test_misc.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/ITS/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/ITS/test_normalize_aam.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/MTG/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/MTG/test_group_comp.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/MTG/test_groupoid.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/MTG/test_mtg.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/Matcher/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/Matcher/test_batch_cluster.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/Matcher/test_graph_cluster.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/Matcher/test_graph_matcher.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/Matcher/test_graph_morphism.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/Matcher/test_subgraph_matcher.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/test_canon_graph.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Graph/test_syn_graph.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/IO/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/IO/test_dg_to_gml.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/IO/test_gml_to_nx.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/IO/test_graph_to_mol.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/IO/test_mol_to_graph.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/IO/test_nx_to_gml.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Rule/Apply/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Rule/Apply/test_reactor_rule.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Rule/Apply/test_retro_reactor.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Rule/Apply/test_rule_rbl.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Rule/Compose/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Rule/Compose/test_rule_compose.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Rule/Compose/test_valance_constrain.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Rule/Modify/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Rule/Modify/test_molecule_rule.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Rule/Modify/test_rule_utils.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Rule/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Rule/test_syn_rule.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Synthesis/CRN/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Synthesis/CRN/test_crn.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Synthesis/CRN/test_mod_crn.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Synthesis/MSR/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Synthesis/MSR/test_multi_steps.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Synthesis/MSR/test_path_finder.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Synthesis/Reactor/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Synthesis/Reactor/test_core_engine.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Synthesis/Reactor/test_mod_aam.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Synthesis/Reactor/test_mod_reactor.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Synthesis/Reactor/test_strategy.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Synthesis/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Synthesis/test_reactor_utils.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Vis/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/Vis/test_embedding.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/Test/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/doc/changelog.rst +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/doc/chem.rst +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/doc/conf.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/doc/figures/aldol.png +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/doc/figures/aldol_its.png +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/doc/figures/mtg.png +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/doc/getting_started.rst +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/doc/graph.rst +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/doc/index.rst +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/doc/reference.rst +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/doc/refs.bib +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/doc/rule.rst +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/doc/synthesis.rst +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/environment.yml +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/lint.sh +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/make.bat +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/pytest.sh +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/requirements.txt +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Chem/Fingerprint/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Chem/Fingerprint/fp_calculator.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Chem/Fingerprint/smiles_featurizer.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Chem/Fingerprint/transformation_fp.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Chem/Molecule/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Chem/Molecule/standardize.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Chem/Reaction/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Chem/Reaction/aam_utils.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Chem/Reaction/balance_check.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Chem/Reaction/canon_rsmi.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Chem/Reaction/cleanning.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Chem/Reaction/deionize.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Chem/Reaction/fix_aam.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Chem/Reaction/neutralize.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Chem/Reaction/rsmi_utils.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Chem/Reaction/standardize.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Chem/Reaction/tautomerize.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Chem/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Chem/utils.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/Context/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/Context/hier_context.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/Context/radius_expand.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/Feature/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/Feature/graph_descriptors.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/Feature/graph_fps.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/Feature/graph_signature.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/Feature/hash_fps.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/Feature/morgan_fps.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/Feature/path_fps.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/Feature/wl_hash.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/Hyrogen/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/Hyrogen/_misc.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/Hyrogen/hextend.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/ITS/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/ITS/its_builder.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/ITS/its_decompose.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/MTG/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/MTG/group_comp.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/MTG/groupoid.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/MTG/mcs_matcher.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/MTG/mtg.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/Matcher/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/Matcher/batch_cluster.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/Matcher/graph_cluster.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/Matcher/graph_matcher.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/Matcher/graph_morphism.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/Matcher/mcs_matcher.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/Matcher/sing.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/Matcher/subgraph_matcher.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/Matcher/turbo_iso.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/canon_algs.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/canon_graph.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/syn_graph.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Graph/utils.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/IO/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/IO/data_process.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/IO/dg_to_gml.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/IO/smiles_to_id.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Rule/Apply/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Rule/Apply/reactor_rule.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Rule/Apply/retro_reactor.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Rule/Apply/rule_rbl.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Rule/Compose/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Rule/Compose/compose_rule.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Rule/Compose/rule_compose.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Rule/Compose/rule_mapping.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Rule/Compose/seq_comp.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Rule/Compose/valence_constrain.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Rule/Modify/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Rule/Modify/implict_rule.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Rule/Modify/longest_path.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Rule/Modify/molecule_rule.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Rule/Modify/prune_templates.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Rule/Modify/rule_utils.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Rule/Modify/strip_rule.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Rule/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Rule/syn_rule.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Synthesis/CRN/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Synthesis/CRN/crn.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Synthesis/CRN/dcrn.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Synthesis/CRN/mod_crn.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Synthesis/MSR/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Synthesis/MSR/multi_steps.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Synthesis/MSR/path_finder.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Synthesis/Metrics/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Synthesis/Metrics/_base.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Synthesis/Metrics/_plot.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Synthesis/Metrics/_ranking.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Synthesis/Reactor/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Synthesis/Reactor/core_engine.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Synthesis/Reactor/mod_aam.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Synthesis/Reactor/mod_reactor.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Synthesis/Reactor/old_syn_reactor.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Synthesis/Reactor/single_predictor.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Synthesis/Reactor/strategy.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Synthesis/Reactor/syn_reactor.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Synthesis/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Synthesis/reactor_utils.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Utils/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Utils/utils.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Vis/__init__.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Vis/chemical_space.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Vis/embedding.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Vis/graph_visualizer.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Vis/pdf_writer.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Vis/rule_vis.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/Vis/rxn_vis.py +0 -0
- {synkit-0.0.7 → synkit-0.0.8}/synkit/__init__.py +0 -0
|
Binary file
|
|
@@ -21,21 +21,21 @@ class TestITSConstruction(unittest.TestCase):
|
|
|
21
21
|
self.H.add_edge(1, 2, order=1) # Different order
|
|
22
22
|
|
|
23
23
|
def test_ITSGraph(self):
|
|
24
|
-
ITS = ITSConstruction.ITSGraph(self.G, self.H)
|
|
24
|
+
ITS = ITSConstruction().ITSGraph(self.G, self.H)
|
|
25
25
|
self.assertTrue(isinstance(ITS, nx.Graph))
|
|
26
26
|
self.assertEqual(len(ITS.nodes()), 2)
|
|
27
27
|
self.assertEqual(len(ITS.edges()), 1)
|
|
28
28
|
self.assertEqual(ITS[1][2]["order"], (2, 1))
|
|
29
29
|
|
|
30
30
|
def test_get_node_attributes_with_defaults(self):
|
|
31
|
-
attributes = ITSConstruction.get_node_attributes_with_defaults(self.G, 1)
|
|
31
|
+
attributes = ITSConstruction().get_node_attributes_with_defaults(self.G, 1)
|
|
32
32
|
self.assertEqual(attributes, ("C", False, 2, 0, ["", ""]))
|
|
33
33
|
|
|
34
34
|
def test_add_edges_to_ITS(self):
|
|
35
35
|
ITS = nx.Graph()
|
|
36
36
|
ITS.add_node(1, element="C", aromatic=False, hcount=3, charge=0)
|
|
37
37
|
ITS.add_node(2, element="C", aromatic=False, hcount=3, charge=0)
|
|
38
|
-
new_ITS = ITSConstruction.add_edges_to_ITS(ITS, self.G, self.H)
|
|
38
|
+
new_ITS = ITSConstruction().add_edges_to_ITS(ITS, self.G, self.H)
|
|
39
39
|
self.assertTrue(isinstance(new_ITS, nx.Graph))
|
|
40
40
|
self.assertEqual(len(new_ITS.edges()), 1)
|
|
41
41
|
self.assertEqual(new_ITS[1][2]["order"], (2, 1))
|
|
@@ -43,7 +43,7 @@ class TestITSConstruction(unittest.TestCase):
|
|
|
43
43
|
def test_add_standard_order_attribute(self):
|
|
44
44
|
graph = nx.Graph()
|
|
45
45
|
graph.add_edge(1, 2, order=(1, 2))
|
|
46
|
-
updated_graph = ITSConstruction.add_standard_order_attribute(graph)
|
|
46
|
+
updated_graph = ITSConstruction().add_standard_order_attribute(graph)
|
|
47
47
|
self.assertEqual(updated_graph[1][2]["standard_order"], -1)
|
|
48
48
|
|
|
49
49
|
|
|
@@ -86,7 +86,10 @@ class TestChemicalConversions(unittest.TestCase):
|
|
|
86
86
|
def test_smiles_to_graph_valid(self):
|
|
87
87
|
# Test converting a valid SMILES to a graph
|
|
88
88
|
result = smiles_to_graph(
|
|
89
|
-
"[CH3:1][CH2:2][OH:3]",
|
|
89
|
+
"[CH3:1][CH2:2][OH:3]",
|
|
90
|
+
False,
|
|
91
|
+
True,
|
|
92
|
+
True,
|
|
90
93
|
)
|
|
91
94
|
self.assertIsInstance(result, nx.Graph)
|
|
92
95
|
self.assertEqual(result.number_of_nodes(), 3)
|
|
@@ -94,7 +97,10 @@ class TestChemicalConversions(unittest.TestCase):
|
|
|
94
97
|
def test_smiles_to_graph_invalid(self):
|
|
95
98
|
# Test converting an invalid SMILES string to a graph
|
|
96
99
|
result = smiles_to_graph(
|
|
97
|
-
"invalid_smiles",
|
|
100
|
+
"invalid_smiles",
|
|
101
|
+
True,
|
|
102
|
+
False,
|
|
103
|
+
False,
|
|
98
104
|
)
|
|
99
105
|
self.assertIsNone(result)
|
|
100
106
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
set -e
|
|
4
|
+
|
|
5
|
+
echo "Checking and installing documentation dependencies..."
|
|
6
|
+
|
|
7
|
+
# Function to check and install a Python package if missing
|
|
8
|
+
install_if_missing() {
|
|
9
|
+
PACKAGE=$1
|
|
10
|
+
python -c "import $PACKAGE" 2>/dev/null || {
|
|
11
|
+
echo "Installing $PACKAGE..."
|
|
12
|
+
pip install "$PACKAGE"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
# Check and install main Sphinx packages
|
|
17
|
+
install_if_missing sphinx
|
|
18
|
+
install_if_missing sphinx_rtd_theme
|
|
19
|
+
|
|
20
|
+
# sphinxcontrib-bibtex can have a dash in its import, so:
|
|
21
|
+
pip show sphinxcontrib-bibtex >/dev/null 2>&1 || {
|
|
22
|
+
echo "Installing sphinxcontrib-bibtex..."
|
|
23
|
+
pip install sphinxcontrib-bibtex
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
echo "Building Sphinx documentation..."
|
|
27
|
+
|
|
28
|
+
# Build the docs (adjust source/build dirs as needed)
|
|
29
|
+
python3 -m sphinx -b html ./doc ./docs
|
|
30
|
+
|
|
31
|
+
echo "Documentation built in ./docs"
|
|
@@ -2,15 +2,6 @@
|
|
|
2
2
|
API
|
|
3
3
|
====
|
|
4
4
|
|
|
5
|
-
IO Module
|
|
6
|
-
=========
|
|
7
|
-
The `IO` module provides tools for handling input and output operations related to the chemical converter. It allows seamless interaction with various chemical data formats.
|
|
8
|
-
|
|
9
|
-
.. automodule:: synkit.IO.chem_converter
|
|
10
|
-
:members:
|
|
11
|
-
:undoc-members:
|
|
12
|
-
:show-inheritance:
|
|
13
|
-
|
|
14
5
|
Chem Module
|
|
15
6
|
===========
|
|
16
7
|
The `Chem` module provides tools for handling input and output operations related to the chemical converter. It allows seamless interaction with various chemical data formats.
|
|
@@ -198,3 +189,47 @@ The ``synkit.Vis`` package offers a suite of **visualization utilities** for bot
|
|
|
198
189
|
:members:
|
|
199
190
|
:undoc-members:
|
|
200
191
|
:show-inheritance:
|
|
192
|
+
|
|
193
|
+
IO Module
|
|
194
|
+
=========
|
|
195
|
+
The `IO` module provides tools for handling input and output operations related to the chemical converter. It allows seamless interaction with various chemical data formats.
|
|
196
|
+
|
|
197
|
+
Chemical Conversion
|
|
198
|
+
-------------------
|
|
199
|
+
.. automodule:: synkit.IO.chem_converter
|
|
200
|
+
:members:
|
|
201
|
+
:undoc-members:
|
|
202
|
+
:show-inheritance:
|
|
203
|
+
|
|
204
|
+
.. automodule:: synkit.IO.mol_to_graph
|
|
205
|
+
:members:
|
|
206
|
+
:undoc-members:
|
|
207
|
+
:show-inheritance:
|
|
208
|
+
|
|
209
|
+
.. automodule:: synkit.IO.graph_to_mol
|
|
210
|
+
:members:
|
|
211
|
+
:undoc-members:
|
|
212
|
+
:show-inheritance:
|
|
213
|
+
|
|
214
|
+
.. automodule:: synkit.IO.nx_to_gml
|
|
215
|
+
:members:
|
|
216
|
+
:undoc-members:
|
|
217
|
+
:show-inheritance:
|
|
218
|
+
|
|
219
|
+
.. automodule:: synkit.IO.gml_to_nx
|
|
220
|
+
:members:
|
|
221
|
+
:undoc-members:
|
|
222
|
+
:show-inheritance:
|
|
223
|
+
|
|
224
|
+
IO Functions
|
|
225
|
+
------------
|
|
226
|
+
|
|
227
|
+
.. automodule:: synkit.IO.data_io
|
|
228
|
+
:members:
|
|
229
|
+
:undoc-members:
|
|
230
|
+
:show-inheritance:
|
|
231
|
+
|
|
232
|
+
.. automodule:: synkit.IO.data_io
|
|
233
|
+
:members:
|
|
234
|
+
:undoc-members:
|
|
235
|
+
:show-inheritance:
|
|
@@ -102,31 +102,31 @@ Set ``core=True`` to include only the **reaction center**, and ``useSmile=True``
|
|
|
102
102
|
:linenos:
|
|
103
103
|
|
|
104
104
|
from synkit.IO import (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
rsmi_to_its,
|
|
106
|
+
smart_to_gml,
|
|
107
|
+
its_to_gml,
|
|
108
|
+
save_text_as_gml,
|
|
109
|
+
load_gml_as_text,
|
|
110
110
|
)
|
|
111
111
|
|
|
112
112
|
# Define the aldol reaction template
|
|
113
113
|
reaction = (
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
114
|
+
'[CH3:1][CH:2]=[O:3].'
|
|
115
|
+
'[CH:4]([H:7])([H:8])[CH:5]=[O:6]'
|
|
116
|
+
'>>'
|
|
117
|
+
'[CH3:1][CH:2]=[CH:4][CH:5]=[O:6].'
|
|
118
|
+
'[O:3]([H:7])([H:8])'
|
|
119
119
|
)
|
|
120
120
|
|
|
121
121
|
# Option 1: Direct SMARTS → GML
|
|
122
|
-
gml_rule_1 = smart_to_gml(reaction, core=True,
|
|
122
|
+
gml_rule_1 = smart_to_gml(reaction, core=True, useSmiles=False)
|
|
123
123
|
|
|
124
124
|
# Option 2: SMILES → ITS → GML
|
|
125
125
|
its_graph = rsmi_to_its(reaction, core=True)
|
|
126
126
|
gml_rule_2 = its_to_gml(its_graph, core=True)
|
|
127
127
|
|
|
128
128
|
# Save to disk
|
|
129
|
-
save_text_as_gml("aldol_rule.gml"
|
|
129
|
+
save_text_as_gml(gml_text=gml_rule_2, file_path="aldol_rule.gml")
|
|
130
130
|
|
|
131
131
|
# Load back into text
|
|
132
132
|
loaded_rule = load_gml_as_text("aldol_rule.gml")
|
|
@@ -85,10 +85,10 @@ class AAMValidator:
|
|
|
85
85
|
its_graphs, rc_graphs = [], []
|
|
86
86
|
try:
|
|
87
87
|
for rsmi in (mapped_smile, ground_truth):
|
|
88
|
-
G, H = rsmi_to_graph(
|
|
89
|
-
|
|
88
|
+
G, H = rsmi_to_graph(rsmi=rsmi, sanitize=True, drop_non_aam=True)
|
|
89
|
+
its = ITSConstruction().ITSGraph(
|
|
90
|
+
G, H, ignore_aromaticity=ignore_aromaticity
|
|
90
91
|
)
|
|
91
|
-
its = ITSConstruction.ITSGraph(G, H, ignore_aromaticity)
|
|
92
92
|
its_graphs.append(its)
|
|
93
93
|
rc_graphs.append(get_rc(its))
|
|
94
94
|
|
|
@@ -287,7 +287,7 @@ class HComplete:
|
|
|
287
287
|
current_prod_graph = HComplete.add_hydrogen_nodes_multiple_utils(
|
|
288
288
|
current_prod_graph, zip(hydrogen_nodes_form, permutation)
|
|
289
289
|
)
|
|
290
|
-
its = ITSConstruction.ITSGraph(
|
|
290
|
+
its = ITSConstruction().ITSGraph(
|
|
291
291
|
current_react_graph,
|
|
292
292
|
current_prod_graph,
|
|
293
293
|
ignore_aromaticity=ignore_aromaticity,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import networkx as nx
|
|
2
|
-
from typing import Tuple, Dict, Any
|
|
2
|
+
from typing import Tuple, Dict, Any, Optional, List
|
|
3
3
|
from copy import deepcopy
|
|
4
4
|
|
|
5
5
|
|
|
@@ -211,3 +211,107 @@ class ITSConstruction:
|
|
|
211
211
|
new_graph[u][v]["standard_order"] = 0
|
|
212
212
|
|
|
213
213
|
return new_graph
|
|
214
|
+
|
|
215
|
+
@staticmethod
|
|
216
|
+
def construct(
|
|
217
|
+
G: nx.Graph,
|
|
218
|
+
H: nx.Graph,
|
|
219
|
+
*,
|
|
220
|
+
ignore_aromaticity: bool = False,
|
|
221
|
+
balance_its: bool = True,
|
|
222
|
+
node_attrs: Optional[List[str]] = None,
|
|
223
|
+
edge_attrs: Optional[List[str]] = None,
|
|
224
|
+
) -> nx.Graph:
|
|
225
|
+
"""
|
|
226
|
+
Constructs an ITS (Imaginary Transition State) graph from two input graphs,
|
|
227
|
+
and annotates each node and edge with a tuple: ((G attributes...), (H attributes...)).
|
|
228
|
+
|
|
229
|
+
The order of attributes in the tuple is defined by `node_attrs` and `edge_attrs`.
|
|
230
|
+
Users are responsible for remembering the order.
|
|
231
|
+
|
|
232
|
+
:param G: The first input NetworkX graph (typically the reactant).
|
|
233
|
+
:type G: nx.Graph
|
|
234
|
+
:param H: The second input NetworkX graph (typically the product).
|
|
235
|
+
:type H: nx.Graph
|
|
236
|
+
:param ignore_aromaticity: If True, aromaticity is ignored in edge comparison.
|
|
237
|
+
:type ignore_aromaticity: bool
|
|
238
|
+
:param balance_its: If True, balances the ITS size using node count.
|
|
239
|
+
:type balance_its: bool
|
|
240
|
+
:param node_attrs: List of node attributes for the tuple (order matters!).
|
|
241
|
+
:type node_attrs: list[str] or None
|
|
242
|
+
:param edge_attrs: List of edge attributes for the tuple (order matters!).
|
|
243
|
+
:type edge_attrs: list[str] or None
|
|
244
|
+
|
|
245
|
+
:returns: The constructed ITS NetworkX graph with `typesGH` tuples on nodes and edges.
|
|
246
|
+
:rtype: nx.Graph
|
|
247
|
+
"""
|
|
248
|
+
if node_attrs is None:
|
|
249
|
+
node_attrs = [
|
|
250
|
+
"element",
|
|
251
|
+
"charge",
|
|
252
|
+
"atom_map",
|
|
253
|
+
"hcount",
|
|
254
|
+
"aromatic",
|
|
255
|
+
"neighbors",
|
|
256
|
+
]
|
|
257
|
+
if edge_attrs is None:
|
|
258
|
+
edge_attrs = ["order"]
|
|
259
|
+
|
|
260
|
+
# Construct initial ITS graph using the existing method
|
|
261
|
+
its = ITSConstruction.ITSGraph(
|
|
262
|
+
G, H, ignore_aromaticity=ignore_aromaticity, balance_its=balance_its
|
|
263
|
+
)
|
|
264
|
+
|
|
265
|
+
# Attach node typesGH as a tuple: ((G attributes...), (H attributes...))
|
|
266
|
+
for n in its.nodes():
|
|
267
|
+
g_attrs = tuple(
|
|
268
|
+
G.nodes[n].get(attr, 0) if n in G.nodes else 0 for attr in node_attrs
|
|
269
|
+
)
|
|
270
|
+
h_attrs = tuple(
|
|
271
|
+
H.nodes[n].get(attr, 0) if n in H.nodes else 0 for attr in node_attrs
|
|
272
|
+
)
|
|
273
|
+
its.nodes[n]["typesGH"] = (g_attrs, h_attrs)
|
|
274
|
+
|
|
275
|
+
its = ITSConstruction.add_edges_to_ITS(its, G, H, ignore_aromaticity)
|
|
276
|
+
|
|
277
|
+
return its
|
|
278
|
+
|
|
279
|
+
def typesGH(self) -> Dict[str, Dict[str, Tuple[Any, Any]]]:
|
|
280
|
+
"""
|
|
281
|
+
Returns the types and default values for selected node and edge attributes, useful for
|
|
282
|
+
interpreting the 'typesGH' annotation on ITS graphs.
|
|
283
|
+
|
|
284
|
+
:returns: Dictionary with node and edge attribute types and defaults, e.g.
|
|
285
|
+
{"node": {attr: (type, 0)}, "edge": {attr: (type, 0)}}
|
|
286
|
+
:rtype: dict[str, dict[str, tuple[type, Any]]]
|
|
287
|
+
"""
|
|
288
|
+
node_prop_types: Dict[str, Any] = {
|
|
289
|
+
"element": str,
|
|
290
|
+
"charge": int,
|
|
291
|
+
"atom_map": int,
|
|
292
|
+
"hcount": int,
|
|
293
|
+
"in_ring": int,
|
|
294
|
+
"radical": int,
|
|
295
|
+
"isomer": str,
|
|
296
|
+
"partial_charge": float,
|
|
297
|
+
"hybridization": str,
|
|
298
|
+
"implicit_hcount": int,
|
|
299
|
+
"neighbors": list,
|
|
300
|
+
"aromatic": int,
|
|
301
|
+
}
|
|
302
|
+
edge_prop_types: Dict[str, Any] = {
|
|
303
|
+
"order": float,
|
|
304
|
+
"ez_isomer": str,
|
|
305
|
+
"bond_type": str,
|
|
306
|
+
"conjugated": int,
|
|
307
|
+
"in_ring": int,
|
|
308
|
+
}
|
|
309
|
+
sel_nodes = {
|
|
310
|
+
a: node_prop_types.get(a, int) for a in getattr(self, "node_attrs", [])
|
|
311
|
+
}
|
|
312
|
+
sel_edges = {
|
|
313
|
+
a: edge_prop_types.get(a, int) for a in getattr(self, "edge_attrs", [])
|
|
314
|
+
}
|
|
315
|
+
node_defaults = {k: (tp, 0) for k, tp in sel_nodes.items()}
|
|
316
|
+
edge_defaults = {k: (tp, 0) for k, tp in sel_edges.items()}
|
|
317
|
+
return {"node": node_defaults, "edge": edge_defaults}
|
|
@@ -66,14 +66,13 @@ class ITSExpand:
|
|
|
66
66
|
# Convert reaction SMILES to graph representation of reactants and products
|
|
67
67
|
r, p = rsmi_to_graph(rsmi)
|
|
68
68
|
|
|
69
|
-
# Construct the
|
|
69
|
+
# Construct the Imaginary Transition State (ITS) graph from reactants and products
|
|
70
70
|
rc = ITSConstruction().ITSGraph(r, p)
|
|
71
71
|
# rc = get_rc(rc)
|
|
72
72
|
|
|
73
73
|
# Convert a SMILES string to graph; parameters are indicative and function should exist
|
|
74
74
|
G = smiles_to_graph(
|
|
75
75
|
smi,
|
|
76
|
-
light_weight=light_weight,
|
|
77
76
|
sanitize=True,
|
|
78
77
|
drop_non_aam=False,
|
|
79
78
|
use_index_as_atom_map=False,
|
|
@@ -11,7 +11,7 @@ from synkit.Graph.ITS.its_construction import ITSConstruction
|
|
|
11
11
|
from synkit.IO.nx_to_gml import NXToGML
|
|
12
12
|
from synkit.IO.gml_to_nx import GMLToNX
|
|
13
13
|
from synkit.Graph.ITS.its_decompose import get_rc, its_decompose
|
|
14
|
-
from synkit.Graph.Hyrogen._misc import implicit_hydrogen
|
|
14
|
+
from synkit.Graph.Hyrogen._misc import implicit_hydrogen, h_to_explicit
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
logger = setup_logging()
|
|
@@ -20,9 +20,17 @@ logger = setup_logging()
|
|
|
20
20
|
def smiles_to_graph(
|
|
21
21
|
smiles: str,
|
|
22
22
|
drop_non_aam: bool = False,
|
|
23
|
-
light_weight: bool = True,
|
|
24
23
|
sanitize: bool = True,
|
|
25
24
|
use_index_as_atom_map: bool = False,
|
|
25
|
+
node_attrs: Optional[List[str]] = [
|
|
26
|
+
"element",
|
|
27
|
+
"aromatic",
|
|
28
|
+
"hcount",
|
|
29
|
+
"charge",
|
|
30
|
+
"neighbors",
|
|
31
|
+
"atom_map",
|
|
32
|
+
],
|
|
33
|
+
edge_attrs: Optional[List[str]] = ["order"],
|
|
26
34
|
) -> Optional[nx.Graph]:
|
|
27
35
|
"""
|
|
28
36
|
Helper function to convert a SMILES string to a NetworkX graph.
|
|
@@ -59,9 +67,9 @@ def smiles_to_graph(
|
|
|
59
67
|
return None
|
|
60
68
|
|
|
61
69
|
# Convert molecule to graph
|
|
62
|
-
graph_converter = MolToGraph()
|
|
63
|
-
graph = graph_converter.
|
|
64
|
-
mol, drop_non_aam,
|
|
70
|
+
graph_converter = MolToGraph(node_attrs=node_attrs, edge_attrs=edge_attrs)
|
|
71
|
+
graph = graph_converter.transform(
|
|
72
|
+
mol, drop_non_aam=drop_non_aam, use_index_as_atom_map=use_index_as_atom_map
|
|
65
73
|
)
|
|
66
74
|
if graph is None:
|
|
67
75
|
logger.warning(f"Failed to convert molecule to graph for SMILES: {smiles}")
|
|
@@ -78,9 +86,18 @@ def smiles_to_graph(
|
|
|
78
86
|
def rsmi_to_graph(
|
|
79
87
|
rsmi: str,
|
|
80
88
|
drop_non_aam: bool = True,
|
|
81
|
-
light_weight: bool = True,
|
|
82
89
|
sanitize: bool = True,
|
|
83
90
|
use_index_as_atom_map: bool = True,
|
|
91
|
+
node_attrs: Optional[List[str]] = [
|
|
92
|
+
"element",
|
|
93
|
+
"aromatic",
|
|
94
|
+
"hcount",
|
|
95
|
+
"charge",
|
|
96
|
+
"neighbors",
|
|
97
|
+
"atom_map",
|
|
98
|
+
],
|
|
99
|
+
edge_attrs: Optional[List[str]] = ["order"],
|
|
100
|
+
explicit_hydrogen: bool = False,
|
|
84
101
|
) -> Tuple[Optional[nx.Graph], Optional[nx.Graph]]:
|
|
85
102
|
"""
|
|
86
103
|
Convert a reaction SMILES (RSMI) into reactant and product graphs.
|
|
@@ -103,13 +120,22 @@ def rsmi_to_graph(
|
|
|
103
120
|
r_graph = smiles_to_graph(
|
|
104
121
|
reactants_smiles,
|
|
105
122
|
drop_non_aam,
|
|
106
|
-
light_weight,
|
|
107
123
|
sanitize,
|
|
108
124
|
use_index_as_atom_map,
|
|
125
|
+
node_attrs,
|
|
126
|
+
edge_attrs,
|
|
109
127
|
)
|
|
110
128
|
p_graph = smiles_to_graph(
|
|
111
|
-
products_smiles,
|
|
129
|
+
products_smiles,
|
|
130
|
+
drop_non_aam,
|
|
131
|
+
sanitize,
|
|
132
|
+
use_index_as_atom_map,
|
|
133
|
+
node_attrs,
|
|
134
|
+
edge_attrs,
|
|
112
135
|
)
|
|
136
|
+
if explicit_hydrogen:
|
|
137
|
+
r_graph = h_to_explicit(r_graph)
|
|
138
|
+
p_graph = h_to_explicit(p_graph)
|
|
113
139
|
return (r_graph, p_graph)
|
|
114
140
|
except ValueError:
|
|
115
141
|
logger.error(f"Invalid RSMI format: {rsmi}")
|
|
@@ -231,7 +257,7 @@ def smart_to_gml(
|
|
|
231
257
|
if useSmiles is False:
|
|
232
258
|
smart = rsmarts_to_rsmi(smart)
|
|
233
259
|
r, p = rsmi_to_graph(smart, sanitize=sanitize)
|
|
234
|
-
its = ITSConstruction.ITSGraph(r, p)
|
|
260
|
+
its = ITSConstruction().ITSGraph(r, p)
|
|
235
261
|
if core:
|
|
236
262
|
its = get_rc(its)
|
|
237
263
|
r, p = its_decompose(its)
|
|
@@ -332,10 +358,19 @@ def gml_to_its(gml: str) -> nx.Graph:
|
|
|
332
358
|
def rsmi_to_its(
|
|
333
359
|
rsmi: str,
|
|
334
360
|
drop_non_aam: bool = True,
|
|
335
|
-
light_weight: bool = True,
|
|
336
361
|
sanitize: bool = True,
|
|
337
362
|
use_index_as_atom_map: bool = True,
|
|
338
363
|
core: bool = False,
|
|
364
|
+
node_attrs: Optional[List[str]] = [
|
|
365
|
+
"element",
|
|
366
|
+
"aromatic",
|
|
367
|
+
"hcount",
|
|
368
|
+
"charge",
|
|
369
|
+
"neighbors",
|
|
370
|
+
"atom_map",
|
|
371
|
+
],
|
|
372
|
+
edge_attrs: Optional[List[str]] = ["order"],
|
|
373
|
+
explicit_hydrogen: bool = False,
|
|
339
374
|
) -> nx.Graph:
|
|
340
375
|
"""
|
|
341
376
|
Convert a reaction SMILES (rSMI) string to an ITS graph representation.
|
|
@@ -357,9 +392,9 @@ def rsmi_to_its(
|
|
|
357
392
|
:raises Exception: If conversion fails.
|
|
358
393
|
"""
|
|
359
394
|
r, p = rsmi_to_graph(
|
|
360
|
-
rsmi, drop_non_aam,
|
|
395
|
+
rsmi, drop_non_aam, sanitize, use_index_as_atom_map, node_attrs, edge_attrs, explicit_hydrogen
|
|
361
396
|
)
|
|
362
|
-
its = ITSConstruction.ITSGraph(r, p)
|
|
397
|
+
its = ITSConstruction().ITSGraph(r, p)
|
|
363
398
|
if core:
|
|
364
399
|
its = get_rc(its)
|
|
365
400
|
return its
|