Skip to content

Fix #219: Database cache dir defaults to download cache, not GTF directory#340

Merged
iskandr merged 2 commits into
mainfrom
fix-219-database-default-cache-dir
May 12, 2026
Merged

Fix #219: Database cache dir defaults to download cache, not GTF directory#340
iskandr merged 2 commits into
mainfrom
fix-219-database-default-cache-dir

Conversation

@iskandr

@iskandr iskandr commented May 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • When a Genome is built from a local GTF without an explicit cache_directory_path, the sqlite Database (and protein/transcript SequenceData caches) are now created under the resolved download-cache directory instead of next to the source GTF. Closes Database path should not default to gtf path #219.
  • The user's documented workaround (`data._db.cache_directory_path = data.download_cache.cache_directory_path`) is no longer necessary.
  • Database's standalone fallback (write next to the GTF when no cache_directory_path is passed) is unchanged, so callers constructing Database directly behave as before.
  • Bumps version to 2.6.13.

Test plan

  • New regression test tests/test_database_cache_dir.py covers both the fallback path (via PYENSEMBL_CACHE_DIR) and the explicit-path case
  • Existing tests/test_ucsc_gtf.py (which exercises genome.index() with an explicit cache dir) still passes
  • ./lint.sh
  • CI on PR

iskandr added 2 commits May 11, 2026 23:15
When a Genome is constructed with a local GTF and no explicit
cache_directory_path, the sqlite Database (and SequenceData caches) now
write into the resolved download cache directory rather than the GTF's
parent directory. This unblocks users pointing pyensembl at GTFs in
read-only locations who previously hit a PermissionError on index().

Database's standalone fallback (cache next to GTF when no path provided)
is unchanged so direct Database(...) callers behave as before.

Bump version to 2.6.13.
Now that Genome hands the resolved download-cache dir (rather than the
FASTA's parent dir) to SequenceData, the target directory may not exist
yet when no remote files have been downloaded. Mirror Database.create's
ensure_dir call before dump_pickle.

Fixes test_missing_genome_sources.{test_transcript_fasta_only,test_protein_fasta_only}.
@iskandr iskandr merged commit 90bca3e into main May 12, 2026
9 checks passed
@iskandr iskandr deleted the fix-219-database-default-cache-dir branch May 12, 2026 03:27
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 83.547% (-0.1%) from 83.649% — fix-219-database-default-cache-dir into main

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.

Database path should not default to gtf path

2 participants