write.pdb {bio3d}R Documentation

Write PDB Format Coordinate File

Description

Write a Protein Data Bank (PDB) file for a given ‘xyz’ Cartesian coordinate vector or matrix.

Usage

write.pdb(pdb = NULL, xyz = pdb$xyz, resno = NULL, resid = NULL, eleno =
NULL, elety = NULL, chain = NULL, o = NULL, b = NULL, het = FALSE,
append = FALSE, verbose = FALSE, chainter = FALSE, end = TRUE, file = "R.pdb")

Arguments

pdb a PDB structure object obtained from read.pdb.
xyz Cartesian coordinates as a vector or 3xN matrix.
resno vector of residue numbers of length equal to length(xyz)/3.
resid vector of residue types/ids of length equal to length(xyz)/3.
eleno vector of element/atom numbers of length equal to length(xyz)/3.
elety vector of element/atom types of length equal to length(xyz)/3.
chain vector of chain identifiers with length equal to length(xyz)/3.
o vector of occupancy values of length equal to length(xyz)/3.
b vector of B-factors of length equal to length(xyz)/3.
het logical, if TRUE ‘HETATM’ records from pdb object are written to the output PDB file.
append logical, if TRUE output is appended to the bottom of an existing file (used primarly for writing multi-model files).
verbose logical, if TRUE progress details are printed.
chainter logical, if TRUE a TER line is inserted between chains.
end logical, if TRUE TER and END lines are written.
file the output file name.

Details

Only the xyz argument is strictly required. Other arguments assume a default poly-ALA C-alpha structure with a blank chain id, occupancy values of 1.00 and B-factors equal to 0.00.

If the input argument xyz is a matrix then each row is assumed to be a different structure/frame to be written to a “multimodel” PDB file, with frames separated by “END” records.

Value

Called for its effect.

Note

Check that: (1) chain is one character long e.g. “A”, and (2) resno and eleno do not exceed “9999”.

Author(s)

Barry Grant with contributions from Joao Martins.

References

Grant, B.J. et al. (2006) Bioinformatics 22, 2695–2696.

For a description of PDB format (version2.2) see:
http://www.rcsb.org/pdb/file_formats/pdb/.

See Also

read.pdb, read.dcd, read.fasta.pdb, read.fasta

Examples


# Read a PDB file
pdb <- read.pdb(system.file("examples/d1bg2__.ent", package="bio3d"))

# Renumber residues
nums <- as.numeric(pdb$atom[,"resno"])
nums <- nums - (nums[1] - 1)

# Write out renumbered PDB file
write.pdb(pdb=pdb, resno = nums, file="eg.pdb")


[Package bio3d version 1.0-6 Index]