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
= "Q5T848"
uniprot_id = fetch_uniprot_data(uniprot_id)
data display_uniprot_data(data)
UniProt ID: Q5T848
Protein Name: Metabotropic glycine receptor
Organism: Homo sapiens
Function: Metabotropic receptor for glycine that controls synapse formation and function in the brain (PubMed:36996198). Acts as an atypical G-protein coupled receptor that recruits and regulates the RGS7-GNB5 complex instead of activating G proteins (PubMed:31189666, PubMed:36996198). In absence of glycine ligand, promotes the GTPase activator activity of RGS7, increasing the GTPase activity of G protein alpha subunits, thereby driving them into their inactive GDP-bound form (PubMed:36996198). Glycine-binding changes the conformation of the intracellular surface, inhibiting the GTPase activator activity of the RGS7-GNB5 complex, promoting G protein alpha subunits into their active GTP-bound form and regulating cAMP levels (PubMed:36996198). Also able to bind taurine, a compound closely related to glycine, but with a two-fold lower affinity (PubMed:36996198). Glycine receptor-dependent regulation of cAMP controls key ion channels, kinases and neurotrophic factors involved in neuronal excitability and synaptic transmission (PubMed:36996198). Plays a pivotal role in regulating mood and cognition via its ability to regulate neuronal excitability in L2/L3 pyramidal neurons of the prefrontal cortex (By similarity). Also involved in spatial learning by regulating hippocampal CA1 neuronal excitability (By similarity). Acts as a synaptic organizer in the hippocampus, required for proper mossy fiber-CA3 neurocircuitry establishment, structure and function: induces presynaptic differentiation in contacting axons via its interaction with GPC4 (By similarity). In addition to glycine, may also act as a receptor for osteocalcin (BGLAP) hormone: osteocalcin-binding initiates a signaling response that prevents neuronal apoptosis in the hippocampus and regulates the synthesis of neurotransmitters (By similarity)