Skip to content

Conversation

@Rapsssito
Copy link

@Rapsssito Rapsssito commented Jun 17, 2025

As described in title. This is the error I get directly from the request instance (without my change):

400 {"url":"http://rest.uniprot.org/idmapping/run","messages":["Invalid parameter 'taxId'"]}

Steps to reproduce the problem (P38398 comes from human BRCA1):

request = IdMappingClient.submit(
        taxon_id=9606, source="UniProtKB_AC-ID", dest="Ensembl_Protein", ids=['P38398']
)

@multimeric
Copy link
Owner

Okay that test failure isn't your fault. Can I have a test for this though please?

@Rapsssito
Copy link
Author

I believe there is already a test for that:

def test_taxon_id_yeast():
# Checks that setting a taxon_id filter returns results from only yeast
request = IdMappingClient.submit(
source="Gene_Name", dest="UniProtKB", ids={"STE2"}, taxon_id=4932
)
sleep(5)
results = {result["to"] for result in request.each_result()}
assert len(results) >= 5
# Real yeast gene
assert "P0CI39" in results
# Mouse gene
assert "P14719" not in results

@multimeric
Copy link
Owner

Ah I see. I'll have to test that this is broken on the master branch first then.

@multimeric
Copy link
Owner

Hmm, the tests are working on master (minus the flaky ID mapping one), so I think the current approach is correct

In the API docs here it is shown as taxId. Why do you think this change is needed?

@Rapsssito
Copy link
Author

This is the code I am using:

request = IdMappingClient.submit(taxon_id=9606, source="UniProtKB_AC-ID", dest="Ensembl_Protein",ids=uniprot_accessions)

It was not working for me at first. However, after this change, it started working. I took inspiration from here, where it is described as "taxid" not "taxId".

@multimeric
Copy link
Owner

I took inspiration from here, where it is described as "taxid" not "taxId".

That's using a different (I presume older) API than Unipressed uses

It was not working for me at first. However, after this change, it started working

I wonder if that's because your taxon ID doesn't match your uniprot IDs, and therefore the change you proposed removes the taxon filter and gets you your expected results. I would double check your inputs. I'm pretty sure the current approach in Unipressed is correct.

@multimeric multimeric closed this Jun 17, 2025
@Rapsssito
Copy link
Author

Rapsssito commented Jun 17, 2025

@multimeric, this is the error I get directly from the request (without my change):

400 {"url":"http://rest.uniprot.org/idmapping/run","messages":["Invalid parameter 'taxId'"]}

I don't think it is related to the taxon IDs not matching.

Try running this code. Let me know if it works for you (P38398 comes from human BRCA1).

request = IdMappingClient.submit(
        taxon_id=9606, source="UniProtKB_AC-ID", dest="Ensembl_Protein", ids=['P38398']
)

(BTW, I am using Python 3.12.7)

@multimeric
Copy link
Owner

multimeric commented Jun 17, 2025

Hmm true enough, something is going on here. My best guess is that it relates to how you're doing UniProtKB_AC-ID -> Ensembl_Protein whereas the current test is Gene_Name -> UniProtKB. I think in uniprot some of the databases are inconsistent with each other, so I could imagine one of these mappers expecting a non-standard parameter. If so, we can patch it here, but I (or you) should also submit it as a bug to Uniprot themselves.

Can you please add your example above as a new test case.

@multimeric multimeric reopened this Jun 17, 2025
@multimeric
Copy link
Owner

multimeric commented Jun 18, 2025

I have sent this issue to UniProt support. Ticket #258772.

@ahmadshadab
Copy link

Hi @multimeric ,
I've replied to you support email. "taxId" is applicable only when from field is "Gene_Name" but Swagger documents it as an optional field which is confusing. We will update the code to make validation more lenient.
Thanks,
Shadab
UniProt

@multimeric
Copy link
Owner

Thanks @ahmadshadab. Looks like I'll have to tweak the interface and docs to make this clear to users. I think the current behaviour is okay in the meantime.

@multimeric multimeric closed this Jun 20, 2025
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