acquireGDS: Acquire the GDS file connection in R in the 'gds.class'...

View source: R/acquireGDS.R

acquireGDSR Documentation

Acquire the GDS file connection in R in the gds.class class.

Description

Acquire a (possibly cached) gds.class object given it's path.

Usage

acquireGDS(path, type = NULL, ...)

releaseGDS(path, type = NULL, ...)

Arguments

path

String containing a path to a GDS file.

type

String containing the GDS file type. Case insensitive. Can be "seqgds" for a GDS file with sequencing data, or "snpgds" for a GDS file with SNP data. This argument was added for the VariantExperiment package for certain functionalities. By default is NULL, which returns a regular gds.class.

other

arguments to be passed to openfn.gds() inside acquireGDS.

Details

acquireConn will cache the gds.class object in the current R session to avoid repeated initialization. This improves efficiency for repeated calls. The cached gds.class object for any given path can be deleted by calling releaseGDS for the same path.

Value

For acquireGDS, by default returns a regular gds.class object, which are identical to that returned by gdsfmt::openfn.gds(path). If type is not NULL, a SeqVarGDSClass that is identical to SeqArray::seqOPen(path), or SNPGDSFileClass that is identical to SNPRelate::snpgdsOpen(path). Both are inherited from gds.class but with additional checking and methods.

For releaseGDS, any existing gds.class object for the path is disconnected and cleared from cache, and NULL is invisibly returned. This is equivalent to that returned by gdsfmt::closefn.gds() except it take path as input. If path=NULL, all cached connections are removed.

Author(s)

Qian Liu

Examples

fn <- gdsExampleFileName()
gdscon <- acquireGDS(fn)
acquireGDS(fn)  ## just re-uses the cache
acquireGDS(fn, type = "seqgds") ## construct a new GDS connection 
releaseGDS(fn)  ## clears the cache


Bioconductor/GDSArray documentation built on May 5, 2024, 9:32 a.m.