diff --git a/DESCRIPTION b/DESCRIPTION index da7edd4..db2b923 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: MungeSumstats Type: Package Title: Standardise summary statistics from GWAS -Version: 1.9.12 +Version: 1.9.13 Authors@R: c(person(given = "Alan", family = "Murphy", diff --git a/NEWS.md b/NEWS.md index f43f370..3d1d7e2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +## CHANGES IN VERSION 1.9.13 + +### Bug fix +* In `check_bp_range` ensure that the BP column is numeric. + ## CHANGES IN VERSION 1.9.12 ### Bug fix diff --git a/R/check_bp_range.R b/R/check_bp_range.R index 1162b6b..1d856bd 100644 --- a/R/check_bp_range.R +++ b/R/check_bp_range.R @@ -27,10 +27,15 @@ check_bp_range <- function(sumstats_dt, path, ref_genome,log_folder_ind, genome_info <- cbind(data.table::data.table("CHR"=seqnames(genome_info)), data.table::as.data.table(genome_info)) - #convwert CHR to char in sumstats (if it is an int) + #convert CHR to char in sumstats (if it is an int) sumstats_dt[,CHR:=as.character(CHR)] #add chr len to sumstats sumstats_dt[genome_info,chr_max:=seqlengths,on="CHR"] + #ensure BP numeric + if(!is.integer(sumstats_dt$BP)){ + message("Coercing BP column to numeric.") + sumstats_dt[,BP:=as.numeric(BP)] + } #now check if BP value is too large/less than 0 #s.na(chr_max) in case chr formatting not found bad_bp <- sumstats_dt[!is.na(chr_max) & (is.na(BP)|BP<=0 |BP>chr_max),]