fix: improve error handling and fix minor bugs - #2
Open
mugpeng wants to merge 1 commit into
Open
Conversation
- utilities.R: geneset_download now calls stop() when download fails and no local cache exists, instead of returning FALSE and letting callers crash with a cryptic fst::read.fst error - getEnrichrdb.R, getHgDisease.R, getMsigdb.R: geneset_name now returns an empty data.frame instead of logical NA, keeping the return type consistent with other get*() functions - getKEGG.R: fix typo 'categoty' -> 'category' and grammar 'support' -> 'supports' - getKEGG.R: include category in local cache filename to avoid collisions between pathway/module/enzyme caches for the same organism
mugpeng
force-pushed
the
fix-bugs-improve-error-handling
branch
from
August 19, 2026 09:39
8c6577c to
328ebfd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi @liuyunze, thank you for maintaining this useful package!
This PR addresses a few bugs and improvements I noticed while reviewing the code. All changes are backward-compatible from the user's perspective.
1. Download failure now throws a clear error (
utilities.R)Before: When
geneset_download()failed and no local cache existed, it returnedFALSEsilently. None of the callers (getGO,getKEGG, etc.) checked the return value, so the next line —fst::read.fst(destfile)— crashed with a cryptic file-not-found error from thefstpackage.After: When download fails and no local cache is available,
geneset_download()now callsstop()directly with the helpful message that was already being printed (including the download URL and manual instructions).2.
geneset_namereturns an empty data.frame instead of logicalNA(getEnrichrdb.R,getHgDisease.R,getMsigdb.R)Before: For data sources that don't have a separate name table, the code set
res[['geneset_name']] <- NA, returning a logicalNA. This is inconsistent with otherget*functions that always return adata.frame, and breaks downstream code that callshead(),colnames(), ornrow()on the result.After: Now returns
data.frame(term = character(0), name = character(0), stringsAsFactors = FALSE), which is type-compatible with the rest of the API.3. Fixed typo in
getKEGG.RCorrected
categotytocategoryandsupporttosupportsin the error message for non-human KEGG categories.Please feel free to let me know if you'd like any adjustments!