Smarts string unreadable in Knime

Hello,
I am trying to read and visualise a pattern in a set of molecules using SMarts strings.
I have a code in python (rdkit):
The string ‘[!$(#)&!D1]~[!$(#)&!D1]’ is not read with smart read node in Knime.
Below is the full string in python.
Do I need to convert the smart string to another format?

def enumerateTorsions(mol):
   torsionSmarts = '[!$(*#*)&!D1]~[!$(*#*)&!D1]'
   #torsionSmarts = '[#1&!#7]'
   torsionQuery = Chem.MolFromSmarts(torsionSmarts)
   matches = mol.GetSubstructMatches(torsionQuery)
   torsionList = []
   for match in matches:
     idx2 = match[0]
     idx3 = match[1]
     bond = mol.GetBondBetweenAtoms(idx2, idx3)
     jAtom = mol.GetAtomWithIdx(idx2)
     kAtom = mol.GetAtomWithIdx(idx3)
     if (((jAtom.GetHybridization() != Chem.HybridizationType.SP2)
       and (jAtom.GetHybridization() != Chem.HybridizationType.SP3))
       or ((kAtom.GetHybridization() != Chem.HybridizationType.SP2)
       and (kAtom.GetHybridization() != Chem.HybridizationType.SP3))):
       continue
     for b1 in jAtom.GetBonds():
       if (b1.GetIdx() == bond.GetIdx()):
         continue
       idx1 = b1.GetOtherAtomIdx(idx2)
       for b2 in kAtom.GetBonds():
         if ((b2.GetIdx() == bond.GetIdx())
           or (b2.GetIdx() == b1.GetIdx())):
           continue
         idx4 = b2.GetOtherAtomIdx(idx3)
         # skip 3-membered rings
         if (idx4 == idx1):
           continue
         torsionList.append((idx1, idx2, idx3, idx4))
   return torsionList

Which node are you using, what pattern are you trying to find, and what results do you get?

As far as I can tell, this SMARTS string matches 2 atoms, connected by any bond, and each atom has to be connected to at least 1 other atom. That’s a very broad selection criterion.

Hi @elsamuel
I used smart query node from MOE
I would like to detect all torsion for all single bonds in a molecule.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.