# example code
# example numeric genotype matrix for a tetraploid
n_ind <- 5
n_snps <- 10
geno <- matrix(as.numeric(sample(0:4, n_ind * n_snps, replace = TRUE)), nrow = n_snps, ncol = n_ind)
colnames(geno) <- paste0("Ind", 1:n_ind)
rownames(geno) <- paste0("SNP", 1:n_snps)
ploidy <- 4
# Output matrix with the allele count reversed
results <- flip_dosage(geno, ploidy, is.reference = TRUE)
print(results)
Run the code above in your browser using DataLab