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
= "Q9GZU1"
uniprot_id = fetch_uniprot_data(uniprot_id)
data display_uniprot_data(data)
UniProt ID: Q9GZU1
Protein Name: Mucolipin-1
Organism: Homo sapiens
Function: Nonselective cation channel probably playing a role in the regulation of membrane trafficking events and of metal homeostasis (PubMed:11013137, PubMed:12459486, PubMed:14749347, PubMed:15336987, PubMed:27623384, PubMed:25720963, PubMed:29019983, PubMed:18794901). Acts as a Ca(2+)-permeable cation channel with inwardly rectifying activity (PubMed:25720963, PubMed:29019983). Proposed to play a major role in Ca(2+) release from late endosome and lysosome vesicles to the cytoplasm, which is important for many lysosome-dependent cellular events, including the fusion and trafficking of these organelles, exocytosis and autophagy (PubMed:11013137, PubMed:12459486, PubMed:14749347, PubMed:15336987, PubMed:25720963, PubMed:27623384, PubMed:29019983). Required for efficient uptake of large particles in macrophages in which Ca(2+) release from the lysosomes triggers lysosomal exocytosis. May also play a role in phagosome-lysosome fusion (By similarity). Involved in lactosylceramide trafficking indicative for a role in the regulation of late endocytic membrane fusion/fission events (PubMed:16978393). By mediating lysosomal Ca(2+) release is involved in regulation of mTORC1 signaling and in mTOR/TFEB-dependent lysosomal adaptation to environmental cues such as nutrient levels (PubMed:25720963, PubMed:25733853, PubMed:27787197). Seems to act as lysosomal active oxygen species (ROS) sensor involved in ROS-induced TFEB activation and autophagy (PubMed:27357649). Also functions as a Fe(2+) permeable channel in late endosomes and lysosomes (PubMed:18794901). Also permeable to Mg(2+), Na(+). K(+) and Cs(+) (By similarity). Proposed to play a role in zinc homeostasis probably implicating its association with TMEM163 (PubMed:25130899) In adaptive immunity, TRPML2 and TRPML1 may play redundant roles in the function of the specialized lysosomes of B cells (By similarity)