iedb.mhc.delete() and iedb.tcell.delete() download the IEDB export before deleting it

Open Beginner friendly
#64 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
data

Research direction

Start with the delete() and local_path() functions in pepdata/iedb/mhc.py and pepdata/iedb/tcell.py, then compare delete() in pepdata/iedb/alleles.py. Add a test for deleting when the file is not cached, verifying that no network request is made and deletion is a no-op; run the relevant tests. Done when all three functions behave consistently for missing files.

Written by the indexing model from the issue text.

Description

Problem

pepdata.iedb.mhc.delete() and pepdata.iedb.tcell.delete() download the IEDB export if it isn't cached, and then delete it:

# pepdata/iedb/mhc.py:35-49 (tcell.py:46-60 is the same)
def local_path(auto_download=True):
    path = cache.local_path(...)
    if not os.path.exists(path):
        if auto_download:
            return download()
        ...
def delete():
    os.remove(local_path())

delete() calls local_path() with its default auto_download=True. On a machine without the cached file, a call meant to clean up therefore fetches the full MHC ligand or T-cell export from IEDB and then removes it.

iedb.alleles.delete() (alleles.py:32-38) behaves differently again. It skips the download but raises FileNotFoundError when the XML isn't cached. So the three delete() functions in one package don't agree on what a missing file means.

Evidence

Read at a5dffe3:

  • pepdata/iedb/mhc.py:35-49
  • pepdata/iedb/tcell.py:46-60
  • pepdata/iedb/alleles.py:32-38

Open PR #58 doesn't touch these functions.

Suggested fix

Have every delete() resolve the path with cache.local_path(...), which doesn't download, and remove the file inside contextlib.suppress(FileNotFoundError), so a missing file is a no-op in all three modules. Add a test that delete() with no cached file makes no network request.

https://claude.ai/code/session_01JHJhwj29oDqoeu7TYd34Pi

Dominant language
Python
Stars
58
Forks
16
Avg merge
2d 12h
Merged PRs (30d)
3

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openvax/pepdata

All issues in openvax/pepdata

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.