Building Blocks

building block related functions

source

smile_to_synthon

 smile_to_synthon (smile:str, keep_pg:bool=False)
Type Default Details
smile str smiles string to convert
keep_pg bool False if True, results include synthons with un-removed protecting groups
Returns Tuple[list[str], list[list[str]]] Returns paired list of SMILES and reaction classes
assert smile_to_synthon('COC(=O)c1ccnc(CNC(=O)NCC2(C)CC(N=C=O)CC(C)(C)C2)c1')[0] == [
    'CC1(C)CC(N[CH:10]=O)CC(C)(CNC(=O)NCc2cc(C(=O)O)ccn2)C1',
    'CC1(C)CC(N[CH:10]=O)CC(C)(CNC(=O)NCc2cc([CH:10]=O)ccn2)C1']

source

get_synthon_marks

 get_synthon_marks (smile:str)

extracts reaction tag marks from synthon

ie 'CC1(C)CC(N[CH:10]=O)CC(C)(CNC(=O)NCc2cc([CH:10]=O)ccn2)C1' -> ['C:10']

Type Details
smile str input synthon smiles string
Returns list[str] list of marks
assert get_synthon_marks('CC1(C)CC(N[CH:10]=O)CC(C)(CNC(=O)NCc2cc([CH:10]=O)ccn2)C1') == ['C:10']

source

remove_reconstruction_atoms

 remove_reconstruction_atoms (smile:str)

removes dummy atoms for fusion

Type Details
smile str synthon reconstruction string
Returns str synthon smiles string

source

add_reconstruction_atoms

 add_reconstruction_atoms (smile:str)

augments synthon annotations (ie c:10) with dummy atoms for fusion

Type Details
smile str synthon smiles string
Returns str synthon reconstruction string
assert add_reconstruction_atoms('CC1(C)CC(N[CH:10]=O)CC(C)(CNC(=O)NCc2cc([CH:10]=O)ccn2)C1'
                        ) == 'CC1(C)CC(N[C:10](=O)[V])CC(C)(CNC(=O)NCc2cc([C:10](=O)[V])ccn2)C1'

assert remove_reconstruction_atoms('CC1(C)CC(N[C:10](=O)[V])CC(C)(CNC(=O)NCc2cc([C:10](=O)[V])ccn2)C1'
                           ) == 'CC1(C)CC(N[CH:10]=O)CC(C)(CNC(=O)NCc2cc([CH:10]=O)ccn2)C1'

assert remove_reconstruction_atoms(add_reconstruction_atoms(
    'CC1(C)CC(N[CH:10]=O)CC(C)(CNC(=O)NCc2cc([CH:10]=O)ccn2)C1'
    )) == 'CC1(C)CC(N[CH:10]=O)CC(C)(CNC(=O)NCc2cc([CH:10]=O)ccn2)C1'

source

Synthon

 Synthon (synthon_smile:str, reaction_tags:list[str]=None,
          parents:Optional[list[Molecule]]=None, data:Optional[dict]=None)

Initialize self. See help(type(self)) for accurate signature.

Type Default Details
synthon_smile str synthon smiles string
reaction_tags list[str] None reaction class tags
parents Optional[list[Molecule]] None parent molecule
data Optional[dict] None data

source

molecule_to_synthon

 molecule_to_synthon (molecule:chem_templates.chem.Molecule)

Converts molecule into a list of corresponding synthons

Type Details
molecule Molecule input Molecule
Returns listSynthon output list of synthons
molecule = Molecule('COC(=O)c1ccnc(CNC(=O)NCC2(C)CC(N=C=O)CC(C)(C)C2)c1')
synthons = molecule_to_synthon(molecule)
assert len(synthons)==2
assert synthons[0].data['parents'] == [molecule]
assert synthons[0].data['parents'] == synthons[1].data['parents']
assert synthons[0].recon_smile == 'CC1(C)CC(N[C:10](=O)[V])CC(C)(CNC(=O)NCc2cc(C(=O)O)ccn2)C1'

source

FusionReaction

 FusionReaction (name:str, rxn_smarts:str)

Initialize self. See help(type(self)) for accurate signature.

Type Details
name str reaction name
rxn_smarts str reaction smarts

source

ReactionGroup

 ReactionGroup (name:str, reactions:list[FusionReaction])

holds reactions beloning to the same type of transform

Type Details
name str group name
reactions listFusionReaction list of reactions in group

source

ReactionUniverse

 ReactionUniverse (name:str, reaction_groups:list[ReactionGroup])

Initialize self. See help(type(self)) for accurate signature.

Type Details
name str rxn universe name
reaction_groups listReactionGroup list of reaction groups
rxn_universe = ReactionUniverse('all_reactions', REACTION_GROUPS)
molecule = Molecule('COC(=O)c1ccnc(CNC(=O)NCC2(C)CC(N=C=O)CC(C)(C)C2)c1')
synthons = molecule_to_synthon(molecule)
assert len(rxn_universe.get_matching_reactions(synthons[0])) == 9