Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@liannette
Copy link
Contributor

Fixes issue #307 + additional issue

This PR addresses two different bugs in the _resolve_genbank_accession() function when resolving GenBank accession numbers to RefSeq accessions:

  1. The function previously failed when a valid GenBank accession existed in NCBI but had no corresponding RefSeq accession.
  2. It also broke when the provided GenBank accession was invalid (not found in NCBI).

Changes & Improvements:

  • Instead of causing an error, the function now returns an empty string ("") when no RefSeq accession is available.
  • Additional error handling cases have been added to improve robustness.
  • The function has been refactored for better readability and maintainability.

@gcroci2 gcroci2 self-requested a review February 6, 2025 09:32
@liannette liannette requested a review from gcroci2 February 6, 2025 12:20
@liannette liannette marked this pull request as draft February 6, 2025 12:20
@gcroci2 gcroci2 marked this pull request as ready for review February 6, 2025 12:21
@gcroci2 gcroci2 marked this pull request as draft February 6, 2025 12:22
@liannette liannette marked this pull request as ready for review February 6, 2025 14:05
@liannette
Copy link
Contributor Author

Mypy complains about redefining a variable, but this issue existed before my changes. Fixing it would also result in multiple return statements, which I tried to avoid. How would you like to proceed?

@gcroci2
Copy link
Contributor

gcroci2 commented Feb 12, 2025

Mypy complains about redefining a variable, but this issue existed before my changes. Fixing it would also result in multiple return statements, which I tried to avoid. How would you like to proceed?

Just remove the type hint on line 295, and it should be fixed @liannette

Co-authored-by: Giulia Crocioni <55382553+gcroci2@users.noreply.github.com>
@gcroci2
Copy link
Contributor

gcroci2 commented Feb 13, 2025

Now the static typing passes :) but I think that this tests error: FAILED tests/unit/genomics/test_podp_antismash_downloader.py::test_jgi_id - ValueError: No antiSMASH data found for any genome should be fixed before merging. I can look into that next week, in the meantime feel free to do it yourself @liannette

@liannette
Copy link
Contributor Author

liannette commented Feb 17, 2025

I looked into the test failure, and it doesn’t seem to be related to my changes. My updates only affect the functionality for converting GenBank to RefSeq accessions.

From what I can tell, the error happens earlier in the test—during the conversion of a JGI_Genome_ID to a GenBank accession in the _resolve_jgi_accession function. The logs show that the request to https://img.jgi.doe.gov/cgi-bin/m/main.cgi?section=TaxonDetail&page=taxonDetail&taxon_oid=640427140 timed out:

[2025-02-13 12:07:22] WARNING  Timed out        podp_antismash_downloader.py:328
                               waiting for                                      
                               result of                                        
                               JGI_Genome_ID                                    
                               lookup

It looks like an httpx.ReadTimeout issue while waiting for a response from their website. I have the impression the site has been having issues for a few days now, but retrying the test later should hopefully resolve it.

@liannette liannette closed this Feb 17, 2025
@liannette liannette reopened this Feb 17, 2025
@gcroci2
Copy link
Contributor

gcroci2 commented Feb 26, 2025

It looks like an httpx.ReadTimeout issue while waiting for a response from their website. I have the impression the site has been having issues for a few days now, but retrying the test later should hopefully resolve it.

Sorry for the delay. I've verified that the failing test should not be related to the edits in this PR.

@gcroci2 gcroci2 self-requested a review February 26, 2025 10:36
@liannette
Copy link
Contributor Author

Great! Could you also merge it? 🙏

@gcroci2 gcroci2 merged commit b66fb72 into NPLinker:dev Feb 28, 2025
4 of 8 checks passed
@github-project-automation github-project-automation bot moved this from Ready to Done in dev Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.