This function generates necessary genotype count formats for BayEnv and BayPass with a subset of SNPs
Usage
gt.format(
gt,
info,
format = c("benv", "bpass"),
snp.subset = NULL,
parallel = FALSE
)Arguments
- gt
multi-vector. an imported data.frame of genotypes or genotype data frame generated by
hetTgenor path to GT.FORMAT file generated from VCFTools- info
a data frame containing sample and population information. It must have “sample” and “population” columns
- format
character. output format i.e., for BayPass or BayEnv
- snp.subset
numerical. number of randomly selected subsets of SNPs.
default = NULL- parallel
logical. whether to parallelize the process
Value
Returns a list with formatted genotype data: $bayenv - snps
in horizontal format - for BayEnv (two lines per snp); $baypass - vertical format - for BayPass
(two column per snp); $sub.bp - subsets snps for BayPass $sub.be - subsets of snps for BayEnv
Examples
if (FALSE) vcf.file.path <- paste0(path.package("rCNV"), "/example.raw.vcf.gz")
vcf <- readVCF(vcf.file.path=vcf.file.path)
het.table<-hetTgen(vcf,"GT")
#> generating table
#>
|
| | 0%
|
|===== | 10%
|
|========== | 20%
|
|=============== | 30%
|
|==================== | 40%
|
|========================= | 50%
|
|============================== | 60%
|
|=================================== | 70%
|
|======================================== | 80%
|
|============================================= | 90%
|
|==================================================| 100%
info<-unique(substr(colnames(het.table)[-c(1:3)],1,8))
GT<-gt.format(het.table,info) # \dontrun{}
#> Formating BayEnv
#>
|
| | 0%
|
|===== | 10%
|
|========== | 20%
|
|=============== | 30%
|
|==================== | 40%
|
|========================= | 50%
|
|============================== | 60%
|
|=================================== | 70%
|
|======================================== | 80%
|
|============================================= | 90%
|
|==================================================| 100%
#> Formating BayPass
#>
|
| | 0%
|
|===== | 10%
|
|========== | 20%
|
|=============== | 30%
|
|==================== | 40%
|
|========================= | 50%
|
|============================== | 60%
|
|=================================== | 70%
|
|======================================== | 80%
|
|============================================= | 90%
|
|==================================================| 100%
