Large-scale molecule editing
A collection of functions to ease larger-scale molecule editing, since
it can be difficult to get anywhere with the miniscule alteration functions
defined in the Molecule interface.
- class scine_molassembler.editing.Cleaved
Return type of a cleave operation along a haptic site.
- __init__(*args, **kwargs)
- property component_map
- property first
- property second
- scine_molassembler.editing.add_ligand(a: scine_molassembler.Molecule, ligand: scine_molassembler.Molecule, complexating_atom: int, ligand_binding_atoms: List[int]) scine_molassembler.Molecule
Connect two molecules by connecting multiple atoms from one to a single atom of the other via single bonds.
- Parameters
a – The molecule the ligand is being connected to
ligand – The ligand molecule being bound
complexating_atom – The atom in
ato bind ligand toligand_binding_atoms – Atoms in
ligandto bind tocomplexating_atomto.
- scine_molassembler.editing.cleave(*args, **kwargs)
Overloaded function.
cleave(molecule: scine_molassembler.Molecule, bridge: scine_molassembler.BondIndex) -> Tuple[scine_molassembler.Molecule, scine_molassembler.Molecule]
Cleave a molecule in two along a bridge bond.
Bridge bonds are edges in the graph that whose removal splits the graph into two connected components. Any bonds in a cycle, for instance, are not bridge bonds.
- param molecule
Molecule to cleave
- param bridge
Bond index of bridge bond to cleave.
- return
A pair of molecules
- example
>>> import scine_utilities as utils >>> a = Molecule() # Makes H2 >>> new_atom = a.add_atom(utils.ElementType.H, 0) # Make linear H3 >>> cleaved = editing.cleave(a, BondIndex(0, new_atom)) # Split back
cleave(molecule: scine_molassembler.Molecule, haptic_site: Tuple[int, int]) -> scine_molassembler.editing.Cleaved
Cleave a molecule in two along a haptic site.
Bridge bonds are edges in the graph that whose removal splits the graph into two connected components. Any bonds in a cycle, for instance, are not bridge bonds.
- param molecule
Molecule to cleave
- param haptic_site
Atom and site index pair indicating the haptic site to cleave
- return
A pair of molecules and a component map. The first molecule always contains the atom indicated by
haptic_site.
- scine_molassembler.editing.connect(left: scine_molassembler.Molecule, right: scine_molassembler.Molecule, left_atom: int, right_atom: int, bond_type: scine_molassembler.BondType) scine_molassembler.Molecule
Connect two molecules by creating a new bond between two atoms from separate molecules
- Parameters
left – The first molecule
right – The second molecule
left_atom – The atom from
leftto connectright_atom – The atom from
rightto connectbond_type – The bond type with which to connect
left_atomandright_atom
- scine_molassembler.editing.insert(log: scine_molassembler.Molecule, wedge: scine_molassembler.Molecule, log_bond: scine_molassembler.BondIndex, first_wedge_atom: int, second_wedge_atom: int) scine_molassembler.Molecule
Insert a molecule into a bond of another molecule. Splits
logatlog_bond, then insertswedgeat the split atoms, connecting the first atom oflog_bondwithfirst_wedge_atomand the secondlog_bondatom withsecond_wedge_atom.The bond type of the
log_bondis reused in the new bonds formed to thewedgeatoms.- Parameters
log – The molecule being inserted into
wedge – The molecule being inserted into the
loglog_bond – Log’s bond that
wedgeshould be inserted intofirst_wedge_atom – The atom of
wedgeto bond to the first atom inlog_bondsecond_wedge_atom – The atom of
wedgeto bond to the second atom inlog_bond
- Returns
The result of the insert operation
- scine_molassembler.editing.substitute(left: scine_molassembler.Molecule, right: scine_molassembler.Molecule, left_bridge: scine_molassembler.BondIndex, right_bridge: scine_molassembler.BondIndex) scine_molassembler.Molecule
Connect two molecules by substituting away the lighter side of a pair of bonds of separate molecules.
The heavy side is chosen by number of atoms first, then molecular weight if the number of atoms is equal. Should both sides be equal in both, which side is picked is undefined.
- Parameters
left – The first molecule
right – The second molecule
left_bridge – Left’s bridge bond from which to substitute the lighter part away.
right_bridge – Right’s bridge bond from which to substitute the lighter part away.
- scine_molassembler.editing.superpose(top: scine_molassembler.Molecule, bottom: scine_molassembler.Molecule, top_overlay_atom: int, bottom_overlay_atom: int) scine_molassembler.Molecule
Fuse two molecules, adding all adjacencies of one Molecule’s atoms to another
Adds all adjacent atoms and continuations of
bottom_overlay_atomin bottom totop_overlay_atomin top.top_overlay_atom’s element type is unchanged as it is the ‘top’ of the superimposition / overlay.- Parameters
top – The molecule at the “top” of the superposition.
bottom – The molecule at the “bottom” of the superposition.
top_overlay_atom – The atom of
topthat is placed “onto”bottom’sbottom_overlay_atombottom_overlay_atom – The atom of
bottomto place “beneath” top’stop_overlay_atom