Learn R Programming

GWASTools (version 1.18.0)

convertNcdfGds: Convert between NetCDF and GDS format

Description

convertNcdfGds converts a NetCDF file to GDS format.

convertGdsNcdf converts a GDS file to NetCDF format.

checkNcdfGds checks whether a genotype NetCDF file and a GDS file contain identical data.

Usage

convertNcdfGds(ncdf.filename, gds.filename, snp.annot = NULL, precision = "single", compress = "ZIP_RA", verbose = TRUE)
convertGdsNcdf(gds.filename, ncdf.filename, precision = "single", verbose = TRUE)
checkNcdfGds(ncdf.filename, gds.filename, verbose = TRUE)

Arguments

ncdf.filename
name of the NetCDF file
gds.filename
name of the GDS file
snp.annot
a SnpAnnotationDataFrame with SNP annotation. The column named "snpName" will be written to "snp.rs.id" in the GDS file.
precision
A character value indicating whether floating point numbers should be stored as "double" or "single" precision.
compress
The compression level for variables in a GDS file (see add.gdsn for options.
verbose
whether to show progress information

Value

checkNcdfGds returns TRUE if the NetCDF and GDS files contain identical data. If the files differ, it will print a diagnostic message and return FALSE.

Details

convertNcdfGds assumes any variables other than "sampleID", "chromosome", and "position" have dimensions SNP x sample.

If snp.annot has columns "rsID", "alleleA", "alleleB", these will be stored in the GDS file as "snp.rs.id" and "snp.allele" (the latter has the format "A/B").

Chromosome codes from snp.annot (for autosomes, X, Y, etc.) will be stored in the GDS file.

convertGdsNcdf assumes any variables not starting with "snp" or "sample" have dimensions SNP x sample.

See Also

gdsfmt, ncdf4

Examples

Run this code
library(GWASdata)
ncfile <- system.file("extdata", "illumina_geno.nc", package="GWASdata")

data(illuminaSnpADF)

gdsfile <- tempfile()
convertNcdfGds(ncfile, gdsfile, snp.annot=illuminaSnpADF)

checkNcdfGds(ncfile, gdsfile)

ncfile2 <- tempfile()
convertGdsNcdf(gdsfile, ncfile2)

file.remove(gdsfile, ncfile2)

Run the code above in your browser using DataLab