Create `population` and `SNPinfo` objects from VCF file
Arguments
- file
path of a `.vcf` or `.vcf.gz` file.
- specie
[specie class] Specie of the population (see:specie), if this parameter is not provided the function will create one based on the information in the VCF file. See details section for more information.
- verbose
If TRUE, display information on the function progress
Value
list of 3 elements `pop` of class `population`, `snps` of class `snpInfo` and `specie` of class specie
Details
If `specie` is not provided, the function will create one based on the information in the VCF file. The number of chromosome will be set to the number of differents chromosome in the VCF file, the names of the chromosomes will be set the the unique values of the column `CHROM` of the VCF file, the physical length of each chromosome will equal to the highest physical position of the chromosome's markers, the length of chromosomes in centimorgans will be set to 1cm per Mega Base.
Examples
if (FALSE) {
# create vcf.gz file
mySpec <- specie$new(nChr = 10,
lchr = 10^6,
lchrCm = 100,
specName = "Geneticae Exempli")
SNPs <- SNPinfo$new(SNPcoord = exampleData$snpCoord,
specie = mySpec)
example_pop <- createPop(geno = exampleData$genotypes,
SNPinfo = SNPs,
popName = "Example population")
vcfFile <- tempfile(fileext = "vcf.gz")
example_pop$writeVcf(vcfFile)
# read vcf file
x <- readVCF(file = vcfFile , verbose = TRUE)
print(x$pop)
print(x$snps)
print(x$specie)
}