400 Client Error
m-rossello opened this issue · 4 comments
Good morning,
Recently I had some issues with UPIMAPI. The error I got is:
Traceback (most recent call last):
File "/usr/local/bin/upimapi.py", line 1261, in <module>
upimapi()
File "/usr/local/bin/upimapi.py", line 1241, in upimapi
uniprot_information_workflow(
File "/usr/local/bin/upimapi.py", line 423, in uniprot_information_workflow
uniprotinfo = get_uniprot_information(
File "/usr/local/bin/upimapi.py", line 296, in get_uniprot_information
data = uniprot_request(ids[i:j], api_info, columns_dict=columns_dict, columns=columns)
File "/usr/local/bin/upimapi.py", line 208, in uniprot_request
resp = get_url(f"{WEBSITE_API}/uniprotkb/accessions?accessions={','.join(ids)}{fields}&format={output_format}")
File "/usr/local/bin/upimapi.py", line 189, in get_url
response.raise_for_status()
File "/home/mayfly/maria_r/.local/lib/python3.9/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://rest.uniprot.org/uniprotkb/accessions?accessions=B0WC46.1,O02695.1,G3V9H8.1,O02437.1,O02350.3,A8K2U0.3,G4V4G1.1,A1ZAI5.1,O01761.3,B3A0R7.1&fields=accession,id,gene_names,protein_name,ec,cc_function,cc_pathway,keyword,protein_existence,go,protein_families,lineage,lineage_ids,organism_name,organism_id,xref_biocyc,xref_brenda,xref_cdd,xref_eggnog,xref_ensembl,xref_interpro,xref_kegg,xref_pfam,xref_reactome,xref_refseq,xref_unipathway&format=tsv
Best,
Hey there! Sorry you're having problems with UPIMAPI....
Could you please provide an example input and command to reproduce this error?
Hi, Thank you for the fast response. The command that I'm running is:
upimapi.py -i toy_id.txt -o ./upimapi_results --columns "Coiled coil&Compositional bias"
The input data is:
$ cat toy_id.txt
A1ZAI5.1
A8K2U0.3
B0WC46.1
B3A0R7.1
G3V9H8.1
G4V4G1.1
O01761.3
O02350.3
O02437.1
O02695.1
The version that I'm currently using is UPIMAPI 1.8.8
The problem seems to be that these IDs are identified as valid by UniProt's API but trying to ID mapping them fails. The truly valid IDs are the part before the .
, i.e., A1ZAI5.1
should be A1ZAI5
.
Hadn't encountered this type of IDs before, but will include a few lines of code to deal with them on the next version of UPIMAPI. Should launch it later today, but if you have urgency, do mind removing the dot and the part after it will solve this particular issue. Thank you for raising attention to this.
This is now fixed in version 1.8.9
of UPIMAPI.