Skip to content

Commit

Permalink
bug fix: check bp char to int
Browse files Browse the repository at this point in the history
  • Loading branch information
Al-Murphy committed Jul 20, 2023
1 parent 7f292ca commit 5ad4a42
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 6 additions & 1 deletion R/check_bp_range.R
Original file line number Diff line number Diff line change
Expand Up @@ -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),]
Expand Down

0 comments on commit 5ad4a42

Please sign in to comment.