read_vcf {CNVgears} | R Documentation

## Convert a VCF file of genomics segments into a `data.table`

### Description

`read_vcf` read a VCF file into a `data.table`

### Usage

    read_vcf(
      DT_path,
      end_vcf = "END",
      CN_vcf = "CN",
      samples = NA,
      explore = FALSE
    )

### Arguments

`DT_path` | path to the file.
`end_vcf` | name of the field containing the segment end information.
`CN_vcf` | name of the field containing the segment copy number information.
`samples` | NA by default, if a character vector is provided is used to identify and select samples in a VCF containing multiple ones.
`explore` | logic, `FALSE` by default. If `TRUE` the file in `DT_path` is not loaded, instead, several info about the VCF fields are printed.

### Details

This function use `readVcf` from `VariantAnnotation` to read VCF files, then it select only the necessary columns (for the purpose of CNVs calling results analysis) and convert it to a `data.table`. Can also be used to check the names of the necessary fields (end and copy number) if not already known, using the parameter `explore`. By default it expect a file containing data for a single sample (e.g. the results of gCNV from GATK), but it can process files containing multiple samples if a character vector containing the IDs is given to the parameter `samples`.

### Value

a `CNVresults` from the VCF results conversion.

### Examples

    read_vcf(DT_path = system.file("extdata", "VCF_res_example.vcf", package = "CNVgears"))
    read_vcf(DT_path = system.file("extdata", "VCF_res_example.vcf", package = "CNVgears"),
    explore = TRUE)

[Package CNVgears version 1.0.0 Index]