Skip to content

Commit

Permalink
using case-insensitive grep to validate allele freq tsv file header i…
Browse files Browse the repository at this point in the history
…nstead of exact matches
  • Loading branch information
jeffersonfparil committed Jun 3, 2024
1 parent 1011025 commit 93b9297
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion R/load.R
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,10 @@ fn_load_genotype = function(fname_geno, ploidy=NULL, retain_minus_one_alleles_pe
### TSV: allele frequency table file ###
########################################
df = utils::read.delim(fname_geno, sep="\t", header=TRUE)
if (sum(colnames(df)[1:3] == c("chr", "pos", "allele"), na.rm=TRUE) < 3) {
if (!((grepl("chr", colnames(df)[1], ignore.case=TRUE)) &
(grepl("pos", colnames(df)[2], ignore.case=TRUE)) &
(grepl("allele", colnames(df)[3], ignore.case=TRUE)))
) {
error = methods::new("gpError",
code=000,
message=paste0(
Expand Down

0 comments on commit 93b9297

Please sign in to comment.