Skip to content

Commit

Permalink
adding input validation for phenotype data in geno+pheno merge
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffersonfparil committed Jul 25, 2024
1 parent 4f56a17 commit 8f5c45c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions R/io.R
Original file line number Diff line number Diff line change
Expand Up @@ -2310,6 +2310,23 @@ fn_merge_genotype_and_phenotype = function(G, list_pheno, COVAR=NULL, verbose=FA
print("### Merging genotype and phenotype data ###")
print("###########################################")
}
### Check list_pheno
if (sum(is.na(list_pheno$y))==length(list_pheno$y)) {
error = methods::new("gpError",
code=284,
message=paste0(
"Error in io::fn_merge_genotype_and_phenotype(...). ",
"All phenotype data are missing."))
return(error)
}
if (length(names(list_pheno$y)) < length(list_pheno$y)) {
error = methods::new("gpError",
code=285,
message=paste0(
"Error in io::fn_merge_genotype_and_phenotype(...). ",
"Phenotype data are missing names."))
return(error)
}
### All samples with genotype data will be included and samples without phenotype data will be set to NA (all.x=TRUE)
### Samples with phenotype but without genotype data are omitted.
M = merge(
Expand Down

0 comments on commit 8f5c45c

Please sign in to comment.