openmolecules.org

 
Home » DataWarrior » Functionality » export jpg/png file from SDF file with datawarrior from command line (Used in Linux)
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
nbehrnd is currently offline  nbehrnd
Messages: 211
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 422 times)
 
Read Message
Read Message
Read Message
Previous Topic: Racemates showing as chiral
Next Topic: Retrieve Data from SQL database
Goto Forum:
  


Current Time: Thu Apr 25 21:39:31 CEST 2024

Total time taken to generate the page: 0.05366 seconds