Release Date: 1 February 2008
Namedcgi_smi2gif - convert SMILES to GIF format
Unix Synopsisdcgi_smi2gif [ HEX-encoded-SMILES ] [ -a num_colors ] [ -c COB|COW|COP|WOB|WOP|BOW|BOP ] [ -fromto ] [ -h height ] [ -r ] [ -s ] [ -t HEX-encoded-TDT ] [ -w width ] [ -x ] [-xs]
Descriptiondcgi_smi2gif(1) reads a HEX-encoded SMILES and writes it out an image in GIF87a-compliant MIME format. The GIF is made HTML-ready by prepended the image with the line "Content-type: image/gif" and a blank line:
GIF87a <binary data>
To produce a GIF image in MIME format of OC1CCCCC1 (cyclohexylketone), HEX-encode the SMILES "on-the-fly" using the BIN2HEX program in $DY_ROOT/daycgi/. for example:
dcgi_smi2gif `bin2hex 'O=C1CCCCC1'`which is equivalent to:
Why HEX-encoding, you ask? Because the data is intended to be received from a browser and some SMILES characters, such as parenthesis, square brackets, etc., cannot be transmitted in ASCII format, thus, HEX-encoding is used.
The HEX-encoded SMILES is used by the DayCGI SMI2GIF program, which is normally configured under a web server as /daycgi/smi2gif. One way to view depictions of SMILES is to HEX-encode the SMILES with BIN2HEX and include the output in a URL. For example, the GIF image of cyclohexylketone can viewed at http://www.daylight.com/daycgi/smi2gif?4f3d4331434343434331.
Specify the number of colors for ALAB (atom labeled) coloring. This parameter has meaning only when used with the -t option and the TDT contains the ALAB dataitem. The default number of colors is 10.
Specify the foreground and background colors of the image. Foreground can be either color (C), white (W), or black (B). Background can be either black (B), white (W), or paper (P). Paper means no background. The foreground and background values are specified in one token with an intervening 'O' character. For example, the color (C) on (O) paper (P) option is specified as '-c COP'. White on white (WOW) and black on black (BOB) are ignored. The default is color on black (COB).
Uses the special atoms [*-1] and [*-2] to orient the depiction from left to right. For more information, see dt_setorient(3) and the DX_ORIENT_WILD orientation value. This option overrides the -o option.
Set the height of the image in pixels. This value affects the scale and orientation of the image. The width and hieght options can be used together.
Performs automatic portrait/landscape orientation. Orientation is normally performed but not when 2D data is specified, so this option is effective with TDT formatted data (-t option) containing 2D-coordinates. For more information, see dt_setorient(3) and the DX_ORIENT_AUTO orientation value. This option is overridden by the -fromto option.
Reaction mode, which annotates mapped atoms in reaction SMILES with a numeric subscript.
SMARTS mode, which allows the depiction of generic reaction transforms expressed in the SMIRKS language. This mode will also display most regular SMARTS, with the exception of SMARTS containing bond expressions
Specify the input in HEX-encoded TDT format instead of HEX-encoded SMILES format. The output will reflect 2D data if present in the TDT.
Set the width of the image in pixels. This value affects scale and orientation of the image.
Explicitly show hydrogens on heavy atoms. By default, hydrogens are suppressed.
Use XSMILES (Kekule form) of SMILES. By default, aromatic bond types are depicted when applicable.
Options can be specified within the HEX-encoded portion of a URL by replacing the hyphen ("-") with the pound sign ("#") and using the equal sign (=) between options and values. Spaces within a HEX-encoded string are used to separate options. The following example shows the difference between specifying options on the command line and embedding them within a HEX-encoded string:
dcgi_smi2gif `bin2hex 'O=C1CCCCC1'` -w 400 -h 300is equivalent to:
dcgi_smi2gif `bin2hex 'O=C1CCCCC1 #w=400 #h=300'`In this way, the output from BIN2HEX (4f3d43314343434343312023773d3430302023683d333030) can be used after the question mark ("?") in the SMI2GIF URL (http://www.daylight.com/daycgi/smi2gif?).
Schematic attributes of the depiction can be specified by setting the DY_DEPICT_HINTS environment variable to "SCHEMA". When set, the depiction schema is set to TRUE using dt_setschematic(3).
Return ValueUpon success, returns status 0 and outputs a GIF image. Upon failure, returns status 1 and no output. The following are frequent failure conditions:
* no input (missing SMILES or #t TDT option)
* more than one input (multiple SMILES or #t TDT options)
* input cannot be HEX-decoded to a valid SMILES
* drawing library cannot be initialized.
ExamplesSets the width to 400 pixels and the height to 300 pixels:
dcgi_smi2gif `bin2hex 'O=C1CCCCC1 #w=400 #h=300'`
Specify color on white paper:
dcgi_smi2gif `bin2hex 'O=C1CCCCC1 #c=COP'`
Specify a TDT:
dcgi_smi2gif `bin2hex '$SMI<O=C1CCCCC1>| #t'`
Specify 7 colors and atom-coloring labels in a TDT:
dcgi_smi2gif `bin2hex '$SMI<O=C1CCCCC1>ALAB<.1,.2,.3,.4,.5,.6,.7>| #t #a=7'`
Horizonally align cyclohexylketone along the C2-C3 bond:
dcgi_smi2gif `bin2hex 'O=C1C([*-1])C([*-2])CCC1 #fromto'`
Specify chair conformation of cyclohexylketone using 2D data:
dcgi_smi2gif `bin2hex '$SMI<O=C1CCCCC1>2D<-.75,1.5,0,1,1,0,2,.5,3,0,2,1,1,.5>| #t' #w=200 #h=400`
Specify automatic orientation of cyclohexylketone using 2D data (reorients layout to maximize use of narrow image):
dcgi_smi2gif `bin2hex '$SMI<O=C1CCCCC1>2D<-.75,1.5,0,1,1,0,2,.5,3,0,2,1,1,.5>| #t #w=200 #h=400 #o'`
Specify the enol-keto tautomer of cyclohexylketone:
dcgi_smi2gif `bin2hex '[O:1]=[C:2]1[C:3]([H:4])([H])CCCC1>[H+]>[H:4][O:1][C:2]1=[C:3]([H])CCCC1 #r'`
Specify a methyl or amino para-substituted cyclohexylketone:
dcgi_smi2gif `bin2hex 'O=C1CCC([C,N])CC1 #s'`
Express CH2's on the ring of cyclohexylketone:
dcgi_smi2gif `bin2hex 'O=C1CCCCC1 #x'`
Depict XSMILES (Kekule form) of phenol:
dcgi_smi2gif `bin2hex 'Oc1ccccc1 #xs'`
Specify a cross configuration for t-butanol using 2D data. Note that 2D data for in nine hydrogens (three for each methyl) are not specified:
dcgi_smi2gif `bin2hex '$SMI<CC(C)(C)O>2D<0,1,0,0,-1,0,0,-1,1,0,,,,,,,,,,,,,,,,,,,1,1>| #t'`or
dcgi_smi2gif `bin2hex '$SMI<CC(C)(C)[OH]>2D<0,1,0,0,-1,0,0,-1,1,0,,,,,,,,,,,,,,,,,,,1,1>| #t'`
Specify a cross configuration for deuterated t-butanol using 2D data. Note that the deuterated hydrogen is consider a heavy atom, therefore its 2D data follows the oxygen:
dcgi_smi2gif `bin2hex '$SMI<CC(C)(C)O[2H]>2D<0,1,0,0,-1,0,0,-1,1,0,1,1>| #t'`
Related TopicsDaylight Theory Manual
Daylight Software Demos (http://www.daylight.com/dayhtml/)
BugsLayout of implicit hydrogens cannot be specified. When an implicit hydrogen is part of the input SMILES, an empty 2D-coordinate is required. For example, an implicit hydrogen as the fifth atom in t-butanol (CC(C)(C([H]))O) is handled by an empty 2D-coordinate between the fourth and sixth 2D-coordinate pairs:
dcgi_smi2gif `bin2hex '$SMI<CC(C)(C([H]))O>2D<0,1,0,0,-1,0,0,-1,,,1,0>| #t'`
If TDT format is used, the TDT must appear first in the HEX-encoded string and the option ('#t') should appear after it. If the TDT is does not appear first, no output will be produced, for example:
dcgi_smi2gif `bin2hex '#t $SMI<C>|'`
The TDT must begin with '$SMI<', otherwise, no output will be produced.
An option that requires a value will consume the next command line argument. When a option a value is omitted, for example:
dcgi_smi2gif -c -t `bin2hex '$SMI<C>|'`the TDT option ("-t") is lost because the color option ("-c") consumed it. In this example, '$SMI<C>|' would be interpreted as a non-TDT HEX-encoded string and no output will be produced.
When an option requires a value and there are no more command line arguments, for example:
dcgi_smi2gif `bin2hex '$SMI<C>|'` -t -ca segmentation fault will occur.
HEX-encoded input that decodes to a zero-length string will not produce output,, for example:
dcgi_smi2gif 4abnormally terminates the program. All of these program bugs will have return status 1.