fl <- system.file("extdata", "ex2.vcf", package="VariantAnnotation")
## ---------------------------------------------------------------------
## VCF objects
## ---------------------------------------------------------------------
vcf <- readVcf(fl, "hg19")
DataFrame(ref(vcf), alt(vcf))
## This vcf has transitions in row 2 and 3. When 'singleAltOnly=TRUE'
## only the row 2 variant is identified:
isTransition(vcf)
## Both row 2 and 3 are identified when 'singleAltOnly=FALSE':
isTransition(vcf, singleAltOnly=FALSE)
## Expand the CollapsedVCF to ExpandedVCF
evcf <- expand(vcf)
## All ref / alt pairs are now expanded and there is no need to
## use 'singleAltOnly'. The return length is now 7 instead of 5:
transition <- isTransition(evcf)
transition
DataFrame(ref(evcf)[transition], alt(evcf)[transition])
## ---------------------------------------------------------------------
## VRanges objects
## ---------------------------------------------------------------------
## A VRanges object holds data from a VCF class in a completely
## 'flat' fashion. INFO and FORMAT variables for all subjects are
## 'repped' out such that each row is a unique combination of data.
vr <- as(vcf, "VRanges")
isSNV(vr, singleAltOnly=FALSE)
Run the code above in your browser using DataLab