Chem
Chemical utilities for reactions, molecules, fingerprints, clustering, and related helpers.
Reaction
-
class synkit.Chem.Reaction.canon_rsmi.CanonRSMI(backend: str = 'wl', wl_iterations: int = 3, morgan_radius: int = 3, node_attrs: List[str] = ('element', 'aromatic', 'charge', 'hcount'))[source]
Bases: object
-
property canonical_hash: str | None
-
property canonical_product_graph: Graph | None
-
property canonical_reactant_graph: Graph | None
-
property canonical_rsmi: str | None
-
canonicalise(rsmi: str) → CanonRSMI[source]
-
expand_aam(rsmi: str) → str[source]
-
static get_aam_pairwise_indices(G: Graph, H: Graph, aam_key: str = 'atom_map') → List[Tuple[int, int]][source]
-
help() → None[source]
-
property mapping_pairs: List[Tuple[int, int]] | None
-
property raw_product_graph: Graph | None
-
property raw_reactant_graph: Graph | None
-
property raw_rsmi: str | None
-
static remap_graph(G: Graph, node_map: List[int] | List[Tuple[int, int]]) → Graph[source]
-
static sync_atom_map_with_index(G: Graph) → None[source]
-
class synkit.Chem.Reaction.standardize.Standardize[source]
Bases: object
-
static categorize_reactions(reactions: List[str], target_reaction: str) → Tuple[List[str], List[str]][source]
-
static filter_valid_molecules(smiles_list: List[str]) → List[Mol][source]
-
fit(rsmi: str, remove_aam: bool = True, ignore_stereo: bool = True, remove_invalid: bool = True) → str | None[source]
-
static remove_atom_mapping(reaction_smiles: str, symbol: str = '>>') → str[source]
-
static standardize_rsmi(rsmi: str, stereo: bool = False, remove_invalid: bool = True) → str | None[source]
-
class synkit.Chem.Reaction.aam_validator.AAMValidator(strip_unbalanced_maps: bool = True)[source]
Bases: object
-
static check_equivariant_graph(its_graphs: List[Graph]) → Tuple[List[Tuple[int, int]], int][source]
-
check_pair(cls, mapping: Dict[str, str], mapped_col: str, ground_truth_col: str, check_method: str = 'RC', ignore_aromaticity: bool = False, ignore_tautomers: bool = True, strip_unbalanced_maps: bool | None = None) → bool[source]
-
smiles_check(cls, mapped_smile: str, ground_truth: str, check_method: str = 'RC', ignore_aromaticity: bool = False, strip_unbalanced_maps: bool | None = None) → bool[source]
-
smiles_check_tautomer(cls, mapped_smile: str, ground_truth: str, check_method: str = 'RC', ignore_aromaticity: bool = False, strip_unbalanced_maps: bool | None = None) → bool | None[source]
-
validate_smiles(cls, data: DataFrame | List[Dict[str, str]], ground_truth_col: str = 'ground_truth', mapped_cols: List[str] = ['rxn_mapper', 'graphormer', 'local_mapper'], check_method: str = 'RC', ignore_aromaticity: bool = False, n_jobs: int = 1, verbose: int = 0, ignore_tautomers: bool = True, strip_unbalanced_maps: bool | None = None) → List[Dict[str, str | float | List[bool]]][source]
-
class synkit.Chem.Reaction.balance_check.BalanceReactionCheck(n_jobs: int = 4, verbose: int = 0)[source]
Bases: object
-
static dict_balance_check(reaction_dict: Dict[str, str], rsmi_column: str) → Dict[str, Any][source]
-
dicts_balance_check(input_data: str | List[str | Dict[str, str]], rsmi_column: str = 'reactions') → Tuple[List[Dict[str, Any]], List[Dict[str, Any]]][source]
-
static get_combined_molecular_formula(smiles: str) → str[source]
-
static parse_input(input_data: str | List[str | Dict[str, str]], rsmi_column: str = 'reactions') → List[Dict[str, str]][source]
-
static parse_reaction(reaction_smiles: str) → Tuple[str, str][source]
-
static rsmi_balance_check(reaction_smiles: str) → bool[source]
-
class synkit.Chem.Reaction.cleaning.Cleaning[source]
Bases: object
-
static clean_smiles(smiles_list: List[str]) → List[str][source]
-
static remove_duplicates(smiles_list: List[str]) → List[str][source]
-
class synkit.Chem.Reaction.deionize.Deionize[source]
Bases: object
-
static ammonia_hydroxide_standardize(reaction_smiles: str) → str[source]
-
classmethod apply_uncharge_smiles_to_reactions(reactions: List[Dict[str, Any]], uncharge_smiles_func: Callable[[str], str], n_jobs: int = 4) → List[Dict[str, Any]][source]
-
static random_pair_ions(charges: List[int], smiles: List[str]) → Tuple[List[List[str]], List[List[int]]][source]
-
static uncharge_anion(smiles: str, charges: int = -1) → str[source]
-
static uncharge_cation(smiles: str, charges: int = 1) → str[source]
-
static uncharge_smiles(charge_smiles: str) → str[source]
-
class synkit.Chem.Reaction.fix_aam.FixAAM[source]
Bases: object
-
static fix_aam_rsmi(rsmi: str) → str[source]
-
static fix_aam_smiles(smiles: str) → str[source]
-
static increment_atom_mapping(mol: Mol) → Mol[source]
-
class synkit.Chem.Reaction.neutralize.Neutralize[source]
Bases: object
-
static calculate_charge(smiles: str) → int[source]
-
static calculate_charge_dict(reaction: Dict[str, Any], reaction_column: str) → Dict[str, str | int][source]
-
static fix_negative_charge(reaction_dict: Dict[str, Any], charges_column: str = 'total_charge_in_products', id_column: str = 'R-id', reaction_column: str = 'reactions') → Dict[str, Any][source]
-
static fix_positive_charge(reaction_dict: Dict[str, Any], charges_column: str = 'total_charge_in_products', id_column: str = 'R-id', reaction_column: str = 'reactions') → Dict[str, Any][source]
-
static fix_unbalanced_charged(reaction_dict: Dict[str, Any], reaction_column: str) → Dict[str, Any][source]
-
classmethod parallel_fix_unbalanced_charge(reaction_dicts: List[Dict[str, Any]], reaction_column: str, n_jobs: int = 4) → List[Dict[str, Any]][source]
-
static parse_reaction(reaction_smiles: str) → Tuple[str | None, str | None][source]
-
class synkit.Chem.Reaction.radical_wildcard.RadicalWildcardAdder(start_map: int | None = None)[source]
Bases: object
-
transform(rxn_smiles: str) → str[source]
-
synkit.Chem.Reaction.radical_wildcard.clean_wc(rsmi: str, invert: bool = False, max_frag: bool = False, wild_card: bool = True) → str[source]
-
class synkit.Chem.Reaction.tautomerize.Tautomerize[source]
Bases: object
-
static fix_dict(data: Dict[str, str], reaction_column: str) → Dict[str, str][source]
-
static fix_dicts(data: List[Dict[str, str]], reaction_column: str, n_jobs: int = 4, verbose: int = 0) → List[Dict[str, str]][source]
-
static fix_smiles(smiles: str) → str[source]
-
static standardize_enol(smiles: str, atom_indices: List[int] | None = None) → str[source]
-
static standardize_hemiketal(smiles: str, atom_indices: List[int]) → str[source]
Atom-to-atom mapping
The mapper is split into a public chemistry front end, the WL/SLAP matching
engine, and optional exact refinement tools. Most applications should start
with synkit.Chem.Reaction.Mapper.AAMapper; the lower-level modules
are useful for inspecting mappings, resolving symmetric reaction centres, or
obtaining an optimality certificate. The exact helpers are available from
synkit.Chem.Reaction.Mapper.exact.
-
class synkit.Chem.Reaction.Mapper.chem.aam.AAMapper(binary=True, max_lap_fingerprints=10000, cache_label_blocks=False, deterministic_labels=False)[source]
Bases: GraphMatcher
-
get_maps(lgp, break_sym_targets=None, interactive=False, base=None)[source]
-
map_smiles(rxn_smiles, add_Hs=True, break_sym='heavy', interactive=False, unique=True, certify=False, electron_balance=False, enumerate_exact=False, hcount_weight=0.0, hcount_mode='always', repair_depth=0, repair_cap=128, repair_slack=0.0, repair_min_cd=4.0, repair_final=False)[source]
-
synkit.Chem.Reaction.Mapper.chem.its.dedup_mapped_rxns(results, smiles_key='smiles')[source]
-
synkit.Chem.Reaction.Mapper.chem.its.electron_balance_imbalances(its)[source]
-
synkit.Chem.Reaction.Mapper.chem.its.electron_balance_status(its, tol=1e-09)[source]
-
synkit.Chem.Reaction.Mapper.chem.its.is_electron_balanced(its, tol=1e-09)[source]
-
synkit.Chem.Reaction.Mapper.chem.its.its_canonical_hash(mapped_rxn_smiles)[source]
-
synkit.Chem.Reaction.Mapper.chem.its.mapped_rxn_is_electron_balanced(mapped_rxn_smiles)[source]
-
synkit.Chem.Reaction.Mapper.chem.its.reaction_center_atom_maps(mapped_rxn_smiles, tol=1e-09)[source]
-
synkit.Chem.Reaction.Mapper.chem.smiles.balance_elements(mol1, mol2)[source]
-
synkit.Chem.Reaction.Mapper.chem.smiles.canonicalize_rxn_smiles(rxn_smiles)[source]
-
synkit.Chem.Reaction.Mapper.chem.smiles.count_elements_by_atomic_num(mol)[source]
-
synkit.Chem.Reaction.Mapper.chem.smiles.expand_reaction_center_hydrogens(rxn_smiles, map_nums_pair, selected_maps)[source]
-
synkit.Chem.Reaction.Mapper.chem.smiles.get_labeled_graph_from_mol(mol)[source]
-
synkit.Chem.Reaction.Mapper.chem.smiles.get_numbered_rxn_smiles(rxn_smiles, map_nums_pair, explicit_hs=False, explicit_h_atoms_pair=None, explicit_h_counts_pair=None, map_selected_hs=True, all_hs_explicit=None)[source]
-
synkit.Chem.Reaction.Mapper.chem.smiles.reaction_center_atom_maps_from_signature(signature)[source]
-
synkit.Chem.Reaction.Mapper.chem.smiles.reaction_center_signature_from_mapped_smiles(mapped_rxn_smiles)[source]
-
synkit.Chem.Reaction.Mapper.chem.smiles.remap_reaction_center_hydrogens(rxn_smiles, map_nums_pair, selected_maps, binary=True)[source]
-
synkit.Chem.Reaction.Mapper.chem.smiles.selected_atom_indices_from_maps(map_nums_pair, selected_maps)[source]
-
synkit.Chem.Reaction.Mapper.chem.smiles.selected_hydrogen_counts_from_hcount_deltas(rxn_smiles, map_nums_pair, selected_maps)[source]
-
synkit.Chem.Reaction.Mapper.chem.smiles.smiles2elg(rxn_smiles, add_Hs=True, binarize=True, weight=1000)[source]
-
synkit.Chem.Reaction.Mapper.chem.smiles.smiles2lgp(rxn_smiles, add_Hs=True)[source]
-
class synkit.Chem.Reaction.Mapper.slap.sequential.GraphMatcher(binary=False, max_lap_fingerprints=10000, cache_label_blocks=False, deterministic_labels=False)[source]
Bases: object
-
get_maps(lgp, break_sym_targets=None, interactive=False, base=None)[source]
-
reset()[source]
Molecule
Bases: object
-
class synkit.Chem.Molecule.descriptors.PerMolDescriptors(gasteiger: List[float], estate: List[float], crippen_logp: List[float], crippen_mr: List[float])[source]
Bases: object
-
classmethod compute(mol: Mol | _MolLike, sanitize: bool = True, normalize: str | None = None) → PerMolDescriptors[source]
-
crippen_logp: List[float]
-
crippen_mr: List[float]
-
estate: List[float]
-
classmethod from_smiles(smiles: str, sanitize: bool = True, normalize: str | None = None) → PerMolDescriptors[source]
-
gasteiger: List[float]
-
property num_atoms: int
-
to_dict() → Dict[str, List[float]][source]
-
class synkit.Chem.Molecule.descriptors.PerMolDescriptorsBuilder(mol: Mol | _MolLike, sanitize: bool = True)[source]
Bases: object
-
build() → PerMolDescriptorsBuilder[source]
-
compute_crippen() → PerMolDescriptorsBuilder[source]
-
compute_estate() → PerMolDescriptorsBuilder[source]
-
compute_gasteiger() → PerMolDescriptorsBuilder[source]
-
property descriptor: PerMolDescriptors
-
normalize(method: str | None) → PerMolDescriptorsBuilder[source]
-
synkit.Chem.Molecule.descriptors.compute_gasteiger_inplace(mol: Mol | Any) → None[source]
-
class synkit.Chem.Molecule.formula.Formula(n_jobs: int = 1, verbose: int = 0)[source]
Bases: object
-
decompose(smiles: str) → Dict[str, int][source]
-
hill_formula(smiles: str) → str[source]
-
mol_weight(smiles: str) → float | None[source]
-
process_list(smiles_list: List[str], what: str = 'hill') → List[str | Dict[str, int] | float | None][source]
-
process_list_dict(records: List[Dict[str, Any]] | DataFrame, smiles_key: str = 'smiles', out_key: str = 'hill', what: str = 'hill', copy: bool = True) → List[Dict[str, Any]][source]
-
class synkit.Chem.Molecule.graph_annotator.GraphAnnotator(G: Graph, in_place: bool = True, max_distance: int = 99)[source]
Bases: object
-
DEFAULT_MAX_DISTANCE = 99
-
annotate() → GraphAnnotator[source]
-
get_node(n: Any) → Dict[str, Any][source]
-
get_node_attr(n: Any, attr: str, default: Any = None) → Any[source]
-
property graph: Graph
-
classmethod help() → str[source]
-
class synkit.Chem.Molecule.standardize.MolStandardizer(mol: Mol, sanitize: bool = True)[source]
Bases: object
-
add_hs_and_clear_radicals(removeH: bool = True) → MolStandardizer[source]
-
canonicalize_tautomer() → MolStandardizer[source]
-
clear_stereochemistry() → MolStandardizer[source]
-
classmethod from_smiles(smiles: str, sanitize: bool = True) → MolStandardizer[source]
-
classmethod help() → str[source]
-
keep_largest_fragment() → MolStandardizer[source]
-
property mol: Mol | None
-
normalize() → MolStandardizer[source]
-
remove_explicit_hs() → MolStandardizer[source]
-
remove_isotopes() → MolStandardizer[source]
-
remove_salts(salt_remover: SaltRemover | None = None) → MolStandardizer[source]
-
classmethod standardize_smiles(smiles: str, *, keep_largest_fragment: bool = True) → str | None[source]
-
summarize_last_error() → str | None[source]
-
to_smiles(canonical: bool = True) → str | None[source]
-
uncharge() → MolStandardizer[source]
-
synkit.Chem.Molecule.standardize.canonicalize_tautomer(mol: Mol) → Mol[source]
-
synkit.Chem.Molecule.standardize.clear_stereochemistry(mol: Mol) → Mol[source]
-
synkit.Chem.Molecule.standardize.fix_radical_rsmi(rsmi: str, removeH: bool = True) → str[source]
-
synkit.Chem.Molecule.standardize.fragments_remover(mol: Mol) → Mol | None[source]
-
synkit.Chem.Molecule.standardize.normalize_molecule(mol: Mol) → Mol[source]
-
synkit.Chem.Molecule.standardize.remove_explicit_hydrogens(mol: Mol) → Mol[source]
-
synkit.Chem.Molecule.standardize.remove_isotopes(mol: Mol) → Mol[source]
-
synkit.Chem.Molecule.standardize.remove_radicals_and_add_hydrogens(mol: Mol, removeH: bool = True) → Mol | None[source]
-
synkit.Chem.Molecule.standardize.salts_remover(mol: Mol, remover: SaltRemover | None = None) → Mol[source]
-
synkit.Chem.Molecule.standardize.sanitize_and_canonicalize_smiles(smiles: str) → str | None[source]
-
synkit.Chem.Molecule.standardize.uncharge_molecule(mol: Mol) → Mol[source]
-
class synkit.Chem.Molecule.valence.ValenceResolver[source]
Bases: object
-
static explicit(atom: Atom | _AtomLike) → int[source]
-
static implicit(atom: Atom | _AtomLike) → int[source]
-
static total(atom: Atom | _AtomLike) → int[source]
Fingerprint
-
class synkit.Chem.Fingerprint.fp_calculator.FPCalculator(n_jobs: int = 1, verbose: int = 0)[source]
Bases: object
-
VALID_FP_TYPES: List[str] = ['drfp', 'avalon', 'maccs', 'torsion', 'pharm2D', 'ecfp2', 'ecfp4', 'ecfp6', 'fcfp2', 'fcfp4', 'fcfp6', 'rdk5', 'rdk6', 'rdk7', 'ap']
-
static dict_process(data_dict: Dict[str, Any], rsmi_key: str, symbol: str = '>>', fp_type: str = 'ecfp4', absolute: bool = True) → Dict[str, Any][source]
-
fps: TransformationFP = <TransformationFP>
-
help() → None[source]
-
parallel_process(data_dicts: List[Dict[str, Any]], rsmi_key: str, symbol: str = '>>', fp_type: str = 'ecfp4', absolute: bool = True) → List[Dict[str, Any]][source]
-
class synkit.Chem.Fingerprint.smiles_featurizer.SmilesFeaturizer[source]
Bases: object
-
classmethod featurize_smiles(smiles: str, fingerprint_type: str, convert_to_array: bool = True, **kwargs: Any) → Any[source]
-
static get_avalon_fp(mol: Mol, nBits: int = 1024) → Any[source]
-
static get_ecfp(mol: Mol, radius: int, nBits: int = 2048, useFeatures: bool = False) → Any[source]
-
static get_maccs_keys(mol: Mol) → Any[source]
-
static get_rdk_fp(mol: Mol, maxPath: int, fpSize: int = 2048, nBitsPerHash: int = 2) → Any[source]
-
help() → None[source]
-
static mol_to_ap(mol: Mol) → Any[source]
-
static mol_to_pharm2d(mol: Mol) → Any[source]
-
static mol_to_torsion(mol: Mol) → Any[source]
-
static smiles_to_mol(smiles: str) → Mol[source]
-
class synkit.Chem.Fingerprint.transformation_fp.TransformationFP[source]
Bases: object
-
static convert_arr2vec(arr: ndarray) → ExplicitBitVect[source]
-
fit(reaction_smiles: str, symbols: str, fp_type: str, abs: bool, return_array: bool = True, **kwargs: Any) → ndarray | ExplicitBitVect[source]
-
help() → None[source]