Skip to content

Fix bambu requiring internet access when given a local FASTA genome path - #588

Merged
cying111 merged 1 commit into
devel_prefrom
fix_offline_genome_check
Oct 2, 2026
Merged

cying111 merged 1 commit into
devel_prefrom
fix_offline_genome_check

Conversation

@jonathangoeke

Copy link
Copy Markdown
Member

Summary

  • Fixes Trying to use bambu on an offline cluster  #339: bambu() failed on offline machines (e.g. an offline HPC cluster, or a self-contained biocontainers image with no internet egress — see comment) even when given a plain local FASTA file path for genome.
  • Root cause: checkInputSequence() in R/bambu_utilityFunctions.R unconditionally called BSgenome::available.genomes() for any character genome argument, before ever checking whether the string was simply a local file path. That call reaches out to Bioconductor's package repository over the network, so it threw a raw Bioconductor/BiocManager error instead of just reading the FASTA.
  • Fix: only attempt the BSgenome::available.genomes() / getBSgenome() lookup when the string is not an existing local file, and wrap that lookup in tryCatch so a blocked/failed network call falls through to the existing FASTA-read path (and its existing clear error message) instead of crashing.

Test plan

  • devtools::load_all() + traced BSgenome::available.genomes() to confirm it is no longer called when checkInputSequence() is given the package's local test FASTA (inst/extdata/Homo_sapiens.GRCh38.dna_sm.primary_assembly_chr9_1_1000000.fa)
  • Confirmed a nonexistent path still produces the original "Input genome file not readable." error
  • testthat::test_file() passing locally for test_bambu_arguments.R, test_scoreRC.R, test_isore.R (all exercise checkInputSequence()/bambu() with a local FASTA path)
  • test_setNDR.R fails identically before and after this change (missing fixture path in this environment) — confirmed unrelated to this fix

🤖 Generated with Claude Code

checkInputSequence() unconditionally called BSgenome::available.genomes()
for any character genome argument, including local FASTA file paths -
the documented, common case. That call reaches out to Bioconductor's
package repository over the network, so bambu failed on offline
clusters/containers even when the user supplied a local file (issue #339).

Now the BSgenome lookup is only attempted when the string is not an
existing local file, and is wrapped in tryCatch so a blocked network
call falls through to the existing FASTA-read error path instead of
crashing with a raw Bioconductor/BiocManager error.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@cying111 cying111 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the change looks good to me and I have tested it offline where local fasta files are loaded, before the change there is an error similar like the one described in the issue, after the change it can run smoothly

@lingminhao

lingminhao commented Sep 3, 2026 •

Copy link
Copy Markdown
Collaborator

same as community issue #581, can inform the user once it's approved.

@cying111
cying111 merged commit 9ea1785 into devel_pre Oct 2, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants