gbsrGDS2VCF: Write a VCF file based on data in a GDS file

gbsrGDS2VCFR Documentation

Write a VCF file based on data in a GDS file

Description

Write out a VCF file with raw, filtered, or corrected genotype data stored in a GDS file. The output VCF file contains the GT, AD, and DP fields.

Usage

gbsrGDS2VCF(
  object,
  out_fn,
  node = "raw",
  info.export = NULL,
  fmt.export = NULL,
  parents = TRUE,
  ...
)

## S4 method for signature 'GbsrGenotypeData'
gbsrGDS2VCF(object, out_fn, node, info.export, fmt.export, parents)

Arguments

object

A GbsrGenotypeData object.

out_fn

A string to specify the path to an output VCF file.

node

Either one of "raw" or "cor" to output raw genotype data or corrected genotype data, respectively.

info.export

characters, the variable name(s) in the INFO node for export; or NULL for all variables. If you specify character(0), nothing will be exported from the INFO node.

fmt.export

characters, the variable name(s) in the FORMAT node for import; or NULL for all variables. If you specify character(0), nothing will be exported from the FORMAT node, except for GT.

parents

A logical value to specify whether parental samples should be included in an output VCF file or not.

...

Unused.

Details

Create a VCF file at location specified by out_fn. The connection to the GDS file of the input GbsrGenotypeData object will be automatically closed for internal file handling in this function. Please use reopenGDS() to open the connection again. If you use loadGDS(), summary statistics and filtering information will be discarded.

Value

The path to the VCF file.

Examples

# Load data in the GDS file and instantiate a [GbsrGenotypeData] object.
gds_fn <- system.file("extdata", "sample.gds", package = "GBScleanR")
gds <- loadGDS(gds_fn)

# Create a VCF file with data from the GDS file
#  connected to the [GbsrGenotypeData] oobject.
out_fn <- tempfile("sample_out", fileext = ".vcf.gz")
# gbsrGDS2VCF(gds, out_fn)

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


tomoyukif/GBScleanR documentation built on Oct. 15, 2024, 4:19 p.m.