Code
import requests
import urllib3
urllib3.disable_warnings()
def fetch_uniprot_data(uniprot_id):
= f"https://rest.uniprot.org/uniprotkb/{uniprot_id}.json"
url = requests.get(url, verify=False) # Disable SSL verification
response # Raise an error for bad status codes
response.raise_for_status() return response.json()
def display_uniprot_data(data):
= data.get('primaryAccession', 'N/A')
primary_accession = data.get('proteinDescription', {}).get('recommendedName', {}).get('fullName', {}).get('value', 'N/A')
protein_name = data.get('gene', [{'geneName': {'value': 'N/A'}}])[0]['geneName']['value']
gene_name = data.get('organism', {}).get('scientificName', 'N/A')
organism
= next((comment for comment in data.get('comments', []) if comment['commentType'] == "FUNCTION"), None)
function_comment = function_comment['texts'][0]['value'] if function_comment else 'N/A'
function
# Printing the data
print(f"UniProt ID: {primary_accession}")
print(f"Protein Name: {protein_name}")
print(f"Organism: {organism}")
print(f"Function: {function}")
# Replace this with the UniProt ID you want to fetch
= "Q01650"
uniprot_id = fetch_uniprot_data(uniprot_id)
data display_uniprot_data(data)
UniProt ID: Q01650
Protein Name: Large neutral amino acids transporter small subunit 1
Organism: Homo sapiens
Function: The heterodimer with SLC3A2 functions as a sodium-independent, high-affinity transporter that mediates uptake of large neutral amino acids such as phenylalanine, tyrosine, leucine, histidine, methionine, tryptophan, valine, isoleucine and alanine (PubMed:10049700, PubMed:10574970, PubMed:11557028, PubMed:11564694, PubMed:12117417, PubMed:12225859, PubMed:15769744, PubMed:18262359, PubMed:25998567, PubMed:30867591, PubMed:9751058). The heterodimer with SLC3A2 mediates the uptake of L-DOPA (By similarity). Functions as an amino acid exchanger (PubMed:11557028, PubMed:12117417, PubMed:12225859, PubMed:30867591). May play a role in the transport of L-DOPA across the blood-brain barrier (By similarity). May act as the major transporter of tyrosine in fibroblasts (Probable). May mediate blood-to-retina L-leucine transport across the inner blood-retinal barrier (By similarity). Can mediate the transport of thyroid hormones diiodothyronine (T2), triiodothyronine (T3) and thyroxine (T4) across the cell membrane (PubMed:11564694). When associated with LAPTM4B, the heterodimer formed by SLC3A2 and SLC7A5 is recruited to lysosomes to promote leucine uptake into these organelles, and thereby mediates mTORC1 activation (PubMed:25998567). Involved in the uptake of toxic methylmercury (MeHg) when administered as the L-cysteine or D,L-homocysteine complexes (PubMed:12117417). Involved in the cellular activity of small molecular weight nitrosothiols, via the stereoselective transport of L-nitrosocysteine (L-CNSO) across the membrane (PubMed:15769744)