conect {Rpdb} | R Documentation |
Create ‘conect’ Object
Description
Creates an object of class ‘conect’ containing the IDs of bonded atoms defining the connectivity of a molecular system.
Usage
conect(...)
## Default S3 method:
conect(eleid.1, eleid.2, ...)
## S3 method for class 'coords'
conect(x, radii = 0.75, safety = 1.2, by.block = FALSE, ...)
## S3 method for class 'pdb'
conect(x, safety = 1.2, by.block = FALSE, ...)
is.conect(x)
Arguments
... |
arguments passed to methods. |
eleid.1 |
a integer vector containing the IDs of bonded atoms. |
eleid.2 |
a integer vector containing the IDs of bonded atoms. |
x |
an R object containing atomic coordinates. |
radii |
a numeric vector containing atomic radii used to find neigbours. |
safety |
a numeric value used to extend the atomic radii. |
by.block |
a logical value indicating whether the connectivity has to be determine by block (see details). |
Details
conect
is a generic function to create objects of class
‘conect’. The purpose of this class is to store CONECT records from
PDB files, indicating the connectivity of a molecular system.
The default
method creates a conect
object from its different components, i.e.:
eleid.1
and eleid.2
. Both arguments have to be specified.
The S3 method for object of class ‘coords’ determine the connectivity
from atomic coordinates. A distance matrix is computed, then, for each pair
of atom the distance is compared to a bounding distance computed from atomic
radii. If this distance is lower than the bounding distance then the atoms
are assumed to be connected.
The S3 method for object of class
‘pdb’ first use element names to search for atomic radii in the
elements
data set. Then atomic coordinates and radii are passed to
conect.coords
.
If by.block == TRUE
, a grid is defined to
determined the connectivity by block. The method is slow but allow to deal
with very large systems.
is.conect
tests if an object of class
‘conect’, i.e. if it has a “class” attribute equal to
conect
.
Value
conect
returns a two-column data.frame of class
‘conect’ whose rows contain the IDs of bonded atoms. The columns of
this data.frame are described below:
eleid.1 |
a integer vector containing the elements IDs defining the connectivity of the system. |
eleid.2 |
a integer vector containing the elements IDs defining the connectivity of the system. |
is.conect
returns TRUE if x
is an object of class ‘coords’ and FALSE otherwise.
See Also
Examples
# If atom 1 is connected to atom 2, 3, 4 and 5
# then we can prepare the following 'conect' object:
x <- conect(rep(1,4), 2:5)
print(x)
is.conect(x)
# Compute conectivity from coordinates
x <- read.pdb(system.file("examples/PCBM_ODCB.pdb", package="Rpdb"), CONECT = FALSE)
x$conect
x$conect <- conect(x)
x$conect