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)¶ Initialize self. See help(type(self)) for accurate signature.
-
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
a
to bind ligand toligand_binding_atoms – Atoms in
ligand
to bind tocomplexating_atom
to.
-
scine_molassembler.editing.
cleave
(*args, **kwargs)¶ Overloaded function.
cleave(molecule: scine_molassembler.Molecule, bridge: scine_molassembler.BondIndex) -> scine_molassembler.editing.Cleaved
Cleave a molecule in two along a bridge bond.
Bridge bonds are edges in the graph 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 and a component map.
- 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
left
to connectright_atom – The atom from
right
to connectbond_type – The bond type with which to connect
left_atom
andright_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
log
atlog_bond
, then insertswedge
at the split atoms, connecting the first atom oflog_bond
withfirst_wedge_atom
and the secondlog_bond
atom withsecond_wedge_atom
.The bond type of the
log_bond
is reused in the new bonds formed to thewedge
atoms.- Parameters
log – The molecule being inserted into
wedge – The molecule being inserted into the
log
log_bond – Log’s bond that
wedge
should be inserted intofirst_wedge_atom – The atom of
wedge
to bond to the first atom inlog_bond
second_wedge_atom – The atom of
wedge
to bond to the second atom inlog_bond
- Returns
The result of the insert operation
-
scine_molassembler.editing.
substitute
(*args, **kwargs)¶ Overloaded function.
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.
- param left
The first molecule
- param right
The second molecule
- param left_bridge
Left’s bridge bond from which to substitute the lighter part away.
- param right_bridge
Right’s bridge bond from which to substitute the lighter part away.
substitute(left: scine_molassembler.Molecule, right: scine_molassembler.Molecule, left_bridge: scine_molassembler.BondIndex, right_bridge: scine_molassembler.BondIndex, left_substitute_index: int, right_substitute_index: int) -> 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.
- param left
The first molecule
- param right
The second molecule
- param left_bridge
Left’s bridge bond from which to substitute the lighter part away.
- param right_bridge
Right’s bridge bond from which to substitute the lighter part away.
- param left_substitute_index
Left’s atom index to substitute away
- param right_substitute_index
Right’s atom index to substitute 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_atom
in bottom totop_overlay_atom
in 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
top
that is placed “onto”bottom
’sbottom_overlay_atom
bottom_overlay_atom – The atom of
bottom
to place “beneath” top’stop_overlay_atom