IO#

Input/output helpers and format conversion utilities.

Core conversion#

synkit.IO.conversion.ef_smirks_to_epd(ef_smirks: str, orbital_class: str | None = None, strict_bond_lookup: bool = True) dict[str, Any][source]#
synkit.IO.conversion.epd_to_ef_smirks(complete_aam: str, epd: list[list[Any]]) str[source]#
synkit.IO.chem_converter.detect_its_format(graph: Graph) Literal['typesGH', 'tuple'][source]#
synkit.IO.chem_converter.dfs_to_smiles(dfs: str, keep_map: bool = True) str[source]#
synkit.IO.chem_converter.gml_to_its(gml: str) Graph[source]#
synkit.IO.chem_converter.gml_to_smart(gml: str, sanitize: bool = True, explicit_hydrogen: bool = False, useSmiles: bool = True) str[source]#
synkit.IO.chem_converter.graph_to_rsmi(r: Graph, p: Graph, its: Graph | None = None, sanitize: bool = True, explicit_hydrogen: bool = False) str | None[source]#
synkit.IO.chem_converter.graph_to_smi(graph: Graph, sanitize: bool = True, preserve_atom_maps: Sequence[int] | None = None) str | None[source]#
synkit.IO.chem_converter.its_to_gml(its: Graph, core: bool = True, rule_name: str = 'rule', reindex: bool = True, explicit_hydrogen: bool = False, format: Literal['typesGH', 'tuple'] = 'typesGH') str[source]#
synkit.IO.chem_converter.its_to_rsmi(its: Graph, sanitize: bool = True, explicit_hydrogen: bool = False, clean_wildcards: bool = False, format: Literal['typesGH', 'tuple'] = 'typesGH') str[source]#
synkit.IO.chem_converter.normalize_dfs_for_compare(dfs: str) str[source]#
synkit.IO.chem_converter.rsmarts_to_rsmi(rsmarts: str) str[source]#
synkit.IO.chem_converter.rsmi_to_graph(rsmi: str, drop_non_aam: bool = True, sanitize: bool = True, use_index_as_atom_map: bool = True, node_attrs: Sequence[str] | None = None, edge_attrs: Sequence[str] | None = None) tuple[Graph | None, Graph | None][source]#
synkit.IO.chem_converter.rsmi_to_its(rsmi: str, drop_non_aam: bool = True, sanitize: bool = True, use_index_as_atom_map: bool = True, core: bool = False, node_attrs: Sequence[str] | None = None, edge_attrs: Sequence[str] | None = None, explicit_hydrogen: bool = False, format: Literal['typesGH', 'tuple'] = 'typesGH') Graph[source]#
synkit.IO.chem_converter.rsmi_to_rsmarts(rsmi: str) str[source]#
synkit.IO.chem_converter.smart_to_gml(smart: str, core: bool = True, sanitize: bool = True, rule_name: str = 'rule', reindex: bool = False, explicit_hydrogen: bool = False, useSmiles: bool = True) str[source]#
synkit.IO.chem_converter.smiles_to_dfs(smiles: str) str[source]#
synkit.IO.chem_converter.smiles_to_graph(smiles: str, drop_non_aam: bool = False, sanitize: bool = True, use_index_as_atom_map: bool = False, node_attrs: Sequence[str] | None = None, edge_attrs: Sequence[str] | None = None) Graph | None[source]#
class synkit.IO.mol_to_graph.MolToGraph(node_attrs: List[str] | None = None, edge_attrs: List[str] | None = None, *, attr_profile: str = 'minimal', with_topology: bool = False)[source]#

Bases: object

