Title: | Load and Save Ranges-related Artifacts from File |
---|---|
Description: | Save GenomicRanges, IRanges and related data structures into file artifacts, and load them back into memory. This is a more portable alternative to serialization of such objects into RDS files. Each artifact is associated with metadata for further interpretation; downstream applications can enrich this metadata with context-specific properties. |
Authors: | Aaron Lun [aut, cre] |
Maintainer: | Aaron Lun <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.5.2 |
Built: | 2024-07-23 02:42:38 UTC |
Source: | https://github.com/bioc/alabaster.ranges |
Load a list of atomic vectors as a CompressedAtomicList from its on-disk representation.
This is usually not directly called by users, but is instead called by dispatch in readObject
.
readAtomicVectorList(path, metadata, ...)
readAtomicVectorList(path, metadata, ...)
path |
String containing a path to a directory, itself created with the |
metadata |
Named list of metadata for this object, see |
... |
Further arguments, to be passed to internal |
A CompressedAtomicList of the relevant type.
Aaron Lun
"saveObject,CompressedAtomicList-method"
, to save an object to disk.
library(S4Vectors) X <- splitAsList(LETTERS, sample(3, 26, replace=TRUE)) tmp <- tempfile() saveObject(X, tmp) readObject(tmp)
library(S4Vectors) X <- splitAsList(LETTERS, sample(3, 26, replace=TRUE)) tmp <- tempfile() saveObject(X, tmp) readObject(tmp)
Load a list of data frames as a CompressedSplitDataFrameList from its on-disk representation.
This is usually not directly called by users, but is instead called by dispatch in readObject
.
readDataFrameList(path, metadata, ...)
readDataFrameList(path, metadata, ...)
path |
String containing a path to a directory, itself created with the |
metadata |
Named list of metadata for this object, see |
... |
Further arguments, to be passed to internal |
A CompressedSplitDataFrameList.
Aaron Lun
"saveObject,CompressedSplitDataFrameList-method"
, to save an object to disk.
library(S4Vectors) Y <- splitAsList(DataFrame(Xxx=LETTERS, Yyy=1:26), sample(3, 26, replace=TRUE)) tmp <- tempfile() saveObject(Y, tmp) readObject(tmp)
library(S4Vectors) Y <- splitAsList(DataFrame(Xxx=LETTERS, Yyy=1:26), sample(3, 26, replace=TRUE)) tmp <- tempfile() saveObject(Y, tmp) readObject(tmp)
Read a GRanges object from its on-disk representation.
This is usually not directly called by users, but is instead called by dispatch in readObject
.
readGRanges(path, metadata, ...)
readGRanges(path, metadata, ...)
path |
String containing a path to a directory, itself created with the |
metadata |
Named list of metadata for this object, see |
... |
Further arguments to pass to internal |
A GRanges object.
Aaron Lun
"saveObject,GRanges-method"
, to save a GRanges to disk.
gr <- GRanges(c("chrA", "chrB"), IRanges(c(1, 5), c(100, 200))) seqlengths(gr) <- c(chrA=1000, chrB=2000) tmp <- tempfile() saveObject(gr, tmp) readObject(tmp)
gr <- GRanges(c("chrA", "chrB"), IRanges(c(1, 5), c(100, 200))) seqlengths(gr) <- c(chrA=1000, chrB=2000) tmp <- tempfile() saveObject(gr, tmp) readObject(tmp)
Read a GRangesList object from its on-disk representation.
readGRangesList(path, metadata, ...)
readGRangesList(path, metadata, ...)
path |
String containing a path to a directory, itself created with the |
metadata |
Named list of metadata for this object, see |
... |
Further arguments, to be passed to internal |
A GRangesList object.
gr <- GRanges(c("chrA", "chrB"), IRanges(c(1, 5), c(100, 200))) seqlengths(gr) <- c(chrA=1000, chrB=2000) grl <- split(gr, rep(1:3, length.out=length(gr))) tmp <- tempfile() saveObject(grl, tmp) readObject(tmp)
gr <- GRanges(c("chrA", "chrB"), IRanges(c(1, 5), c(100, 200))) seqlengths(gr) <- c(chrA=1000, chrB=2000) grl <- split(gr, rep(1:3, length.out=length(gr))) tmp <- tempfile() saveObject(grl, tmp) readObject(tmp)
Read a Seqinfo object from its on-disk representation.
This is usually not directly called by users, but is instead called by dispatch in readObject
.
readSeqinfo(path, metadata, ...)
readSeqinfo(path, metadata, ...)
path |
String containing a path to a directory, itself created with the |
metadata |
Named list of metadata for this object, see |
... |
Further arguments, ignored. |
A Seqinfo object.
"saveObject,Seqinfo-method"
for the corresponding saving method.
si <- Seqinfo(c("chrA", "chrB"), c(1000, 2000)) tmp <- tempfile() saveObject(si, tmp) readObject(tmp)
si <- Seqinfo(c("chrA", "chrB"), c(1000, 2000)) tmp <- tempfile() saveObject(si, tmp) readObject(tmp)
Save a CompressedAtomicList object to its on-disk representation.
## S4 method for signature 'CompressedAtomicList' saveObject(x, path, ...)
## S4 method for signature 'CompressedAtomicList' saveObject(x, path, ...)
x |
A CompressedAtomicList object. |
path |
String containing the path to a directory in which to save |
... |
Further arguments to pass to specific methods. |
x
is saved to path
, and NULL
is invisibly returned.
Aaron Lun
readAtomicVectorList
, to read a CompressedAtomicList from disk.
library(S4Vectors) X <- splitAsList(LETTERS, sample(3, 26, replace=TRUE)) tmp <- tempfile() saveObject(X, tmp) list.files(tmp, recursive=TRUE)
library(S4Vectors) X <- splitAsList(LETTERS, sample(3, 26, replace=TRUE)) tmp <- tempfile() saveObject(X, tmp) list.files(tmp, recursive=TRUE)
Save a CompressedSplitDataFrameList object to its on-disk representation.
## S4 method for signature 'CompressedSplitDataFrameList' saveObject(x, path, ...)
## S4 method for signature 'CompressedSplitDataFrameList' saveObject(x, path, ...)
x |
A CompressedSplitDataFrameList object. |
path |
String containing the path to a directory in which to save |
... |
Further arguments to pass to specific methods. |
x
is saved to path
, and NULL
is invisibly returned.
Aaron Lun
readDataFrameList
, to read a CompressedSplitDataFrameList from disk.
library(S4Vectors) Y <- splitAsList(DataFrame(Xxx=LETTERS, Yyy=1:26), sample(3, 26, replace=TRUE)) tmp <- tempfile() saveObject(Y, tmp) list.files(tmp, recursive=TRUE)
library(S4Vectors) Y <- splitAsList(DataFrame(Xxx=LETTERS, Yyy=1:26), sample(3, 26, replace=TRUE)) tmp <- tempfile() saveObject(Y, tmp) list.files(tmp, recursive=TRUE)
Save a GRanges object to its on-disk representation .
## S4 method for signature 'GRanges' saveObject(x, path, ...)
## S4 method for signature 'GRanges' saveObject(x, path, ...)
x |
A GRanges object or one of its subclasses. |
path |
String containing the path to a directory in which to save |
... |
Further arguments to pass to specific methods. |
x
is saved to path
, and NULL
is invisibly returned.
Aaron Lun
readGRanges
, to read a GRanges from disk.
gr <- GRanges(c("chrA", "chrB"), IRanges(c(1, 5), c(100, 200))) seqlengths(gr) <- c(chrA=1000, chrB=2000) tmp <- tempfile() saveObject(gr, tmp) list.files(tmp, recursive=TRUE)
gr <- GRanges(c("chrA", "chrB"), IRanges(c(1, 5), c(100, 200))) seqlengths(gr) <- c(chrA=1000, chrB=2000) tmp <- tempfile() saveObject(gr, tmp) list.files(tmp, recursive=TRUE)
Save a GRangesList object to its on-disk representation.
## S4 method for signature 'GRangesList' saveObject(x, path, ...)
## S4 method for signature 'GRangesList' saveObject(x, path, ...)
x |
A GRangesList object. |
path |
String containing the path to a directory in which to save |
... |
Further arguments to pass to specific methods. |
x
is saved to path
, and NULL
is invisibly returned.
Aaron Lun
readGRangesList
, to read a GRangesList from disk.
gr <- GRanges("chrA", IRanges(1:100, width=1)) grl <- split(gr, rep(1:3, length.out=length(gr))) tmp <- tempfile() saveObject(grl, tmp) list.files(tmp, recursive=TRUE)
gr <- GRanges("chrA", IRanges(1:100, width=1)) grl <- split(gr, rep(1:3, length.out=length(gr))) tmp <- tempfile() saveObject(grl, tmp) list.files(tmp, recursive=TRUE)
Save a Seqinfo object to its on-disk representation.
## S4 method for signature 'Seqinfo' saveObject(x, path, ...)
## S4 method for signature 'Seqinfo' saveObject(x, path, ...)
x |
A Seqinfo object. |
path |
String containing the path to a directory in which to save |
... |
Further arguments to pass to specific methods. |
x
is saved to path
, and NULL
is invisibly returned.
readSeqinfo
, to read a Seqinfo from disk.
si <- Seqinfo(c("chrA", "chrB"), c(1000, 2000)) tmp <- tempfile() dir.create(tmp) saveObject(si, tmp, path="seqinfo") list.files(tmp, recursive=TRUE)
si <- Seqinfo(c("chrA", "chrB"), c(1000, 2000)) tmp <- tempfile() dir.create(tmp) saveObject(si, tmp, path="seqinfo") list.files(tmp, recursive=TRUE)