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
= "P04629"
uniprot_id = fetch_uniprot_data(uniprot_id)
data display_uniprot_data(data)
UniProt ID: P04629
Protein Name: High affinity nerve growth factor receptor
Organism: Homo sapiens
Function: Receptor tyrosine kinase involved in the development and the maturation of the central and peripheral nervous systems through regulation of proliferation, differentiation and survival of sympathetic and nervous neurons. High affinity receptor for NGF which is its primary ligand (PubMed:1281417, PubMed:15488758, PubMed:17196528, PubMed:1849459, PubMed:1850821, PubMed:22649032, PubMed:27445338, PubMed:8325889). Can also bind and be activated by NTF3/neurotrophin-3. However, NTF3 only supports axonal extension through NTRK1 but has no effect on neuron survival (By similarity). Upon dimeric NGF ligand-binding, undergoes homodimerization, autophosphorylation and activation (PubMed:1281417). Recruits, phosphorylates and/or activates several downstream effectors including SHC1, FRS2, SH2B1, SH2B2 and PLCG1 that regulate distinct overlapping signaling cascades driving cell survival and differentiation. Through SHC1 and FRS2 activates a GRB2-Ras-MAPK cascade that regulates cell differentiation and survival. Through PLCG1 controls NF-Kappa-B activation and the transcription of genes involved in cell survival. Through SHC1 and SH2B1 controls a Ras-PI3 kinase-AKT1 signaling cascade that is also regulating survival. In absence of ligand and activation, may promote cell death, making the survival of neurons dependent on trophic factors