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
= "Q13586"
uniprot_id = fetch_uniprot_data(uniprot_id)
data display_uniprot_data(data)
UniProt ID: Q13586
Protein Name: Stromal interaction molecule 1
Organism: Homo sapiens
Function: Acts as a Ca(2+) sensor that gates two major inward rectifying Ca(2+) channels at the plasma membrane: Ca(2+) release-activated Ca(2+) (CRAC) channels and arachidonate-regulated Ca(2+)-selective (ARC) channels (PubMed:15866891, PubMed:16005298, PubMed:16208375, PubMed:16537481, PubMed:16733527, PubMed:16766533, PubMed:16807233, PubMed:18854159, PubMed:19182790, PubMed:19249086, PubMed:19622606, PubMed:19706554, PubMed:22464749, PubMed:24069340, PubMed:24351972, PubMed:24591628, PubMed:25326555, PubMed:26322679, PubMed:28219928, PubMed:32415068). Plays a role in mediating store-operated Ca(2+) entry (SOCE), a Ca(2+) influx following depletion of intracellular Ca(2+) stores. Upon Ca(2+) depletion, translocates from the endoplasmic reticulum to the plasma membrane where it activates CRAC channel pore-forming subunits ORA1, ORA2 and ORAI3 to generate sustained and oscillatory Ca(2+) entry (PubMed:16208375, PubMed:16537481, PubMed:32415068). Involved in enamel formation (PubMed:24621671)