<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 This example shows how RGroupDecomposition works with stereochemistry matching.
If stereochemistry is specified in the core, the RGroup decomposition correctly assigns R1 and R2.
Step1:  Perhaps we should file a bug that smarts doesn't show stereochem here.
Step2:  Make some example stereochemistries
Step3:  Make RGroup decomposition!
To use RGroupDecomposition
Step4:  We need to call process after all molecules are added.  To optimize the RGroups.
Step5:  The RGroupDecomposition code is quite compatible with the python pandas integration.
Calling rg.GetRGroupsAsColumns() can be sent directly into a pandas table.
n.b. You need to call PandasTools.ChangeMoleculeRendering(frame) to allow the molecules
to be rendered properly.
Step6:  The first two (0 and 1) are different due to the sterochemistry difference.
I still haven't found a way to show the core with stereochem which is annoying.
Step7:  Let's try the same with stereochemistry in the core.
Note that the core has symmetry and the analysis nicely supports this during 
the side chain optimization
n.b. stereo information is lost here which is fairly annoying and will be analyzed at a later date.
<ASSISTANT_TASK:>
Python Code:
from rdkit import Chem
from rdkit.Chem.Draw import IPythonConsole
IPythonConsole.ipython_useSVG=True
from rdkit.Chem import rdRGroupDecomposition
from IPython.display import HTML
from rdkit import rdBase
rdBase.DisableLog("rdApp.debug")
import pandas as pd
from rdkit.Chem import PandasTools
m = Chem.MolFromSmarts("C1CCO[C@@](*)(*)1")
Explanation: This example shows how RGroupDecomposition works with stereochemistry matching.
If stereochemistry is specified in the core, the RGroup decomposition correctly assigns R1 and R2.
End of explanation
m
Explanation: Perhaps we should file a bug that smarts doesn't show stereochem here.
End of explanation
el = "NOPS"
mols = []
for e in el:
    smi = "C1CCO[C@@H](%s)1"%e
    print(smi)
    m = Chem.MolFromSmiles(smi)
    mols.append(m)
    smi = "C1CCO[C@H](%s)1"%e
    print(smi)
    m = Chem.MolFromSmiles(smi)
    mols.append(m)
    for e2 in el:
        if e != e2:
            smi = "C1CCO[C@@](%s)(%s)1"%(e,e2)
            m = Chem.MolFromSmiles(smi)
            if m:
                print(smi)
                mols.append(m)
from rdkit.Chem import Draw
Draw.MolsToGridImage(mols)
hmols = [Chem.AddHs(m) for m in mols]
Draw.MolsToGridImage(hmols)
core = Chem.MolFromSmarts("C1CCO[C@@](*)(*)1")
Explanation: Make some example stereochemistries
End of explanation
rgroups = rdRGroupDecomposition.RGroupDecomposition(core)
for i,m in enumerate(mols):
    rgroups.Add(m)
    if i == 10:
        break
Explanation: Make RGroup decomposition!
To use RGroupDecomposition:
construct the class on the core rg = RGroupDecomposition(core)
Call rg.Add( mol ) on the molecules.  If this returns -1, the molecule is not
     compatible with the core
After all molecules are added, call rg.Process() to complete the rgroup
     decomposition.
End of explanation
rgroups.Process()
Explanation: We need to call process after all molecules are added.  To optimize the RGroups.
End of explanation
groups = rgroups.GetRGroupsAsColumns()
frame = pd.DataFrame(groups)
PandasTools.ChangeMoleculeRendering(frame)
Explanation: The RGroupDecomposition code is quite compatible with the python pandas integration.
Calling rg.GetRGroupsAsColumns() can be sent directly into a pandas table.
n.b. You need to call PandasTools.ChangeMoleculeRendering(frame) to allow the molecules
to be rendered properly.
End of explanation
HTML(frame.to_html())
Explanation: The first two (0 and 1) are different due to the sterochemistry difference.
I still haven't found a way to show the core with stereochem which is annoying.
End of explanation
core = Chem.MolFromSmarts("C1CCOC1")
rgroups = rdRGroupDecomposition.RGroupDecomposition(core)
for m in mols:
    rgroups.Add(m)
rgroups.Process()
frame = pd.DataFrame(rgroups.GetRGroupsAsColumns())
PandasTools.ChangeMoleculeRendering(frame)
HTML(frame.to_html())
Explanation: Let's try the same with stereochemistry in the core.
Note that the core has symmetry and the analysis nicely supports this during 
the side chain optimization
n.b. stereo information is lost here which is fairly annoying and will be analyzed at a later date.
End of explanation
<END_TASK>