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
= "Q4U2R8"
uniprot_id = fetch_uniprot_data(uniprot_id)
data display_uniprot_data(data)
UniProt ID: Q4U2R8
Protein Name: Solute carrier family 22 member 6
Organism: Homo sapiens
Function: Secondary active transporter that functions as a Na(+)-independent organic anion (OA)/dicarboxylate antiporter where the uptake of one molecule of OA into the cell is coupled with an efflux of one molecule of intracellular dicarboxylate such as 2-oxoglutarate or glutarate (PubMed:11669456, PubMed:11907186, PubMed:14675047, PubMed:22108572, PubMed:23832370, PubMed:28534121, PubMed:9950961). Mediates the uptake of OA across the basolateral side of proximal tubule epithelial cells, thereby contributing to the renal elimination of endogenous OA from the systemic circulation into the urine (PubMed:9887087). Functions as a biopterin transporters involved in the uptake and the secretion of coenzymes tetrahydrobiopterin (BH4), dihydrobiopterin (BH2) and sepiapterin to urine, thereby determining baseline levels of blood biopterins (PubMed:28534121). Transports prostaglandin E2 (PGE2) and prostaglandin F2-alpha (PGF2-alpha) and may contribute to their renal excretion (PubMed:11907186). Also mediates the uptake of cyclic nucleotides such as cAMP and cGMP (PubMed:26377792). Involved in the transport of neuroactive tryptophan metabolites kynurenate (KYNA) and xanthurenate (XA) and may contribute to their secretion from the brain (PubMed:22108572, PubMed:23832370). May transport glutamate (PubMed:26377792). Also involved in the disposition of uremic toxins and potentially toxic xenobiotics by the renal organic anion secretory pathway, helping reduce their undesired toxicological effects on the body (PubMed:11669456, PubMed:14675047). Uremic toxins include the indoxyl sulfate (IS), hippurate/N-benzoylglycine (HA), indole acetate (IA), 3-carboxy-4- methyl-5-propyl-2-furanpropionate (CMPF) and urate (PubMed:14675047, PubMed:26377792). Xenobiotics include the mycotoxin ochratoxin (OTA) (PubMed:11669456). May also contribute to the transport of organic compounds in testes across the blood-testis-barrier (PubMed:35307651)