read.mol2.Rd
Read a Tripos MOL2 file
read.mol2(file, maxlines = -1L) # S3 method for mol2 print(x, ...)
file | a single element character vector containing the name of the MOL2 file to be read. |
---|---|
maxlines | the maximum number of lines to read before giving up with large files. Default is all lines. |
x | an object as obtained from |
... | additional arguments to ‘print’. |
Basic functionality to parse a MOL2 file. The current version reads and stores ‘@<TRIPOS>MOLECULE’, ‘@<TRIPOS>ATOM’, ‘@<TRIPOS>BOND’ and ‘@<TRIPOS>SUBSTRUCTURE’ records.
In the case of a multi-molecule MOL2 file, each molecule will be stored
as an individual ‘mol2’ object in a list. Conversely, if the multi-molecule
MOL2 file contains identical molecules in different conformations
(typically from a docking run), then the output will be one object
with an atom
and xyz
component (xyz in
matrix representation; row-wise coordinates).
See examples for further details.
Returns a list of molecules containing the following components:
a data frame containing all atomic coordinate ATOM data, with a row per ATOM and a column per record type. See below for details of the record type naming convention (useful for accessing columns).
a data frame containing all atomic bond information.
a data frame containing all substructure information.
a numeric matrix of ATOM coordinate data.
a numeric vector of MOL2 info data.
a single element character vector containing the molecule name.
Grant, B.J. et al. (2006) Bioinformatics 22, 2695--2696.
Lars Skjaerven
For atom
list components the column names can be
used as a convenient means of data access, namely:
Atom serial number “eleno”,
Atom name “elena”,
Orthogonal coordinates “x”,
Orthogonal coordinates “y”,
Orthogonal coordinates “z”,
Reisude number “resno”,
Atom type “elety”,
Residue name “resid”,
Atom charge “charge”,
Status bit “statbit”,
For bond
list components the column names are:
Bond identifier “id”,
number of the atom at one end of the bond“origin”,
number of the atom at the other end of the bond “target”,
the SYBYL bond type “type”.
For substructure
list components the column names are:
substructure identifier “id”,
substructure name “name”,
the ID number of the substructure's root atom “root_atom”,
the substructure type “subst_type”,
the type of dictionary associated with the substructure “dict_type”,
the chain to which the substructre belongs “chain”,
the subtype of the chain “sub_type”,
the number of inter bonds “inter_bonds”,
status bit “status”.
See examples for further details.
cat("\n")#>if (FALSE) { ## Read a single entry MOL2 file ## (returns a single object) mol <- read.mol2( system.file("examples/aspirin.mol2", package="bio3d") ) ## Short summary of the molecule print(mol) ## ATOM records mol$atom ## BOND records mol$bond ## Print some coordinate data head(mol$atom[, c("x","y","z")]) ## Or coordinates as a numeric vector #head(mol$xyz) ## Print atom charges head(mol$atom[, "charge"]) ## Convert to PDB pdb <- as.pdb(mol) ## Read a multi-molecule MOL2 file ## (returns a list of objects) #multi.mol <- read.mol2("zinc.mol2") ## Number of molecules described in file #length(multi.mol) ## Access ATOM records for the first molecule #multi.mol[[1]]$atom ## Or coordinates for the second molecule #multi.mol[[2]]$xyz ## Process output from docking (e.g. DOCK) ## (typically one molecule with many conformations) ## (returns one object, but xyz in matrix format) #dock <- read.mol2("dock.mol2") ## Reference PDB file (e.g. X-ray structure) #pdb <- read.pdb("dock_ref.pdb") ## Calculate RMSD of docking modes #sele <- atom.select(dock, "noh") #rmsd(pdb$xyz, dock$xyz, b.inds=sele$xyz) }