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
= "P09326"
uniprot_id = fetch_uniprot_data(uniprot_id)
data display_uniprot_data(data)
UniProt ID: P09326
Protein Name: CD48 antigen
Organism: Homo sapiens
Function: Glycosylphosphatidylinositol (GPI)-anchored cell surface glycoprotein that interacts via its N-terminal immunoglobulin domain with cell surface receptors including 2B4/CD244 or CD2 to regulate immune cell function and activation (PubMed:12007789, PubMed:27249817). Participates in T-cell signaling transduction by associating with CD2 and efficiently bringing the Src family protein kinase LCK and LAT to the TCR/CD3 complex (PubMed:19494291). In turn, promotes LCK phosphorylation and subsequent activation (PubMed:12007789). Induces the phosphorylation of the cytoplasmic immunoreceptortyrosine switch motifs (ITSMs) of CD244 initiating a series of signaling events that leads to the generation of the immunological synapse and the directed release of cytolytic granules containing perforin and granzymes by T-lymphocytes and NK-cells (PubMed:27249817, PubMed:9841922)