File: test_vcfFields.R

package info (click to toggle)
r-bioc-variantannotation 1.52.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,372 kB
  • sloc: ansic: 1,357; makefile: 2
file content (39 lines) | stat: -rw-r--r-- 1,072 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
test_vcfFields <- function(){
    ## invalid
    checkException(vcfFields(NA_character_), silent = TRUE)
    checkException(vcfFields(tempfile()), silent = TRUE)

    ## empty
    target <- CharacterList(
        fixed = character(), info = character(), geno = character(),
        samples = character()
    )
    checkIdentical(target, vcfFields())

    ## structure
    fl <- system.file("extdata", "ex2.vcf", package="VariantAnnotation")
    flds <- vcfFields(fl)

    checkTrue(validObject(flds))
    checkTrue(is(flds, "CharacterList"))
    target <- c(fixed = 4L, info = 6L, geno = 4L, samples = 3L)
    checkIdentical(target, lengths(flds))

    ## signatures
    hdr <- scanVcfHeader(fl)
    flds.hdr <- vcfFields(hdr)

    vf <- VcfFile(fl)
    flds.vf <- vcfFields(vf)

    vcf <- readVcf(fl, genome = "hg19")
    flds.vcf <- vcfFields(vcf)
    
    checkIdentical(flds, flds.hdr)
    checkIdentical(flds, flds.vf)
    checkIdentical(flds, flds.vcf)

    ## VCFFileList
    vfl <- VcfFileList(c(fl, fl))
    checkIdentical(vcfFields(vfl[[1]]), vcfFields(vfl))
}