openfn.gds | R Documentation |
Open an existing file of CoreArray Genomic Data Structure (GDS) for reading or writing.
openfn.gds(filename, readonly=TRUE, allow.duplicate=FALSE, allow.fork=FALSE,
allow.error=FALSE, use.abspath=TRUE)
filename |
the file name of a GDS file to be opened |
readonly |
if |
allow.duplicate |
if |
allow.fork |
|
allow.error |
|
use.abspath |
if |
This function opens an existing GDS file for reading (or, if
readonly=FALSE
, for writing). To create a new GDS file, use
createfn.gds
instead.
If the file is opened read-only, all data in the file are not allowed to be changed, including hierachical structure, variable names, data fields, etc.
mclapply
and mcmapply
in
the R package parallel
rely on unix forking. However, the forked child
process inherits copies of the parent's set of open file descriptors. Each
file descriptor in the child refers to the same open file description as the
corresponding file descriptor in the parent. This means that the two
descriptors share open file status flags, current file offset, and
signal-driven I/O attributes. The sharing of file description can cause a
serious problem (wrong reading, even program crashes), when child processes
read or write the same GDS file simultaneously.
allow.fork=TRUE
adds additional file operations to avoid any
conflict using forking. The current implementation does not support writing
in forked processes.
Return an object of class gds.class
.
filename |
the file name to be created |
id |
internal file id, an integer |
root |
an object of class |
readonly |
whether it is read-only or not |
Xiuwen Zheng
createfn.gds
, closefn.gds
# cteate a GDS file
f <- createfn.gds("test.gds")
# add a list to "test.gds"
node <- add.gdsn(f, name="list", val=list(x=c(1,2), y=c("T","B","C"), z=TRUE))
# close
closefn.gds(f)
# open the same file
f <- openfn.gds("test.gds")
# read
(node <- index.gdsn(f, "list"))
read.gdsn(node)
# close the GDS file
closefn.gds(f)
# delete the temporary file
unlink("test.gds", force=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.