PAULING_EN: Dict[str, float] = {'B': 2.04, 'Br': 2.96, 'C': 2.55, 'Cl': 3.16, 'F': 3.98, 'H': 2.2, 'I': 2.66, 'N': 3.04, 'O': 3.44, 'P': 2.19, 'S': 2.58, 'Se': 2.55}#
SUPPORTED_PROFILES = ('minimal', 'full')#
static add_partial_charges(mol: Mol) None[source]#
classmethod estimate_available_lone_pairs(atom: Atom) int[source]#
classmethod estimate_lone_pairs(atom: Atom) int[source]#
classmethod estimate_oxidation_states(mol: Mol, *, kek_mol: Mol | None = None, prefer_kekule: bool = True, en_tie_threshold: float = 0.05) Dict[int, float][source]#
static get_bond_stereochemistry(bond: Bond) str[source]#
static get_stereochemistry(atom: Atom) str[source]#
property graph: Graph#
static has_atom_mapping(mol: Mol) bool[source]#
classmethod help() str[source]#
classmethod mol_to_graph(mol: Mol, drop_non_aam: bool = False, light_weight: bool = False, use_index_as_atom_map: bool = False) Graph[source]#
classmethod oxidation_states_by_atom_map(mol: Mol, *, kek_mol: Mol | None = None, prefer_kekule: bool = True, en_tie_threshold: float = 0.05) Dict[int, Dict[str, Any]][source]#
static random_atom_mapping(mol: Mol) Mol[source]#
classmethod reaction_oxidation_state_delta_from_rsmi(rsmi: str, *, threshold: float = 0.5, prefer_kekule: bool = True, en_tie_threshold: float = 0.05) Dict[int, Dict[str, Any]][source]#
transform(mol: Mol, drop_non_aam: bool = False, use_index_as_atom_map: bool = False) Graph[source]#
transform_store(mol: Mol, drop_non_aam: bool = False, use_index_as_atom_map: bool = False) MolToGraph[source]#
class synkit.IO.graph_to_mol.GraphToMol(node_attributes: Dict[str, str] = {'atom_map': 'atom_map', 'charge': 'charge', 'element': 'element'}, edge_attributes: Dict[str, str] = {'order': 'order'})[source]#

Bases: object

static get_bond_type_from_order(order: float) BondType[source]#
graph_to_mol(graph: Graph, ignore_bond_order: bool = False, sanitize: bool = True, use_h_count: bool = False) Mol[source]#
class synkit.IO.gml_to_nx.GMLToNX(gml_text: str)[source]#

Bases: object

transform() Tuple[Graph, Graph, Graph][source]#
class synkit.IO.nx_to_gml.NXToGML[source]#

Bases: object

static transform(graph_rules: Tuple[Graph, Graph, Graph], rule_name: str = 'Test', reindex: bool = False, attributes: List[str] = ['charge'], explicit_hydrogen: bool = False) str[source]#

Data and debug#

synkit.IO.data_io.collect_data(num_batches: int, temp_dir: str, file_template: str) List[Any][source]#
synkit.IO.data_io.load_compressed(filename: str) ndarray[source]#
synkit.IO.data_io.load_database(pathname: str = './Data/database.json') List[Dict][source]#
synkit.IO.data_io.load_dg(path: str, graph_db: list, rule_db: list)[source]#
synkit.IO.data_io.load_dict_from_json(file_path: str) dict | None[source]#
synkit.IO.data_io.load_from_pickle(filename: str) List[Any][source]#
synkit.IO.data_io.load_from_pickle_generator(file_path: str) Generator[Any, None, None][source]#
synkit.IO.data_io.load_gml_as_text(gml_file_path: str) str | None[source]#
synkit.IO.data_io.load_list_from_file(file_path: str) list[source]#
synkit.IO.data_io.load_model(filename: str) Any[source]#
synkit.IO.data_io.save_compressed(array: ndarray, filename: str) None[source]#
synkit.IO.data_io.save_database(database: List[Dict], pathname: str = './Data/database.json') None[source]#
synkit.IO.data_io.save_dg(dg, path: str) str[source]#
synkit.IO.data_io.save_dict_to_json(data: dict, file_path: str) None[source]#
synkit.IO.data_io.save_list_to_file(data_list: list, file_path: str) None[source]#
synkit.IO.data_io.save_model(model: Any, filename: str) None[source]#
synkit.IO.data_io.save_text_as_gml(gml_text: str, file_path: str) bool[source]#
synkit.IO.data_io.save_to_pickle(data: List[Dict[str, Any]], filename: str) None[source]#
synkit.IO.debug.configure_warnings_and_logs(ignore_warnings: bool = False, disable_rdkit_logs: bool = False) None[source]#
synkit.IO.debug.setup_logging(log_level: str = 'INFO', log_filename: str = None, task_type: str = None) Logger[source]#