Skip to content

Commit

Permalink
Fix Missing String
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-sandercock committed Feb 5, 2025
1 parent e0ff850 commit cb2dc31
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion R/DosageCall_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,12 @@ polyRAD2vcf <- function(geno, model, vcf_path, hindhe.obj, ploidy, output.file,
dosage_matrix <- as.matrix(dosage_matrix)
genotype_strings <- precompute_genotype_strings(ploidy)

# Create missing GT
missing_gt_string <- paste(rep(".", ploidy), collapse = "/")

# Handle missing values separately
genotype_matrix <- matrix(genotype_strings[dosage_matrix + 1], nrow = nrow(dosage_matrix), ncol = ncol(dosage_matrix))
genotype_matrix[is.na(dosage_matrix)] <- "./." # Handle missing values
genotype_matrix[is.na(dosage_matrix)] <- missing_gt_string # Handle missing values

# Retain row and column names
rownames(genotype_matrix) <- rownames(dosage_matrix)
Expand Down

0 comments on commit cb2dc31

Please sign in to comment.