Last data update: 2014.03.03
R: Class 'VariantInfo'
VariantInfo-class R Documentation
Class VariantInfo
Description
S4 class for storing information about variants
Details
This class extends the class GRanges
without
adding any extra slots. The main difference is that VariantInfo
objects always have a metadata column “MAF” that contains
minor allele frequencies (MAFs). A special
summary
method allows for computing statistics about
MAFs and types of variants.
Objects of this class should only be created and manipulated by the
constructors and accessors described below, as only these methods ensure the
integrity of the created objects. Direct modification of object slots
is strongly discouraged!
Constructors
variantInfo signature(x="missing")
:
creates an empty VariantInfo
object
variantInfo signature(x="GRanges")
:
coerces a GRanges
object to class
VariantInfo
by adding a “MAF” metadata column that
is initialized with NA
values.
Furthermore, see the help page of readVariantInfo
.
Accessors
MAF signature(object="VariantInfo")
:
returns a numeric vector with the minor allele frequencies (MAFs).
Methods
summary signature(object="VariantInfo")
:
computes and prints a summary about the MAFs and variant types
(if available); this method returns a list with summarized values.
All other methods, including sub-setting, are inherited from the
GRanges
class.
Author(s)
Ulrich Bodenhofer bodenhofer@bioinf.jku.at
References
http://www.bioinf.jku.at/software/podkat
See Also
GRanges
, readVariantInfo
,
genotypeMatrix
, readGenotypeMatrix
Examples
vcfFile <- system.file("examples/example1.vcf.gz", package="podkat")
## read variant info directly from VCF file
vInfo <- readVariantInfo(vcfFile, omitZeroMAF=FALSE)
vInfo
summary(vInfo)
## read full genotype from VCF file
geno <- readGenotypeMatrix(vcfFile)
## display summary of variant info stored in genotype matrix
summary(variantInfo(geno))
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(podkat)
Loading required package: Rsamtools
Loading required package: GenomeInfoDb
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: parallel
Attaching package: 'BiocGenerics'
The following objects are masked from 'package:parallel':
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from 'package:stats':
IQR, mad, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
rbind, rownames, sapply, setdiff, sort, table, tapply, union,
unique, unsplit
Loading required package: S4Vectors
Attaching package: 'S4Vectors'
The following objects are masked from 'package:base':
colMeans, colSums, expand.grid, rowMeans, rowSums
Loading required package: IRanges
Loading required package: GenomicRanges
Loading required package: Biostrings
Loading required package: XVector
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/podkat/VariantInfo-class.Rd_%03d_medium.png", width=480, height=480)
> ### Name: VariantInfo-class
> ### Title: Class 'VariantInfo'
> ### Aliases: VariantInfo-class class:VariantInfo VariantInfo variantInfo
> ### variantInfo,missing-method variantInfo,GRanges-method MAF
> ### MAF,VariantInfo-method show,VariantInfo-method
> ### summary,VariantInfo-method
> ### Keywords: classes
>
> ### ** Examples
>
> vcfFile <- system.file("examples/example1.vcf.gz", package="podkat")
>
> ## read variant info directly from VCF file
> vInfo <- readVariantInfo(vcfFile, omitZeroMAF=FALSE)
> vInfo
VariantInfo object with 3117 ranges and 2 metadata columns:
seqnames ranges strand | type MAF
<Rle> <IRanges> <Rle> | <factor> <numeric>
snv:1 chr1 [ 79, 79] * | TRANSITION 0.0000
snv:2 chr1 [281, 281] * | TRANSVERSION 0.0000
snv:6 chr1 [428, 428] * | TRANSVERSION 0.1025
snv:7 chr1 [501, 501] * | TRANSITION 0.0900
snv:8 chr1 [536, 536] * | TRANSVERSION 0.0000
... ... ... ... . ... ...
snv:3840 chr1 [199676, 199676] * | TRANSVERSION 0.2500
snv:3842 chr1 [199696, 199696] * | TRANSVERSION 0.0025
snv:3843 chr1 [199812, 199812] * | TRANSVERSION 0.0025
snv:3844 chr1 [199879, 199879] * | TRANSVERSION 0.0025
snv:3845 chr1 [199956, 199956] * | TRANSVERSION 0.0000
-------
seqinfo: 1 sequence from an unspecified genome; no seqlengths
> summary(vInfo)
Variant info:
Number of variants: 3117
Mean MAF: 0.01751203
Median MAF: 0
Minimum MAF: 0
Maximum MAF: 0.455
INDEL: 0 ( 0.0%)
MULTIPLE: 0 ( 0.0%)
TRANSITION: 1098 (35.2%)
TRANSVERSION: 2019 (64.8%)
UNKNOWN: 0 ( 0.0%)
>
> ## read full genotype from VCF file
> geno <- readGenotypeMatrix(vcfFile)
>
> ## display summary of variant info stored in genotype matrix
> summary(variantInfo(geno))
Variant info:
Number of variants: 962
Mean MAF: 0.05674116
Median MAF: 0.0075
Minimum MAF: 0.0025
Maximum MAF: 0.455
no metadata column 'type' available
>
>
>
>
>
> dev.off()
null device
1
>