reopen.rtmsBrukerMCFReader {rtms} | R Documentation |
Manage an MCF reader file connection
Description
Closes the open connection to the main data file in a Bruker MCF reader object.
Usage
## S3 method for class 'rtmsBrukerMCFReader'
reopen(x, ...)
## S3 method for class 'rtmsBrukerMCFReader'
close(con, ...)
closeBrukerMCFReader(reader)
reopenBrukerMCFReader(reader)
Arguments
x |
The reader object to reopen |
... |
Included for S3 compatibility |
con |
The reader object to be closed |
reader |
An RTMS reader object of class |
Details
Because Bruker MCF directories contain a potentially large number of
spectra, reopening a connection to the main data file when reading many
spectra or samples from it is inefficient and slow, especially if the file
is being accessed over a network connection. The rtmsBrukerMCFReader
object therefore maintains an open connection to the main binary data file
until it is closed by the user. Of course, the reader object still maintains
all the index and calibration data, making it possible to reopen a
connection to the MCF directory without all the preprocessing required when
first opening. Unfortunately, taking advantage of this fact is a little
tricky.
In most cases, R is a functional language, with limited side effects on R
objects; so it is difficult to alter the state of reader object without
returning it explicitly. However, one of the few cases where side-effects
are quite important is R's management of open file connections, with
functions like close
. Thus, calling closeBrukerMCFReader
(and the S3
function close
which wraps it) will in fact close the connection, but will
not return an altered copy of the reader object reflecting that it is
closed. So if the user wishes to close a reader object with the possibility
of reopening it, they must close the reader AND assign the returned reader
object to the relevant name. This will store the fact the connection has
been closed, and allow the reopen
function to operate correctly.
Value
The same reader object with a closed connection
Functions
-
reopen(rtmsBrukerMCFReader)
: The S3 methodclose
for objects of classrtmsBrukerMCFReader
; callscloseBrukerMCFReader
-
close(rtmsBrukerMCFReader)
: The S3 methodreopen
for objects of classrtmsBrukerMCFReader
; callsreopenBrukerMCFReader
-
reopenBrukerMCFReader()
: Reopens a file connection to the main binary data file in a Bruker MCF directgry so that data can be extracted