Indigo
Indigo copied to clipboard
Implement salt checking procedure
Description We need to check if a chemical compound contains salt. Is should be a method that returns a boolean value:
class IndigoObject:
...
def checkSalt(self) -> bool:
...
Implementation details We have a substructure matcher that allows us to check if a chemical compound is a part of other chemical compound. The example of how it works:
from indigo import Indigo
# Create a new Indigo session
indigo = Indigo()
# Load target compound that we need to check for salts
target_molecule = indigo.loadMolecule("CC.[Na]Cl")
# Iterate over disconnected fragments of the compound, "CC" and "[Na]Cl" in this case
for target_fragment in target_molecule.iterateComponents():
# Create a molecule from fragment, for technical reasons
target_fragment = target_fragment.clone()
# Check if current fragment is "C"
query_molecule_c = indigo.loadMolecule("C")
if indigo.exactMatch(target_fragment, query_molecule_c):
print("C matched")
# Check if current fragment is "NaCl"
query_molecule_nacl = indigo.loadMolecule("[Na]Cl")
if indigo.exactMatch(target_fragment, query_molecule_nacl):
print("NaCl matched")
So the salt checking procedure could be implemented by calling a multiple substructure checking for different types of salts, and main challenge is to prepare the list of salts. This list could be used as a source of inspiration.
Note: to import indigo, you can install Indigo from PyPi by using following command:
pip install epam.indigo
I'm a bit confused with what exactly should be recognized as "salt". Which types of fragments, individual ions or ion-counterion pairs, are supposed to be found?
For example we have a system with large organic ion and small counter ion - cetylpyridinium chloride, CCCCCCCCCCCCCCCC[N+]1=CC=CC=C1.[Cl-]. Is it correct to recognized [Cl-] as "salt" or it is necessary to have in here some [Na+] (or any other small cation) as well and mark them both as NaCl?
closing the ticket