export jpg/png file from SDF file with datawarrior from command line [message #591] |
Tue, 09 July 2019 08:13 ![Go to next message Go to next message](/forum/theme/myThemeWithHFCSS/images/down.png) |
dongkeke
Messages: 7 Registered: June 2019 Location: 中国
|
Junior Member |
![Nanjing+Tech+University](/forum/theme/myThemeWithHFCSS/images/twitter.png)
|
|
I often have to find the rules from images from 2D or 3D view in SDF files, it is troublesome to open each SDF file and save images as PNG file. It would be nice to have Datawarrior operate from the command line to export all images form each SDF file in Linux.
Dong_Keke
|
|
|
|
Re: export jpg/png file from SDF file with datawarrior from command line [message #596 is a reply to message #594] |
Tue, 09 July 2019 16:13 ![Go to previous message Go to previous message](/forum/theme/myThemeWithHFCSS/images/up.png) |
nbehrnd
Messages: 215 Registered: June 2019
|
Senior Member |
|
|
If your aim is to generate a visual survey about the constitution of the molecules deposit
in your .sdf, and assuming each .sdf contains only one model, I would first concatenate
the .sdf into one "container" with openbabel. Put them into one folder in common, enter
this depot via the CLI, and launch
obabel *.sdf -O container.sdf -d
To optional parameter "-d" will cause openbabel to strip-off all hydrogens except the ones
bound to either a hetero atom or on a terminal C. This simplifies the visual output quite
a bit.
Request then openbabel to access this poly-model container.sdf a twice, to create a vignette
about each molecule, put into a box of an array of all. You choose either a bitmapped .png,
or a vectorized .svg as output. The minimal instruction indicates input file type and file
name, and name of the output to be written (name including the file extension), e.g.
obabel -isdf container.sdf -O array.svg
There are optional paramers to adjust the formatting (e.g., number of columns, number of rows;
a grid, an integer counter next to the structure's original file name about the entry of the
model in the .sdf accessed).
Openabel's Dreiding-like colouring of heteroatoms may be good for a display on screen. This
however may be a potential pitfall if the structures are big (consequently, represented at low
scale) and print on paper. This is especially true for explict H bound to heteroatoms, Si, F,
Cl, S, Se; to lesser extent for O and N. You may request openbabel to use black ink only by
"-xu" (without quotation marks). Advantageously, the resolution independent crisp .svg may be
postprocessed further (cairosvg, inkscape, etc).
A recent example is https://github.com/nbehrnd/saturated_Murcko_scaffold
-
Attachment: example.png
(Size: 12.91KB, Downloaded 457 times)
|
|
|