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
= "O60603"
uniprot_id = fetch_uniprot_data(uniprot_id)
data display_uniprot_data(data)
UniProt ID: O60603
Protein Name: Toll-like receptor 2
Organism: Homo sapiens
Function: Cooperates with LY96 to mediate the innate immune response to bacterial lipoproteins and other microbial cell wall components. Cooperates with TLR1 or TLR6 to mediate the innate immune response to bacterial lipoproteins or lipopeptides (PubMed:17889651, PubMed:21078852). Acts via MYD88 and TRAF6, leading to NF-kappa-B activation, cytokine secretion and the inflammatory response. May also activate immune cells and promote apoptosis in response to the lipid moiety of lipoproteins (PubMed:10426995, PubMed:10426996). Recognizes mycoplasmal macrophage-activating lipopeptide-2kD (MALP-2), soluble tuberculosis factor (STF), phenol-soluble modulin (PSM) and B.burgdorferi outer surface protein A lipoprotein (OspA-L) cooperatively with TLR6 (PubMed:11441107). Stimulation of monocytes in vitro with M.tuberculosis PstS1 induces p38 MAPK and ERK1/2 activation primarily via this receptor, but also partially via TLR4 (PubMed:16622205). MAPK activation in response to bacterial peptidoglycan also occurs via this receptor (PubMed:16622205). Acts as a receptor for M.tuberculosis lipoproteins LprA, LprG, LpqH and PstS1, some lipoproteins are dependent on other coreceptors (TLR1, CD14 and/or CD36); the lipoproteins act as agonists to modulate antigen presenting cell functions in response to the pathogen (PubMed:19362712). M.tuberculosis HSP70 (dnaK) but not HSP65 (groEL-2) acts via this protein to stimulate NF-kappa-B expression (PubMed:15809303). Recognizes M.tuberculosis major T-antigen EsxA (ESAT-6) which inhibits downstream MYD88-dependent signaling (shown in mouse) (By similarity). Forms activation clusters composed of several receptors depending on the ligand, these clusters trigger signaling from the cell surface and subsequently are targeted to the Golgi in a lipid-raft dependent pathway. Forms the cluster TLR2:TLR6:CD14:CD36 in response to diacylated lipopeptides and TLR2:TLR1:CD14 in response to triacylated lipopeptides (PubMed:16880211). Required for normal uptake of M.tuberculosis, a process that is inhibited by M.tuberculosis LppM (By similarity)