Code
import requests
import urllib3
urllib3.disable_warnings()
def fetch_uniprot_data(uniprot_id):
url = f"https://rest.uniprot.org/uniprotkb/{uniprot_id}.json"
response = requests.get(url, verify=False) # Disable SSL verification
response.raise_for_status() # Raise an error for bad status codes
return response.json()
def display_uniprot_data(data):
primary_accession = data.get('primaryAccession', 'N/A')
protein_name = data.get('proteinDescription', {}).get('recommendedName', {}).get('fullName', {}).get('value', 'N/A')
gene_name = data.get('gene', [{'geneName': {'value': 'N/A'}}])[0]['geneName']['value']
organism = data.get('organism', {}).get('scientificName', 'N/A')
function_comment = next((comment for comment in data.get('comments', []) if comment['commentType'] == "FUNCTION"), None)
function = function_comment['texts'][0]['value'] if function_comment else 'N/A'
# 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
uniprot_id = "P17181"
data = fetch_uniprot_data(uniprot_id)
display_uniprot_data(data)UniProt ID: P17181
Protein Name: Interferon alpha/beta receptor 1
Organism: Homo sapiens
Function: Together with IFNAR2, forms the heterodimeric receptor for type I interferons (including interferons alpha, beta, epsilon, omega and kappa) (PubMed:10049744, PubMed:14532120, PubMed:15337770, PubMed:2153461, PubMed:21854986, PubMed:24075985, PubMed:31270247, PubMed:33252644, PubMed:35442418, PubMed:7813427). Type I interferon binding activates the JAK-STAT signaling cascade, resulting in transcriptional activation or repression of interferon-regulated genes that encode the effectors of the interferon response (PubMed:10049744, PubMed:21854986, PubMed:7665574). Mechanistically, type I interferon-binding brings the IFNAR1 and IFNAR2 subunits into close proximity with one another, driving their associated Janus kinases (JAKs) (TYK2 bound to IFNAR1 and JAK1 bound to IFNAR2) to cross-phosphorylate one another (PubMed:21854986, PubMed:32972995, PubMed:7665574, PubMed:7813427). The activated kinases phosphorylate specific tyrosine residues on the intracellular domains of IFNAR1 and IFNAR2, forming docking sites for the STAT transcription factors (PubMed:21854986, PubMed:32972995, PubMed:7526154, PubMed:7665574, PubMed:7813427). STAT proteins are then phosphorylated by the JAKs, promoting their translocation into the nucleus to regulate expression of interferon-regulated genes (PubMed:19561067, PubMed:21854986, PubMed:32972995, PubMed:7665574, PubMed:7813427, PubMed:9121453). Can also act independently of IFNAR2: form an active IFNB1 receptor by itself and activate a signaling cascade that does not involve activation of the JAK-STAT pathway (By similarity)