Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specifying the organism whe using IdMappingClient #35

Closed
marcorusc opened this issue Aug 9, 2024 · 5 comments · Fixed by #36
Closed

Specifying the organism whe using IdMappingClient #35

marcorusc opened this issue Aug 9, 2024 · 5 comments · Fixed by #36

Comments

@marcorusc
Copy link

Hello, thanks a lot for developing this package!

I am using Unipressed as part of a package I am developing with my team.

I was wondering if it was possible to specify the organism when translating identifiers like in the following case:

request = IdMappingClient.submit(
    source="Gene_Name", dest="UniProtKB-Swiss-Prot", ids={ "BET1"}
)
time.sleep(1) # Sleep for 1 seconds
list(request.each_result())

this output different translation from Gene_Name to Uniprot, including homologs:

'''
{'from': 'BET1', 'to': 'A0A0C6E0I7'},
{'from': 'BET1', 'to': 'O13932'},
{'from': 'BET1', 'to': 'O15155'},
{'from': 'BET1', 'to': 'O35623'},
{'from': 'BET1', 'to': 'P22804'},
{'from': 'BET1', 'to': 'Q62896'} <-- not interested
'''

Is it possible to add a flag to filter out all the translations that do not refer to a specific organism?

Thanks a lot for your help!

@multimeric
Copy link
Owner

Good question. Apparently if you are converting to UniProtKB only, there is a special taxonId field that can be used for this purpose:

curl --silent 'https://rest.uniprot.org/configure/idmapping/fields' | jq '.rules | .[] | select(.taxonId)'
{
  "ruleId": 6,
  "tos": [
    "UniProtKB",
    "UniProtKB-Swiss-Prot"
  ],
  "defaultTo": "UniProtKB",
  "taxonId": true
}

More info here. I'll try to implement this when I get time.

@marcorusc
Copy link
Author

That would be great! Indeed I would specify the TaxonID just for the conversion to UniprotKB.

Thanks a lot for answering so quickly!!

@multimeric multimeric mentioned this issue Aug 13, 2024
3 tasks
@multimeric
Copy link
Owner

Okay, this is now implemented in #36.

Can you please try installing it using:

pip install git+https://github.com/multimeric/Unipressed@id-mapping-typing

Then in Python, you can use taxon_id which is an integer corresponding to a UniProt taxon ID (https://www.uniprot.org/taxonomy):

from unipressed import IdMappingClient
request = IdMappingClient.submit(
     source="Gene_Name", dest="UniProtKB", ids={"STE2"}, taxon_id=4932
 )

@marcorusc
Copy link
Author

Looks like it is working fine! I have tried translating a couple of identifiers from genesymbol to UniProtKB-Swiss-Prot and it works perfectly (using taxon id 9606).

ex:

request = IdMappingClient.submit(
    source="Gene_Name", dest="UniProtKB-Swiss-Prot", ids={"BET1"}, taxon_id=9606
)
time.sleep(2) # Sleep for 3 seconds
list(request.each_result())

[{'from': 'BET1', 'to': 'O15155'}]

Thanks a lot for your help!

@multimeric
Copy link
Owner

multimeric commented Aug 16, 2024

Thanks for checking! That feature should now be available in release 1.4.0+

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 a pull request may close this issue.

2 participants