This file is indexed.

/usr/lib/R/site-library/VariantAnnotation/unitTests/test_ScanVcfParam-class.R is in r-bioc-variantannotation 1.20.2-1+b1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
test_ScanVcfParam_which <- function()
{
    which <- RangesList(seq1=IRanges(1000, 2000), 
                        seq2=IRanges(c(100, 1000), c(1000, 2000)))
    svp <- ScanVcfParam(which=which)
    checkIdentical(which, vcfWhich(svp))
    checkException(vcfWhich(svp) <- DataFrame(), silent=TRUE)
    checkException(vcfWhich(svp) <- SimpleList(), silent=TRUE)
}

test_ScanVcfParam_fixed <- function()
{
    fx <- c("GT", "ALT")
    svp <- ScanVcfParam(fixed=fx)
    checkIdentical(fx, vcfFixed(svp))
    checkException(vcfFixed(svp) <- DataFrame(), silent=TRUE)
    checkException(vcfFixed(svp) <- 1:5, silent=TRUE)

    fx <- NA_character_
    svp <- ScanVcfParam(fixed=fx)
    checkIdentical(fx, vcfFixed(svp))
}

test_ScanVcfParam_info <- function()
{
    info <- c("NS", "DP")
    svp <- ScanVcfParam(info=info)
    checkIdentical(info, vcfInfo(svp))
    checkException(vcfInfo(svp) <- DataFrame(), silent=TRUE)
    checkException(vcfInfo(svp) <- 1:5, silent=TRUE)

    info <- NA_character_
    svp <- ScanVcfParam(info=info)
    checkIdentical(info, vcfInfo(svp))
}

test_ScanVcfParam_geno <- function()
{
    geno <- c("GT", "GQ")
    svp <- ScanVcfParam(geno=geno)
    checkIdentical(geno, vcfGeno(svp))
    checkException(vcfGeno(svp) <- DataFrame(), silent=TRUE)
    checkException(vcfGeno(svp) <- 1:5, silent=TRUE)

    geno <- NA_character_
    svp <- ScanVcfParam(geno=geno)
    checkIdentical(geno, vcfGeno(svp))
}

test_ScanVcfParam_samples <- function()
{
    samp <- c("GT", "GQ")
    svp <- ScanVcfParam(samples=samp)
    checkIdentical(samp, vcfSamples(svp))
    checkException(vcfSamples(svp) <- DataFrame(), silent=TRUE)
    checkException(vcfSamples(svp) <- 1:5, silent=TRUE)
    checkException(ScanVcfParam(geno="DP", samples=NA), silent=TRUE)
    checkException(ScanVcfParam(geno=NA, samples="foo"), silent=TRUE)
}

test_ScanVcfParam_trimEmpty <- function()
{
    svp <- ScanVcfParam()
    checkIdentical(TRUE, vcfTrimEmpty(svp))
    vcfTrimEmpty(svp) <- FALSE
    checkIdentical(FALSE, vcfTrimEmpty(svp))
    checkException(vcfTrimEmpty(svp) <- "a", silent=TRUE)
    checkException(vcfTrimEmpty(svp) <- 1:5, silent=TRUE)
    ## FIXME : should this work?
    #checkException(vcfTrimEmpty(svp) <- NA, silent=TRUE)
}

test_ScanVcfParam_GRangesList <- function()
{
  fl <- system.file("extdata", "structural.vcf", package="VariantAnnotation")
  compressVcf <- bgzip(fl, tempfile())
  idx <- indexTabix(compressVcf, "vcf")
  tab <- TabixFile(compressVcf, idx)
  gr1 <- GRanges("1", IRanges(13219, 2827695, name="regionA"))
  gr2 <- GRanges(rep("2", 2), 
      IRanges(c(321680, 14477080), c(321689, 14477090),
      name=c("regionB", "regionC")))
  grl <- GRangesList("1"=gr1, "2"=gr2)
  vcf_grl <- readVcf(tab, "hg19", grl)
  gr <- unlist(grl, use.names=FALSE)
  vcf_gr <- readVcf(tab, "hg19", gr)
  checkIdentical(rowRanges(vcf_grl), rowRanges(vcf_gr))
}