write.SDF: SDF export function

Description Usage Arguments Details Author(s) References See Also Examples

View source: R/AllClasses.R

Description

Writes one or many molecules stored in a SDFset, SDFstr or SDF object to SD file.

Usage

1

Arguments

sdf

object of class SDFset, SDFstr or SDF

file

name of SD file to write to

cid

if cid = TRUE and an SDFset object is provide as input, then the compound IDs in the ID slot of the SDFset are used for compound naming

...

the optional arguments of the sdf2str function can be provided here, including head, ab, bb, db; details are provided in the help page for the sdf2str function

Details

If the write.SDF function is supplied with an SDFset object, then it uses internally the sdf2str function to allow customizing the resulting SD file. For this all optional arguments of the sdf2str function can be passed on to write.SDF.

Author(s)

Thomas Girke

References

SDF format definition: http://www.symyx.com/downloads/public/ctfile/ctfile.jsp

See Also

Import function: read.SDFset, read.SDFstr

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Instance of SDFset class
data(sdfsample); sdfset <- sdfsample

## Write objects of classes SDFset/SDFstr/SDF to file
# write.SDF(sdfset[1:4], file="sub.sdf")

## Example for writing customized SDFset to file containing
## ChemmineR signature, IDs from SDFset and no data block
# write.SDF(sdfset[1:4], file="sub.sdf", sig=TRUE, cid=TRUE, db=NULL)

## Example for injecting a custom matrix/data frame into the data block of an
## SDFset and then writing it to an SD file
props <- data.frame(MF=MF(sdfset), MW=MW(sdfset), atomcountMA(sdfset))
datablock(sdfset) <- props
view(sdfset[1:4])
# write.SDF(sdfset[1:4], file="sub.sdf", sig=TRUE, cid=TRUE)

Example output

$CMP1
An instance of "SDF"

<<header>>
                            Molecule_Name 
                                 "650001" 
                                   Source 
                 "  -OEChem-07071010512D" 
                                  Comment 
                                       "" 
                              Counts_Line 
" 61 64  0     0  0  0  0  0  0999 V2000" 

<<atomblock>>
          C1      C2  C3  C5  C6  C7  C8  C9 C10 C11 C12 C13 C14 C15 C16
O_1   7.0468  0.0839   0   0   0   0   0   0   0   0   0   0   0   0   0
O_2  12.2708  1.0492   0   0   0   0   0   0   0   0   0   0   0   0   0
...      ...     ... ... ... ... ... ... ... ... ... ... ... ... ... ...
H_60  1.8411 -1.5985   0   0   0   0   0   0   0   0   0   0   0   0   0
H_61  2.6597 -1.2843   0   0   0   0   0   0   0   0   0   0   0   0   0

<<bondblock>>
     C1  C2  C3  C4  C5  C6  C7
1     1  16   2   0   0   0   0
2     2  23   1   0   0   0   0
... ... ... ... ... ... ... ...
63   33  60   1   0   0   0   0
64   33  61   1   0   0   0   0

<<datablock>> (9 data items)
          MF           MW            C            H              
"C23H28N4O6"   "456.4916"         "23"         "28"        "..." 

$CMP2
An instance of "SDF"

<<header>>
                            Molecule_Name 
                                 "650002" 
                                   Source 
                 "  -OEChem-07071010512D" 
                                  Comment 
                                       "" 
                              Counts_Line 
" 49 51  0     0  0  0  0  0  0999 V2000" 

<<atomblock>>
          C1     C2  C3  C5  C6  C7  C8  C9 C10 C11 C12 C13 C14 C15 C16
O_1    3.732  0.997   0   0   0   0   0   0   0   0   0   0   0   0   0
O_2        2 -2.003   0   0   0   0   0   0   0   0   0   0   0   0   0
...      ...    ... ... ... ... ... ... ... ... ... ... ... ... ... ...
H_48 10.6863 2.6555   0   0   0   0   0   0   0   0   0   0   0   0   0
H_49 10.4379 -3.272   0   0   0   0   0   0   0   0   0   0   0   0   0

<<bondblock>>
     C1  C2  C3  C4  C5  C6  C7
1     1  15   2   0   0   0   0
2     2  18   2   0   0   0   0
... ... ... ... ... ... ... ...
50   25  47   1   0   0   0   0
51   26  48   1   0   0   0   0

<<datablock>> (9 data items)
          MF           MW            C            H              
"C18H23N5O3"   "357.4069"         "18"         "23"        "..." 

$CMP3
An instance of "SDF"

<<header>>
                            Molecule_Name 
                                 "650003" 
                                   Source 
                 "  -OEChem-07071010512D" 
                                  Comment 
                                       "" 
                              Counts_Line 
" 44 47  0     0  0  0  0  0  0999 V2000" 

<<atomblock>>
         C1      C2  C3  C5  C6  C7  C8  C9 C10 C11 C12 C13 C14 C15 C16
S_1   4.326  1.9917   0   0   0   0   0   0   0   0   0   0   0   0   0
O_2  2.5369 -1.0961   0   0   0   0   0   0   0   0   0   0   0   0   0
...     ...     ... ... ... ... ... ... ... ... ... ... ... ... ... ...
H_43 2.4361  3.5824   0   0   0   0   0   0   0   0   0   0   0   0   0
H_44 3.1175  3.0307   0   0   0   0   0   0   0   0   0   0   0   0   0

<<bondblock>>
     C1  C2  C3  C4  C5  C6  C7
1     1  23   1   0   0   0   0
2     1  24   1   0   0   0   0
... ... ... ... ... ... ... ...
46   26  43   1   0   0   0   0
47   26  44   1   0   0   0   0

<<datablock>> (9 data items)
           MF            MW             C             H               
"C18H18N4O3S"    "370.4255"          "18"          "18"         "..." 

$CMP4
An instance of "SDF"

<<header>>
                            Molecule_Name 
                                 "650004" 
                                   Source 
                 "  -OEChem-07071010512D" 
                                  Comment 
                                       "" 
                              Counts_Line 
" 59 61  0     0  0  0  0  0  0999 V2000" 

<<atomblock>>
          C1     C2  C3  C5  C6  C7  C8  C9 C10 C11 C12 C13 C14 C15 C16
S_1   7.1279 1.5981   0   0   0   0   0   0   0   0   0   0   0   0   0
O_2    3.732 3.5981   0   0   0   0   0   0   0   0   0   0   0   0   0
...      ...    ... ... ... ... ... ... ... ... ... ... ... ... ... ...
H_58 15.4379  0.403   0   0   0   0   0   0   0   0   0   0   0   0   0
H_59  14.591  0.176   0   0   0   0   0   0   0   0   0   0   0   0   0

<<bondblock>>
     C1  C2  C3  C4  C5  C6  C7
1     1  15   1   0   0   0   0
2     1  22   1   0   0   0   0
... ... ... ... ... ... ... ...
60   32  58   1   0   0   0   0
61   32  59   1   0   0   0   0

<<datablock>> (9 data items)
           MF            MW             C             H               
"C21H27N5O5S"    "461.5346"          "21"          "27"         "..." 

ChemmineR documentation built on Feb. 28, 2021, 2:02 a.m.