Type the name of the class to see the details and methods
Fields
newConstructor given a vcf file
Parameter: vcffile - The path of a vcf file
newConstructor given a vcf file and the region
Parameter: vcffile - The path of a vcf file
Parameter: region - The region to be constrained
newConstructor given a vcf file, the region and the samples
Parameter: vcffile - The path of a vcf file
Parameter: region - The region to be constrained
Parameter: samples - The samples to be constrained. Comma separated list of samples to include (or exclude with "^" prefix).
setRegiontry to set specific region to work with. will throw errors if no index or region found. Use getStatus to check if the region is valid or empty!
getStatusreturn 1: region is valid and not empty. 0: region is valid but empty. -1: no index file. -2: region not found or invalid region form
variantTry to get next variant record. return FALSE if there are no more variants or hit the end of file, otherwise TRUE.
chrReturn the CHROM field of current variant
posReturn the POS field of current variant
idReturn the CHROM field of current variant
refReturn the REF field of current variant
altReturn the ALT field of current variant
qualReturn the QUAL field of current variant
filterReturn the FILTER field of current variant
infoReturn the INFO field of current variant
infoIntReturn the tag value of integer type in INFO field of current variant
Parameter: tag - The tag name to retrieve in INFO
infoFloatReturn the tag value of float type in INFO field of current variant
Parameter: tag - The tag name to retrieve in INFO
infoStrReturn the tag value of string type in INFO field of current variant
Parameter: tag - The tag name to retrieve in INFO
infoIntVecReturn the tag value in a vector of integer type in INFO field of current variant
Parameter: tag - The tag name to retrieve in INFO
infoFloatVecReturn the tag value in a vector of float type in INFO field of current variant
Parameter: tag - The tag name to retrieve in INFO
genotypesReturn the genotype values in a vector of integers
Parameter: collapse - Boolean value indicates wheather to collapse the size of genotypes, eg, return diploid genotypes.
formatIntReturn the tag value of integer type for each sample in FORAMT field of current variant
Parameter: tag - The tag name to retrieve in FORAMT
formatFloatReturn the tag value of float type for each sample in FORAMT field of current variant
Parameter: tag - The tag name to retrieve in FORAMT
formatStrReturn the tag value of string type for each sample in FORAMT field of current variant
Parameter: tag - The tag name to retrieve in FORAMT
isSNPTest if current variant is exculsively a SNP or not
isIndelTest if current variant is exculsively a INDEL or not
isSVTest if current variant is exculsively a SV or not
isMultiAllelicsTest if current variant is exculsively a Multi Allelics or not
isMultiAllelicSNPTest if current variant is exculsively a Multi Biallelics (SNPs) or not
hasSNPTest if current variant has a SNP or not
hasINDELTest if current variant has a INDEL or not
hasINSTest if current variant has a INS or not
hasDELTest if current variant has a DEL or not
hasMNPTest if current variant has a MNP or not
hasBNDTest if current variant has a BND or not
hasOTHERTest if current variant has a OTHER or not
hasOVERLAPTest if current variant has a OVERLAP or not
nsamplesReturn the number of samples
samplesReturn a vector of samples id
headerReturn the raw string of the vcf header
stringReturn the raw string of current variant including newline
lineReturn the raw string of current variant without newline
outputInit an output object for streaming out the variants to another vcf
updateSamplesupdate samples name in the output VCF
Parameter: s - A comma-seperated string for new samples names
writeStreaming out current variant the output vcf
closeClose the connection to the output vcf
setCHRModify the CHR of current variant
Parameter: s - A string for CHR
setIDModify the ID of current variant
Parameter: s - A string for ID
setPOSModify the POS of current variant
Parameter: pos - An integer for POS
setRefAltModify the REF and ALT of current variant
Parameter: s - A string reperated by comma
setInfoIntModify the given tag of INT type in the INFO of current variant
Parameter: tag - A string for the tag name
Parameter: v - An integer for the tag value
setInfoFloatModify the given tag of FLOAT type in the INFO of current variant
Parameter: tag - A string for the tag name
Parameter: v - A double for the tag value
setInfoStrModify the given tag of STRING type in the INFO of current variant
Parameter: tag - A string for the tag name
Parameter: s - A string for the tag value
setPhasingModify the phasing status of each sample
Parameter: v - An integer vector with size of the number of samples. only 1s and 0s are valid.
setGenotypesModify the genotypes of current variant
Parameter: v - An integer vector for genotypes. Use NA or -9 for missing value.
setFormatIntModify the given tag of INT type in the FORMAT of current variant
Parameter: tag - A string for the tag name
Parameter: v - An integer for the tag value
setFormatFloatModify the given tag of FLOAT type in the FORMAT of current variant
Parameter: tag - A string for the tag name
Parameter: v - A double for the tag value
setFormatStrModify the given tag of STRING type in the FORMAT of current variant
Parameter: tag - A string for the tag name
Parameter: s - A string for the tag value
rmInfoTagRemove the given tag from the INFO of current variant
Parameter: s - A string for the tag name
rmFormatTagRemove the given tag from the FORMAT of current variant
Parameter: s - A string for the tag name
setVariantModify current variant by adding a vcf line
Parameter: s - A string for one line in the VCF
addINFOAdd a INFO in the header of the vcf
Parameter: id - A string for the tag name
Parameter: number - A string for the number
Parameter: type - A string for the type
Parameter: desc - A string for description of what it means
addFORMATAdd a FORMAT in the header of the vcf
Parameter: id - A string for the tag name
Parameter: number - A string for the number
Parameter: type - A string for the type
Parameter: desc - A string for description of what it means
Examples
vcffile <- system.file("extdata", "raw.gt.vcf.gz", package="vcfppR")
br <- vcfreader$new(vcffile)
res <- rep(0L, br$nsamples())
while(br$variant()) {
if(br$isSNP()) {
gt <- br$genotypes(TRUE) == 1
gt[is.na(gt)] <- FALSE
res <- res + gt
}
}