R/read_samples_from_vcf.R

Defines functions read_samples_from_vcf

Documented in read_samples_from_vcf

# Start of read_samples_from_vcf.R

# read_samples_from_vcf
#' Read sample IDs from a VCF file.
#'
#' @param file A VCF file path.
#'
#' @return Vector of the sample IDs in the given VCF file.
#'
#' @export
#' @rdname read_samples_from_vcf
read_samples_from_vcf <- function(file) {
    stopifnot( is_single_string(file) )
    stopifnot( file.exists(file) )
    header <- VariantAnnotation::scanVcfHeader(file)
    return( VariantAnnotation::samples(header) )
}

# End of read_samples_from_vcf.R
gact/utl documentation built on June 1, 2021, 4:24 p.m.