plotStruc: Plot compound structures

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

View source: R/AllClasses.R

Description

Plots compound structure(s) for molecules stored in SDF and SDFset containers.

Usage

1
2
3
4
5
6
7
## Convenience plot method
# plot(x, griddim, print_cid=cid(x), print=TRUE, ...)

## Less important for user 
plotStruc(sdf, atomcex = 1.2, atomnum = FALSE, no_print_atoms = c("C"),
          noHbonds = TRUE, bondspacer = 0.12, colbonds=NULL, bondcol="red",
			 regenCoords=FALSE, ...)

Arguments

sdf

Object of class SDF

atomcex

Font size for atom labels

atomnum

If TRUE, then the atom numbers are included in the plot. They are the position numbers of each atom in the atom block of an SDF.

no_print_atoms

Excludes specified atoms from being plotted.

noHbonds

If TRUE, then the C-hydrogens and their bonds - explicitly defined in an SDF - are excluded from the plot.

bondspacer

Numeric value specifying the plotting distance for double/triple bonds.

colbonds

Highlighting of subgraphs in main structure by providing a numeric vector of atom numbers, here position index in atom block. The bonds of connected atoms will be plotted in the color provided under bondcol.

bondcol

A character or numeric vector of length one to specify the color to use for substructure highlighting under colbonds.

regenCoords

If ChemmineOB is installed and this option is TRUE, then Open Babel will be used to re-generate the 2D coords for each compound before plotting it. This often results in a nicer layout. If you want to save the results of the coord re-generation, call the regenerateCoords function first yourself and save the result.

...

Arguments to be passed to/from other methods.

Details

The function plotStruc depicts a single 2D compound structure based on the XY-coordinates specified in the atom block of an SDF. The generic method plot can be used as a convenient shorthand to plot one or many structures at once. Both functions depend on the availability of the XY-coordinates in the source SD file and only 2D (not 3D) representations are plotted correctly.

Additional arguments that can only be passed on to the plot function when supplied with an SDFset object:

griddim: numeric vector of length two to define the dimensions for arranging several structures in one plot.

print_cid: character vector for printing custom compound labels. Default is print_cid=cid(sdfset).

print: if print=TRUE, then a summary of the SDF content for each supplied compound is printed to the screen. This behavior is turned off with print=TRUE.

Value

Prints summary of SDF/SDFset to screen and plots their structures to graphics device.

Note

The compound depictions created by this function are not as pretty as the structure representations generated with the sdf.visualize function. This will be improved in the future.

Author(s)

Thomas Girke

References

...

See Also

sdf.visualize

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Import SDFset sample set
data(sdfsample)
(sdfset <- sdfsample)

## Plot single compound structure
plotStruc(sdfset[[1]])

## Plot several compounds structures
plot(sdfset[1:4])

## Highlighting substructures (here all rings)
myrings <- as.numeric(gsub(".*_", "", unique(unlist(rings(sdfset[1])))))
plot(sdfset[1], colbonds=myrings) 

## Customize plot 
plot(sdfset[1:4], griddim=c(2,2), print_cid=letters[1:4], print=FALSE, noHbonds=FALSE)

Example output

An instance of "SDFset" with 100 molecules
$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>> (33 data items)
          PUBCHEM_COMPOUND_CID PUBCHEM_COMPOUND_CANONICALIZED 
                      "650001"                            "1" 
     PUBCHEM_CACTVS_COMPLEXITY  PUBCHEM_CACTVS_HBOND_ACCEPTOR 
                         "700"                            "7" 
                               
                         "..." 

$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>> (33 data items)
          PUBCHEM_COMPOUND_CID PUBCHEM_COMPOUND_CANONICALIZED 
                      "650002"                            "1" 
     PUBCHEM_CACTVS_COMPLEXITY  PUBCHEM_CACTVS_HBOND_ACCEPTOR 
                         "497"                            "5" 
                               
                         "..." 

$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>> (28 data items)
          PUBCHEM_COMPOUND_CID PUBCHEM_COMPOUND_CANONICALIZED 
                      "650003"                            "1" 
     PUBCHEM_CACTVS_COMPLEXITY  PUBCHEM_CACTVS_HBOND_ACCEPTOR 
                         "638"                            "6" 
                               
                         "..." 

$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>> (33 data items)
          PUBCHEM_COMPOUND_CID PUBCHEM_COMPOUND_CANONICALIZED 
                      "650004"                            "1" 
     PUBCHEM_CACTVS_COMPLEXITY  PUBCHEM_CACTVS_HBOND_ACCEPTOR 
                         "698"                            "6" 
                               
                         "..." 

$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>> (33 data items)
          PUBCHEM_COMPOUND_CID PUBCHEM_COMPOUND_CANONICALIZED 
                      "650001"                            "1" 
     PUBCHEM_CACTVS_COMPLEXITY  PUBCHEM_CACTVS_HBOND_ACCEPTOR 
                         "700"                            "7" 
                               
                         "..." 

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