Learn R Programming

ChemmineR (version 2.24.2)

write.SDFsplit: SDF split function

Description

Splits SD Files into any number of smaller SD Files

Usage

write.SDFsplit(x, filetag, nmol)

Arguments

x
object of class SDFset, SDFstr
filetag
string to prepend to file names
nmol
integer specifying number of molecules in split SD files

Details

To split an SD File into smaller ones, one can read the source file into R with read.SDFstr and write out smaller ones with write.SDFsplit. Note: when importing big SD Files, read.SDFstr will be much faster than read.SDFset, and there is no need to go through an SDFset object instance in this case.

References

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

See Also

Import/export functions: read.SDFset, read.SDFstr, read.SDFstr, read.SDFset

Examples

Run this code
## Load sample data
library(ChemmineR)
data(sdfsample)

## Not run: ## Create sample SD File with 100 molecules
# write.SDF(sdfsample, "test.sdf")
# 
# ## Read in sample SD File 
# sdfstr <- read.SDFstr("test.sdf")
# 
# ## Run export on SDFstr object
# write.SDFsplit(x=sdfstr, filetag="myfile", nmol=10)
# 
# ## Run export on SDFset object
# write.SDFsplit(x=sdfsample, filetag="myfile", nmol=10)
# 
# ## End(Not run)

Run the code above in your browser using DataLab