On 29 January 2012 20:39, Jan Hummel <[email protected]> wrote:
> Hello,
> First I want to apologize if this is a trivial question or the wrong place to
> ask.
>
> I'm maintain a Database for GC-MS spectra. Recently I updated the web
> frontend to display the chemical structures using the ChemDoodle Web
> Components (http://web.chemdoodle.com/) plugin. However, I notice that some
> structure are displayed correct
> (i.g. see here:
> http://gmd.mpimp-golm.mpg.de/Metabolites/f4f207ff-8ff8-4789-99a1-147ae0a36673.aspx)
> whereas others are displayed incorrect
> (http://gmd.mpimp-golm.mpg.de/Metabolites/0c450b43-c901-4435-9e74-051222d815ea.aspx).
> I mean they get displayed, but not very nice. I think that ChemDoodle is not
> the problem that the chemical structure can't be recognized from the
> displayed picture. The scaling of the picture (or of the mol-Files) seems
> somehow odd. And, other chemical software solutions seem to handle this to a
> better degree.
I would contact ChemDoodle - maybe there's a switch you can use to
rescale automatically.
> >From my understanding (being not a chemist) I suspect, that I have some
> >problems in the mol-Files. The coordinates between correct and incorrect
> >mol-Files seem to differ by an order of magnitude.
> My question is now, How can I use OpenBabel to re-render (repaint, re-layout)
> an "incorrect" mol-File into a "standard compliant" mol-File? mol.Center()
> did not the trick.
For each atom, you could scale the coordinates, e.g. (in pseudo C++)
oldcoords = atom->GetVector();
newcoords = oldcoords / 10.0;
atom->SetVector(newcoords);
> Here is my C# code
> OBConversion obconv = new OBConversion();
> OBMol mol = new OBMol();
> obconv.SetInFormat("mol");
> obconv.SetOutFormat("mol");
> obconv.ReadString(mol, source);
> mol.Center();
> obconv.WriteFile(mol, dest);
If you want to generate new 2d coordinates, you need to call gen2d.
Here's some Python code:
gen2d = OBOp.FindType("gen2d") # Looks up the plugin and returns it
gen2d.Do(mymol) # Calls the plugin on your molecule
- Noel
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
OpenBabel-scripting mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbabel-scripting