plotInfo-methods: Plot an INFO metric on a genomic axis.

Description Usage Arguments Value Author(s) See Also Examples

Description

Plot, on a genomic axis, a metric calculated in levels of a given phenotype, and stored in columns of the info slot of a VCF object.

Usage

1
2
3
4
## S4 method for signature 'VCF'
plotInfo(
    vcf, metric, range, annotation, phenotype, type = c("p", "heatmap"),
    zero.rm = FALSE)

Arguments

vcf

VCF object.

metric

Metric to plot on the Y axis. All columns in the info slot of hte vcf object that match the pattern "phenotype_(.*)_metric" are plotted in the DataTrack. An error is thrown if no such column is found.

range

A GRanges of length one that defines the region to visualise. All variants in the vcf object overlapping this region are plotted.

annotation

An EnsDb annotation package from which to fetch gene annotations. TxDb packages may be supported in the future.

phenotype

Column in the phenoData slot of the vcf object. Levels of this phenotype are plotted and contrasted in the DataTrack. See argument metric for details.

type

Plotting type(s), as listed in DataTrack.

zero.rm

If TRUE, values equal to 0 are not displayed in the DataTrack.

Value

list returned by the plotTracks method.

Author(s)

Kevin Rue-Albrecht

See Also

plotTracks, addPhenoLevelFrequencies,ExpandedVCF-method, and VCF.

Examples

 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
# Example data ----

# VCF file
vcfFile <- system.file("extdata", "moderate.vcf", package = "TVTB")

# Phenotype file
phenoFile <- system.file("extdata", "moderate_pheno.txt", package = "TVTB")
phenotypes <- S4Vectors::DataFrame(read.table(phenoFile, TRUE, row.names = 1))

# TVTB parameters
tparam <- TVTBparam(Genotypes("0|0", c("0|1", "1|0"), "1|1"))

# Pre-process variants
vcf <- VariantAnnotation::readVcf(
    vcfFile, param = tparam, colData = phenotypes)
vcf <- VariantAnnotation::expand(vcf, row.names = TRUE)
vcf <- addFrequencies(vcf, "super_pop")

# Example usage ----

if (requireNamespace("EnsDb.Hsapiens.v75")){
    plotInfo(
        vcf, "MAF",
        range(GenomicRanges::granges(vcf)),
        EnsDb.Hsapiens.v75::EnsDb.Hsapiens.v75,
        "super_pop"
    )
}

TVTB documentation built on Nov. 8, 2020, 6:09 p.m.