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
= "P35372"
uniprot_id = fetch_uniprot_data(uniprot_id)
data display_uniprot_data(data)
UniProt ID: P35372
Protein Name: Mu-type opioid receptor
Organism: Homo sapiens
Function: Receptor for endogenous opioids such as beta-endorphin and endomorphin (PubMed:10529478, PubMed:12589820, PubMed:7891175, PubMed:7905839, PubMed:7957926, PubMed:9689128). Receptor for natural and synthetic opioids including morphine, heroin, DAMGO, fentanyl, etorphine, buprenorphin and methadone (PubMed:10529478, PubMed:10836142, PubMed:12589820, PubMed:19300905, PubMed:7891175, PubMed:7905839, PubMed:7957926, PubMed:9689128). Also activated by enkephalin peptides, such as Met-enkephalin or Met-enkephalin-Arg-Phe, with higher affinity for Met-enkephalin-Arg-Phe (By similarity). Agonist binding to the receptor induces coupling to an inactive GDP-bound heterotrimeric G-protein complex and subsequent exchange of GDP for GTP in the G-protein alpha subunit leading to dissociation of the G-protein complex with the free GTP-bound G-protein alpha and the G-protein beta-gamma dimer activating downstream cellular effectors (PubMed:7905839). The agonist- and cell type-specific activity is predominantly coupled to pertussis toxin-sensitive G(i) and G(o) G alpha proteins, GNAI1, GNAI2, GNAI3 and GNAO1 isoforms Alpha-1 and Alpha-2, and to a lesser extent to pertussis toxin-insensitive G alpha proteins GNAZ and GNA15 (PubMed:12068084). They mediate an array of downstream cellular responses, including inhibition of adenylate cyclase activity and both N-type and L-type calcium channels, activation of inward rectifying potassium channels, mitogen-activated protein kinase (MAPK), phospholipase C (PLC), phosphoinositide/protein kinase (PKC), phosphoinositide 3-kinase (PI3K) and regulation of NF-kappa-B (By similarity). Also couples to adenylate cyclase stimulatory G alpha proteins (By similarity). The selective temporal coupling to G-proteins and subsequent signaling can be regulated by RGSZ proteins, such as RGS9, RGS17 and RGS4 (By similarity). Phosphorylation by members of the GPRK subfamily of Ser/Thr protein kinases and association with beta-arrestins is involved in short-term receptor desensitization (By similarity). Beta-arrestins associate with the GPRK-phosphorylated receptor and uncouple it from the G-protein thus terminating signal transduction (By similarity). The phosphorylated receptor is internalized through endocytosis via clathrin-coated pits which involves beta-arrestins (By similarity). The activation of the ERK pathway occurs either in a G-protein-dependent or a beta-arrestin-dependent manner and is regulated by agonist-specific receptor phosphorylation (By similarity). Acts as a class A G-protein coupled receptor (GPCR) which dissociates from beta-arrestin at or near the plasma membrane and undergoes rapid recycling (By similarity). Receptor down-regulation pathways are varying with the agonist and occur dependent or independent of G-protein coupling (By similarity). Endogenous ligands induce rapid desensitization, endocytosis and recycling (By similarity). Heterooligomerization with other GPCRs can modulate agonist binding, signaling and trafficking properties (By similarity)