Learn R Programming

Rpdb (version 2.2)

read.pdb: PDB File Reader

Description

Reads a Protein Data Bank (PDB) coordinate file.

Usage

read.pdb(file, ATOM = TRUE, HETATM = TRUE, CRYST1 = TRUE, CONECT = TRUE, TITLE = TRUE, REMARK = TRUE, MODEL = 1)

Arguments

file
a single element character vector containing the name of the PDB file to be read.
ATOM
a single element logical vector indicating whether ATOM records have to be read.
HETATM
a single element logical vector indicating whether HETATM records have to be read.
CRYST1
a single element logical vector indicating whether CRYST1 records have to be read.
CONECT
a single element logical vector indicating whether CONECT records have to be read.
TITLE
a single element logical vector indicating whether TITLE records have to be read.
REMARK
a single element logical vector indicating whether REMARK records have to be read.
MODEL
an integer vector containing the serial number of the MODEL sections to be read. Can also be equal to NULL to read all the MODEL sections or to NA to ignore MODEL records (see details).

Value

When a single MODEL section is read, this function returns an object of class ‘pdb’ (a list with a class attribute equal to pdb) with the following components:
title
a character vector containing the TITLE records found in the PDB file.
remark
a character vector containing the REMARK records found in the PDB file.
cryst1
a list of class ‘cryst1’ containing the first CRYST1 record found in the PDB file. All others are ignored.
atoms
a data.frame of class ‘atoms’ containing the ATOM and HETATM records found in the PDB file.
conect
a data.frame of class ‘conect’ containing the CONECT records found in the PDB file.
When multiple MODEL sections are read, a list of object of class ‘pdb’ is returned.

Details

The read.pdb function read TITLE, REMARK, ATOM, HETATM, CRYST1 and CONECT records from a PDB file. Three different reading modes can be used depending on the value of MODEL:
  • When MODEL is a vector of integers, MODEL sections whose serial numbers match these integers are read.
  • When MODEL == NULL, all MODEL sections are read.
  • When MODEL == NA, MODEL records are ignored to read all ATOM and/or HETATM records together to return a single object.

References

PDB format has been taken from: http://www.wwpdb.org/documentation/format33/v3.3.html

See Also

write.pdb, pdb, cryst1, atoms, conect

Examples

Run this code
## Read a PDB file included with the package
x <- read.pdb(system.file("examples/PCBM_ODCB.pdb",package="Rpdb"))

## Visualize the PDB file
visualize(x, mode = NULL)

## Write the 'pdb' object 'x' in file "Rpdb.pdb" into the current directory
write.pdb(x, file = "Rpdb.pdb")

Run the code above in your browser using DataLab