SDFset-class {ChemmineR} | R Documentation

## Class "SDFset"

### Description

List-like container for storing one or many objects of class `SDF` each containing the structure definition information of molecules provided by an SD/MOL file. The `SDFset` is the most important class in the ChemmmineR package for accessing and manipulating information stored in SD files.

### Objects from the Class

Objects can be created by calls of the form `new("SDFset", ...)`.

### Slots

`SDF`:

  Object of class `"list"` storing `SDF` components

`ID`:

  Object of class `"character"` storing compound identifiers

### Methods

[

  `signature(x = "SDFset")`: subsetting of class with bracket operator

[[

  `signature(x = "SDFset")`: returns single component as `SDF` object

[[<-

  `signature(x = "SDFset")`: replacement method for single `SDF` component

[<-

  `signature(x = "SDFset")`: replacement method for several `SDF` components

atomblock

  `signature(x = "SDFset")`: returns all atom blocks as list

atomcount

  `signature(x = "SDFset")`: returns all atom frequencies as list

bondblock

  `signature(x = "SDFset")`: returns all bond blocks as list

obmol

  `signature(x = "SDFset")`: returns pointers to OBMol objects as a vector

c

  `signature(x = "SDFset")`: concatenates two `SDFset` containers

cid

  `signature(x = "SDFset")`: returns all compound identifiers from ID slot

header<-

  `signature(x = "SDFset")`: replacement method for header block

atomblock<-

  `signature(x = "SDFset")`: replacement method for atom block

bondblock<-

  `signature(x = "SDFset")`: replacement method for bond block

datablock<-

  `signature(x = "SDFset")`: replacement method for data block

coerce

  `signature(from = "list", to = "SDFset")`: `as(list, "SDFset")`

coerce

  `signature(from = "SDF", to = "SDFset")`: `as(sdf, "SDFset")`

coerce

  `signature(from = "SDFset", to = "list")`: `as(sdfset, "list")`

coerce

  `signature(from = "SDFset", to = "SDF")`: `as(sdfset, "SDF")`

coerce

  `signature(from = "SDFset", to = "SDFstr")`: `as(sdfset, "SDFstr")`

coerce

  `signature(from = "SDFstr", to = "SDFset")`: `as(sdfstr, "SDFset")`

datablock

  `signature(x = "SDFset")`: returns all data blocks as list

datablocktag

  `signature(x = "SDFset")`: returns all data blocks as named as list with subsetting support

header

  `signature(x = "SDFset")`: returns all header blocks as list

length

  `signature(x = "SDFset")`: returns number of entries stored in object

plot

  `signature(x = "SDFset")`: plots one or many molecule structures from `SDFset` object

sdfid

  `signature(x = "SDFset")`: returns molecule ID field from header block

SDFset2list

  `signature(x = "SDFset")`: returns `SDFset` object as `list`

SDFset2SDF

  `signature(x = "SDFset")`: returns `SDFset` object as `list` with `SDF` components

SDFset2SDF<-

  `signature(x = "SDFset")`: replacement method for `SDFset` component in `SDFset` using accessor method

show

  `signature(object = "SDFset")`: prints summary of `SDFset`

view

  `signature(x = "SDFset")`: prints extended summary of `SDFset`

SDFset

  `SDFset(SDF, ID)`: interface to `SDFset` constructor

### Author(s)

Thomas Girke

### References

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

### See Also

Related classes: SDF, SDFstr, AP, APset

Import function: read.SDFset("some_SDF_file")

Export function: write.SDF(sdfset, "some_file.sdf")

### Examples

    showClass("SDFset")

    ## Instances of SDFset class
    data(sdfsample); sdfset <- sdfsample
    sdfset; view(sdfset[1:4])
    sdfset[[1]]

    ## Import and store SD File in SDFset container
    # sdfset <- read.SDFset("some_SDF_file")

    ## Miscellaneous accessor methods
    header(sdfset[1:4])
    atomblock(sdfset[1:4])
    atomcount(sdfset[1:4])
    bondblock(sdfset[1:4])
    datablock(sdfset[1:4])

    ## Assigning compound IDs and keeping them unique
    cid(sdfset); sdfid(sdfset)
    unique_ids <- makeUnique(sdfid(sdfset))
    cid(sdfset) <- unique_ids

    ## Convert data block to matrix
    blockmatrix <- datablock2ma(datablocklist=datablock(sdfset)) # Converts data block to matrix
    numchar <- splitNumChar(blockmatrix=blockmatrix) # Splits to numeric and character matrix
    numchar[[1]][1:4,]; numchar[[2]][1:4,]

    ## Compute atom frequency matrix, molecular weight and formula
    propma <- data.frame(MF=MF(sdfset), MW=MW(sdfset), atomcountMA(sdfset))
    propma[1:4, ]

    ## Assign matrix data to data block
    datablock(sdfset) <- propma
    view(sdfset[1:4])

    ## String Searching in SDFset
    grepSDFset("650001", sdfset, field="datablock", mode="subset") # To return index, set mode="index")

    ## Export SDFset to SD file
    # write.SDF(sdfset[1:4], file="sub.sdf", sig=TRUE)

    ## Plot molecule structure of SDF
    plot(sdfset[1:4]) # plots to R graphics device
    # sdf.visualize(sdfset[1:4]) # viewing in browser

[Package ChemmineR version 3.46.0 Index]