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
= "P32249"
uniprot_id = fetch_uniprot_data(uniprot_id)
data display_uniprot_data(data)
UniProt ID: P32249
Protein Name: G-protein coupled receptor 183
Organism: Homo sapiens
Function: G-protein coupled receptor expressed in lymphocytes that acts as a chemotactic receptor for B-cells, T-cells, splenic dendritic cells, monocytes/macrophages and astrocytes (By similarity). Receptor for oxysterol 7-alpha,25-dihydroxycholesterol (7-alpha,25-OHC) and other related oxysterols (PubMed:21796212, PubMed:22875855, PubMed:22930711). Mediates cell positioning and movement of a number of cells by binding the 7-alpha,25-OHC ligand that forms a chemotactic gradient (By similarity). Binding of 7-alpha,25-OHC mediates the correct localization of B-cells during humoral immune responses (By similarity). Guides B-cell movement along the B-cell zone-T-cell zone boundary and later to interfollicular and outer follicular regions (By similarity). Its specific expression during B-cell maturation helps position B-cells appropriately for mounting T-dependent antibody responses (By similarity). Collaborates with CXCR5 to mediate B-cell migration; probably by forming a heterodimer with CXCR5 that affects the interaction between of CXCL13 and CXCR5 (PubMed:22913878). Also acts as a chemotactic receptor for some T-cells upon binding to 7-alpha,25-OHC ligand (By similarity). Promotes follicular helper T (Tfh) cells differentiation by positioning activated T-cells at the follicle-T-zone interface, promoting contact of newly activated CD4 T-cells with activated dendritic cells and exposing them to Tfh-cell-promoting inducible costimulator (ICOS) ligand (By similarity). Expression in splenic dendritic cells is required for their homeostasis, localization and ability to induce B- and T-cell responses: GPR183 acts as a chemotactic receptor in dendritic cells that mediates the accumulation of CD4(+) dendritic cells in bridging channels (By similarity). Regulates migration of astrocytes and is involved in communication between astrocytes and macrophages (PubMed:25297897). Promotes osteoclast precursor migration to bone surfaces (By similarity). Signals constitutively through G(i)-alpha, but not G(s)-alpha or G(q)-alpha (PubMed:21673108, PubMed:25297897). Signals constitutively also via MAPK1/3 (ERK1/2) (By similarity)