vote up 1 vote down
star
1

I am having 3D structure in SDF format and I want to convert that into XML format. Can someone please let me know how I do this.

Also if I have an InChI whose structure is not in pubchem how do I get its 3D structure in XML format.

flag

1 Answer

vote up 1 vote down
check

Which XML format? CML? If so, use Babel on the command-line

babel source.sdf result.cml

You can also use babel to convert an InChI to CML with 3D coordinates. I'll do it first without the --gen3D flag, to show that there are no coordinates:

% cat test.inchi 
InChI=1S/C9H17NO4/c1-7(11)14-8(5-9(12)13)6-10(2,3)4/h8H,5-6H2,1-4H3
% babel test.inchi test.cml
1 molecule converted
16 audit log messages 
% head -5 test.cml
<?xml version="1.0"?>
<molecule xmlns="http://www.xml-cml.org/schema">
 <atomArray>
  <atom id="a1" elementType="C"/>
  <atom id="a2" elementType="C"/>
%

and then with --gen3D to show the coordinates to show the 3D coordinates:

% babel --gen3D test.inchi test.cml
1 molecule converted
1 info messages 72 audit log messages 7 debugging messages 
% head -5 test.cml
<?xml version="1.0"?>
<molecule xmlns="http://www.xml-cml.org/schema">
 <atomArray>
  <atom id="a1" elementType="C" x3="10.421482" y3="0.491655" z3="-0.837926"/>
  <atom id="a2" elementType="C" x3="8.319998" y3="4.170162" z3="-1.733595"/>
%
link|flag
Thanks Andrew for your reply. will try this out. – Sashikiran Challa Jan 26 at 16:11

Your Answer

Get an OpenID
or

Not the answer you're looking for? Browse other questions tagged or ask your own question.