
Convert a gentibble to a .geno file for sNMF from the LEA package
Source: R/gt_as_geno_lea.R
gt_as_geno_lea.RdThis function writes a .geno file from a gen_tibble. Unless a file path
is given, a file with suffix .geno is written in the same location as the
.rds and .bk files that underpin the gen_tibble.
Arguments
Details
The genotypes are read and written directly from the file backed matrix (one locus at a time), so this function also works on datasets that do not fit in memory.
Note
the .geno format only supports haploid or diploid data, so this
function only works on diploid (or pseudohaploid) gen_tibble objects.
Pseudohaploid data is simply treated as regular diploid genotype counts
(dosage 0/2), the same convention used by other tools (e.g. PLINK).
Examples
example_gt <- load_example_gt("gen_tbl")
# Write a geno file
gt_as_geno_lea(example_gt, file = paste0(tempfile(), "_example.geno"))
#> [1] "/tmp/RtmpZHNEm1/file1f153384fcd2_example.geno"