connect: Create 'connect' Object

View source: R/connect.R

connectR Documentation

Create ‘connect’ Object

Description

Creates an object of class ‘connect’ containing the IDs of bonded atoms defining the connectivity of a molecular system.

Usage

conect.default(eleid.1, eleid.2, ...)

connect(...)

## Default S3 method:
connect(eleid.1, eleid.2, ...)

## S3 method for class 'coords'
connect(x, radii = 0.75, safety = 1.2, by.block = FALSE, maxLimit = 3200, ...)

## S3 method for class 'atoms'
connect(x, safety = 1.2, by.block = FALSE, ...)

## S3 method for class 'pdb'
connect(x, safety = 1.2, by.block = FALSE, ...)

## S3 method for class 'character'
connect(pdbRec, atoms, ...)

is.connect(x)

Arguments

eleid.1

a integer vector containing the IDs of bonded atoms.

eleid.2

a integer vector containing the IDs of bonded atoms.

...

arguments passed to methods.

x, atoms

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).

maxLimit

integer value specifying the maximum number of atoms permitted to try connecting by distance.

pdbRec

the raw text lines from the pdb file.

Details

connect is a generic function to create objects of class ‘connect’. The purpose of this class is to store CONNECT records from PDB files, indicating the connectivity of a molecular system.
The default method creates a connect object from its different components, i.e.: eleid.1 and eleid.2. Both arguments have to be specified.
The S3 method for an object of class ‘coords’ determines the connectivity from atomic coordinates. A distance matrix is computed, then, for each pair of atoms 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 uses the element names to search for atomic radii in the elements data set. Then atomic coordinates and radii are passed to connect.coords.
If by.block == TRUE, a grid is defined to determined the connectivity by block. The method is slow but allows to deal with very large systems.
The S3 method for object of class ‘character’ converts the raw string from a pdb file into a connect object.

is.connect tests if an object is of class ‘connect’, i.e. if it has a “class” attribute equal to connect.

Value

connect returns a two-column data.frame of class ‘connect’ whose rows contain the IDs of bonded atoms. The columns of this data.frame are described below:

eleid.1

an integer vector containing the elements IDs defining the connectivity of the system.

eleid.2

an integer vector containing the elements IDs defining the connectivity of the system.



is.connect returns TRUE if x is an object of class ‘coords’ and FALSE otherwise.

See Also

pdb

Examples

# If atom 1 is connected to atom 2, 3, 4 and 5
# then we can prepare the following 'connect' object:
x <- connect(rep(1,4), 2:5)
print(x)
is.connect(x)

# Compute connectivity from coordinates
x <- read.pdb(system.file("examples/PCBM_ODCB.pdb", package="Rpdb"), CONNECT = FALSE)
x$connect
x$connect <- connect(x)
x$connect


Rpdb documentation built on May 12, 2026, 5:06 p.m.