Learn R Programming

GWASTools (version 1.12.2)

ncdfSubset: Write a subset of data in a netCDF file to a new netCDF file

Description

ncdfSubset takes a subset of data (snps and samples) from a netCDF file and write it to a new netCDF file. ncdfSubsetCheck checks that a netCDF file is the desired subset of another netCDF file.

Usage

ncdfSubset(parent.ncdf, sub.ncdf, sample.include=NULL, snp.include=NULL, verbose=TRUE)
ncdfSubsetCheck(parent.ncdf, sub.ncdf, sample.include=NULL, snp.include=NULL, verbose=TRUE)

Arguments

parent.ncdf
Name of the parent netCDF file
sub.ncdf
Name of the subset netCDF file
sample.include
Vector of sampleIDs to include in sub.ncdf
snp.include
Vector of snpIDs to include in sub.ncdf
verbose
Logical value specifying whether to show progress information.

Details

ncdfSubset can select a subset of snps for all samples by setting snp.include, a subset of samples for all snps by setting sample.include, or a subset of snps and samples with both arguments.

See Also

ncdf, createDataFile

Examples

Run this code
ncfile <- system.file("extdata", "affy_geno.nc", package="GWASdata")
nc <- NcdfGenotypeReader(ncfile)
sample.sel <- getScanID(nc, index=1:10)
snp.sel <- getSnpID(nc, index=1:100)
close(nc)

subnc <- tempfile()
ncdfSubset(ncfile, subnc, sample.include=sample.sel, snp.include=snp.sel)
ncdfSubsetCheck(ncfile, subnc, sample.include=sample.sel, snp.include=snp.sel)
file.remove(subnc)

Run the code above in your browser using DataLab