Learn R Programming

ChemmineR (version 2.24.2)

sdf2str: SDF to SDFstr

Description

Converts SDF to SDFstr. Its main use is to facilitate the export to SD files. It contains optional arguments to generate custom SDF output.

Usage

sdf2str(sdf, head, ab, bb, db, cid = NULL, sig = FALSE, ...)

Arguments

sdf
object of class SDF
head
optional character vector to supply custom header block
ab
optional matrix to supply custom atom block
bb
optional matrix to supply custom bond block
db
optional character vector to supply custom data block
cid
character can be provided to inject custom compound ID into header block
sig
if = TRUE then the ChemmineR signature will be injected into the header block for tracking purposes
...
option to pass on additional arguments

Value

sdfstr
SDF data of one molecule collapsed to character vector

Details

If the export function write.SDF is supplied with an SDFset object, then sdf2str is used internally to customize the export of many molecules to a single SD file using the same optional arguments.

References

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

See Also

Coerce functions: sdfstr2list, sdf2str, SDFset2list, SDFset2SDF

Export function: write.SDF

Examples

Run this code
## Instance of SDF class
data(sdfsample); sdfset <- sdfsample
sdf <- sdfset[[1]]

## Customize SDF blocks for export to SD file
sdf2str(sdf=sdf, sig=TRUE, cid=TRUE) # uses default SDF components
sdf2str(sdf=sdf, head=letters[1:4], db=NULL) # uses custom components for header and datablock

## The same arguments can be supplied to the write.SDF function for
## batch export of custom SDFs
# write.SDF(sdfset[1:4], file="sub.sdf", sig=TRUE, cid=TRUE, db=NULL)

Run the code above in your browser using DataLab