loadGDS: Load a GDS file and construct a GbsrGenotypeData object.

View source: R/AllUtilities.R

loadGDSR Documentation

Load a GDS file and construct a GbsrGenotypeData object.

Description

Load data stored in an input GDS file to R environment and create a GbsrGenotypeData instance. GBScleanR handles only one class GbsrGenotypeData and conducts all data manipulation via class methods for it.

Usage

loadGDS(x, load_filter = FALSE, ploidy = 2, verbose = TRUE)

Arguments

x

A string of the path to an input GDS file or a GbsrGenotypeData object to reload.

load_filter

A logical whether to load the filtering information made via setSamFilter() and setMarFilter() and saved in the GDS file via closeGDS() with save_filter = TRUE.

ploidy

Set the ploidy of the population.

verbose

if TRUE, show information.

Details

The first time to load a newly produced GDS file will take long time due to data reformatting for quick access. The GbsrGenotypeData object returned from loadGDS() can be also handled as SeqVarGDSClass-class of the SeqArray package.

Value

A GbsrGenotypeData object.

Examples

# Create a GDS file from a sample VCF file.
vcf_fn <- system.file("extdata", "sample.vcf", package = "GBScleanR")
gds_fn <- tempfile("sample", fileext = ".gds")
gbsrVCF2GDS(vcf_fn = vcf_fn, out_fn = gds_fn, force = TRUE)

# Load data in the GDS file and instantiate a [GbsrGenotypeData] object.
gds <- loadGDS(gds_fn)

# Reload data from the GDS file.
gds <- loadGDS(gds)

# Close the connection to the GDS file.
closeGDS(gds)


tomoyukif/GBScleanR documentation built on June 1, 2025, 10:13 p.m.