I am using RDKit Substructure Counter to count aromatic CH fragments and found that CH's on 2-pyranone or 4-pyranone rings (such as the intermediate ring in flavonoids) are also counted as aromatic. I've tried to dearomatize and (re)aromatize but the problem continues.
Does any of you know a workaround for this problem?
The RDKit considers that substructure to be aromatic. Here's an explanation of how the aromaticity perception is done: http://rdkit.org/docs/RDKit_Book.html#aromaticity
Without writing your own aromaticity perception code (not easy and not possible from within KNIME), there's not really anything you can do to remove the aromaticity from these substructures while allowing other structures to remain aromatic.
If you provide the input SMILES in a form such that the rings you want to have aromatic are marked as such and the pyranone substructure is not - for example this SMILES for the flavone backbone: O=C1C=C(Oc2ccccc12)c1ccccc1 - then you can use the "Partial Santitization" option in the "RDKit from Molecule" node and turn off "Reperceive aromaticity". This should do what you want.
You could always check for exceptions (most likely SMARTS based most suited) - as in "if list contains pyranones, then correct number of aromatic CH". Not perfect, but should work.