Skip to content

Commit

Permalink
Fix LDpred2 error with uppercase chromosome column header (#180)
Browse files Browse the repository at this point in the history
* sumstats[, colChr] to sumstats$chr + test

* bump version for bugfix release

* wording

* update date
  • Loading branch information
espenhgn authored Jun 7, 2023
1 parent d93d283 commit a195c98
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ If MD5 sum is not listed for a certain release then it means that the container

* Miscellaneous goes here

## [1.3.1] - 2023-06-07

### Added

* Added unittest for uppercase chromosome column name in sumstats files, that may also contain chromosomes encoded as character(s)

### Fixed

* Fixed issue with character encoding in sumstats files, in case chromosome column name is uppercase.

## [1.3.0] - 2023-05-19

### Added
Expand Down
4 changes: 2 additions & 2 deletions scripts/pgs/LDpred2/ldpred2.R
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@ sumstats$a1 <- toupper(sumstats$a1)
# Check that there are no characters in chromosome column (causes snp_match to fail)
if (!isOnlyNumeric(sumstats$chr)) {
cat('Removing rows with non-integers in column', colChr, '\n')
numeric <- getNumericIndices(sumstats[, colChr])
numeric <- getNumericIndices(sumstats$chr)
cat('Removing', nrow(sumstats) - length(numeric), 'SNPs...\n')
sumstats <- sumstats[numeric,]
cat('Retained', nrow(sumstats), 'SNPs\n')
sumstats[, colChr] <- as.numeric(sumstats[, colChr])
sumstats$chr <- as.numeric(sumstats$chr)
}

### Determine effective sample-size
Expand Down
7 changes: 7 additions & 0 deletions tests/test_LDpred2/scripts/extended.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,19 @@ echo "$row" >> $fileSumstatsWithChar
dump=$( { $LDP --ldpred-mode inf --col-chr chr --geno-file-rds $fileImputed.rds --sumstats $fileSumstatsWithChar; } 2>&1 )
if [ $? -eq 1 ]; then echo "$dump"; exit; fi

echo "Test error: upper case CHR column in sumstats file"
sed -i '1s/chr/CHR/' $fileSumstatsWithChar
dump=$( { $LDP --ldpred-mode inf --col-chr CHR --geno-file-rds $fileImputed.rds --sumstats $fileSumstatsWithChar; } 2>&1 )
if [ $? -eq 1 ]; then echo "$dump"; exit; fi

echo "Test error: Missing genotypes"
dump=$( { $LDP --ldpred-mode inf --col-chr chr --geno-file-rds $fileImpute.rds --sumstats $fileInputSumStats; } 2>&1 )
if [ $? -eq 0 ]; then echo "No error received"; echo "$dump"; exit; fi

echo "Test --geno-impute-zero"
dump=$( { $LDP --ldpred-mode inf --col-chr chr --geno-file-rds $fileImpute.rds --geno-impute-zero --sumstats $fileInputSumStats; } 2>&1 )
if [ $? -eq 1 ]; then echo "$dump"; exit; fi

echo "Test preimputed file"
dump=$( { $LDP --ldpred-mode inf --col-chr chr --geno-file-rds $fileImputed.rds --sumstats $fileInputSumStats; } 2>&1 )
if [ $? -eq 1 ]; then echo "$dump"; exit; fi
Expand Down
2 changes: 1 addition & 1 deletion version/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
_MINOR = "3"
# On main and in a nightly release the patch should be one ahead of the last
# released build.
_PATCH = "0"
_PATCH = "1"
# This is mainly for nightly builds which have the suffix ".dev$DATE". See
# https://semver.org/#is-v123-a-semantic-version for the semantics.
_SUFFIX = ""
Expand Down

0 comments on commit a195c98

Please sign in to comment.