openbabel / openbabel

Open Babel is a chemical toolbox designed to speak the many languages of chemical data.
http://openbabel.org/
GNU General Public License v2.0
1.02k stars 404 forks source link

Converting reactions SMILES into cdxml format loses reactant/product information #2703

Open RamziWeslati opened 1 week ago

RamziWeslati commented 1 week ago

Environment Information

Open Babel version: 3.1.0 Operating system and version: M1 Mac running Sonoma 14.5

Expected Behavior

Expected obabel -:"CCO.OCC>>CCC" -O output.cdxml --gen2D to turn >> into <arrow />

Actual Behavior

The output is instead output.cdxml:

<?xml version="1.0"?>
<!DOCTYPE CDXML
SYSTEM "http://www.camsoft.com/xml/cdxml.dtd">
<CDXML BondLength="30">
 <page>
  <fragment>
   <n id="1" p="223.923048 90.000000"/>
   <n id="2" p="197.942286 105.000000"/>
   <n id="3" p="171.961524 90.000000" Element="8"/>
   <n id="4" p="223.923048 165.000000" Element="8"/>
   <n id="5" p="197.942286 180.000000"/>
   <n id="6" p="171.961524 165.000000"/>
   <n id="7" p="141.961524 105.000000"/>
   <n id="8" p="115.980762 90.000000"/>
   <n id="9" p="90.000000 105.000000"/>
   <b B="1" E="2"/>
   <b B="2" E="3"/>
   <b B="4" E="5"/>
   <b B="5" E="6"/>
   <b B="7" E="8"/>
   <b B="8" E="9"/>
  </fragment>
 </page>
</CDXML>

Steps to Reproduce

obabel -:"CCO.OCC>>CCC" -O output.cdxml --gen2D

welcome[bot] commented 1 week ago

Thanks for opening your first issue here! Be sure to follow the issue template!

nbehrnd commented 1 week ago

@RamziWeslati My interpretation of

Minimal support of chemical structure information only.

(online documentation / section 18.9.1 of the manual by July 2023) is the export of reactions as .cdxml isn't yet (reliably) implemented. And by section 18.9.3, the binary .cdx format is read only.

If there are only a couple of data to process, then an editor (e.g. ChemDraw; ChemDoodle, Marvin) can/could provide the corresponding SMILES to .cdxml/.cdx conversion on a one-by-one basis.

test_reaction.zip