/usr/lib/R/site-library/VariantAnnotation/unitTests/test_expand-methods.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 | expand <- VariantAnnotation::expand
test_expand_info_geno <- function()
{
fl <- system.file("unitTests", "cases", "expand.vcf",
package="VariantAnnotation")
vcf <- suppressWarnings(readVcf(fl, "hg19"))
exp <- expand(vcf)
names(mcols(rowRanges(exp)))
cnms <- c("paramRangeID", "REF", "ALT", "QUAL", "FILTER")
checkIdentical(cnms, names(mcols(rowRanges(exp))))
checkTrue(nrow(exp) == 22L)
checkIdentical(info(exp)$DP[5:6], c(10L, 10L))
checkIdentical(info(exp)$AF[5:6], c(0.333, 0.667))
checkIdentical(geno(exp)$AAP[6:11], c(2L, rep(1L, 4L), 3L))
}
test_expand_structural <- function()
{
fl <- system.file("extdata", "structural.vcf", package="VariantAnnotation")
vcf <- readVcf(fl, "hg19")
exp <- expand(vcf)
checkTrue(nrow(vcf) == nrow(exp))
checkTrue(ncol(vcf) == ncol(exp))
checkTrue(is.character(alt(exp)))
}
test_expand_structural <- function()
{
fl <- system.file("unitTests", "cases", "mixedStructural.vcf",
package="VariantAnnotation")
vcf <- readVcf(fl, "hg19")
exp <- expand(vcf)
checkTrue(nrow(exp) == 8L)
}
test_expand_multiple_info <- function()
{
fl <- system.file("unitTests", "cases", "multiple_INFO_fields.vcf",
package="VariantAnnotation")
vcf <- readVcf(fl, "GRCh37")
exp <- expand(vcf)
checkTrue(nrow(exp) == 3L)
## single row, subset of INFO fields selected
exp <- expand(vcf[1,])
checkTrue(nrow(exp) == 2L)
## single row, single (only) INFO field selected
vcf <- readVcf(fl, "GRCh37", param=ScanVcfParam(info="AF"))
exp <- expand(vcf[1,])
checkTrue(nrow(exp) == 2L)
}
test_expand_gvcf <- function()
{
fl <- system.file("unitTests", "cases", "banded_gvcf.vcf",
package="VariantAnnotation")
vcf <- suppressWarnings(readVcf(fl, ""))
exp <- expand(vcf)
checkIdentical(dim(exp), c(7L, 1L))
checkIdentical(dim(geno(exp)$AD), c(7L, 1L, 2L))
checkIdentical(geno(exp)$AD[,,1], as.integer(c(NA, 17, 17, NA, 20, 20, NA)))
}
|