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
= "P51828"
uniprot_id = fetch_uniprot_data(uniprot_id)
data display_uniprot_data(data)
UniProt ID: P51828
Protein Name: Adenylate cyclase type 7
Organism: Homo sapiens
Function: Catalyzes the formation of cAMP in response to activation of G protein-coupled receptors (Probable). Functions in signaling cascades activated namely by thrombin and sphingosine 1-phosphate and mediates regulation of cAMP synthesis through synergistic action of the stimulatory G alpha protein with GNA13 (PubMed:18541530, PubMed:23229509). Also, during inflammation, mediates zymosan-induced increase intracellular cAMP, leading to protein kinase A pathway activation in order to modulate innate immune responses through heterotrimeric G proteins G(12/13) (By similarity). Functions in signaling cascades activated namely by dopamine and C5 alpha chain and mediates regulation of cAMP synthesis through synergistic action of the stimulatory G protein with G beta:gamma complex (PubMed:23229509, PubMed:23842570). Functions, through cAMP response regulation, to keep inflammation under control during bacterial infection by sensing the presence of serum factors, such as the bioactive lysophospholipid (LPA) that regulate LPS-induced TNF-alpha production. However, it is also required for the optimal functions of B and T cells during adaptive immune responses by regulating cAMP synthesis in both B and T cells (By similarity)