coords(...)
coords(x) <- value
is.coords(x)
"coords"(x1, x2, x3, basis = "xyz", ...)
"coords"(x, ...)
"coords"(x) <- value
"coords"(x, ...)
"coords"(x) <- value
"coords"(x, basis = NULL, ...)
"coords"(x, basis = NULL, ...)
basis
attribute equal to "xyz"
)
or fractional coordinates (basis
attribute equal to "abc"
).The replacement function returns an object of the same class as x
with updated coordinates.is.coords
returns TRUE if x is an object of class coords and FALSE otherwise
coords
and coords<-
are generic accessor and replacement functions.
The default method of the coords
function is actually a builder allowing to create a coords object from its different components, i.e.: x1
, x2
, x3
, and basis
.
All the arguments have to be specified except 'basis' which by default is set to "xyz" (Cartesian coordinates).For an object of class atoms, the accessor function extracts its x1
, x2
and x3
components as well as its basis
attribute to create a coords object. The replacement function set its x1
, x2
and x3
components as well as its basis
attribute.
For an object of class pdb, the accessor function extracts the x1
, x2
and x3
components as well as the basis
attribute of its atoms
component to create a coords object. The replacement function set the x1
, x2
and x3
components as well as the basis
attribute of its atoms
component.
For matrix and data.frame objects, when basis==NULL
this function search x, y, z or a, b, c columns in x
.
If x, y, z columns are found they are used to a set the first, second and third coordinates of the returned coords object.
In that case the basis set of x
is set to "xyz"
.
If a, b, c columns are found they are used to a set the first, second and third coordinates of the returned coords object.
In that case the basis set of x
is set to "abc"
.
If the function doesn't found neither the x, y, z nor the a, b, c columns an error is returned.
When basis!=NULL
it has to be equal to "xyz"
or "abc"
and x
must have exactly 3 columns.
is.coords
tests if x is an object of class coords, i.e. if x has a class attribute equal to coords
.
basis
x <- read.pdb(system.file("examples/PCBM_ODCB.pdb",package="Rpdb"))
is.coords(x)
is.coords(x$atoms)
## Replace the coordinates of x by translated coordinates
coords(x) <- coords(Tz(x, 10))
coords(x)
Run the code above in your browser using DataLab