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
= "P41440"
uniprot_id = fetch_uniprot_data(uniprot_id)
data display_uniprot_data(data)
UniProt ID: P41440
Protein Name: Reduced folate transporter
Organism: Homo sapiens
Function: Antiporter that mediates the import of reduced folates or a subset of cyclic dinucleotides, driven by the export of organic anions (PubMed:10787414, PubMed:15337749, PubMed:16115875, PubMed:22554803, PubMed:31126740, PubMed:31511694, PubMed:32276275, PubMed:7826387, PubMed:9041240). Mechanistically, acts as a secondary active transporter, which exports intracellular organic anions down their concentration gradients to facilitate the uptake of its substrates (PubMed:22554803, PubMed:31126740, PubMed:31511694). Has high affinity for N5-methyltetrahydrofolate, the predominant circulating form of folate (PubMed:10787414, PubMed:14609557, PubMed:22554803). Also able to mediate the import of antifolate drug methotrexate (PubMed:22554803, PubMed:7615551, PubMed:7641195, PubMed:9767079). Also acts as an importer of immunoreactive cyclic dinucleotides, such as cyclic GMP-AMP (2'-3'-cGAMP), an immune messenger produced in response to DNA virus in the cytosol, and its linkage isomer 3'-3'-cGAMP, thus playing a role in triggering larger immune responses (PubMed:31126740, PubMed:31511694, PubMed:36745868). 5-amino-4-imidazolecarboxamide riboside (AICAR), when phosphorylated to AICAR monophosphate, can serve as an organic anion for antiporter activity (PubMed:22554803)