Добавил:
Sekretar
kiopkiopkiop18@yandex.ru
t.me/Prokururor I Вовсе не секретарь, но почту проверяю
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Ординатура / Хирургия / Библиотека им академика М.И. Перельмана / Книга_5529_Библиотеки_им_академика_М_И_Перельмана
.pdf
134 Bioinformatics of Autoimmune Diseases
4.2.2.1.13 se quence
The sequence eld provides the full amino acid sequence, its length, molecular mass, and the last
modication date. The sequence for HLA-A consists of 365 amino acids with a mass of 41,433 Da.
{
"sequence": {
"sequence": "MAVMAPRTLVLLLSGALALTQTWAGSHSMRYFSTSVSRP...",
"length": 365,
"mass": 41433,
"modified": "2023-05-10",
"version": 2
}
}
4.2.2.1.14 uniProtKBCrossReferences
The uniProtKBCrossReferences eld lists external databases that reference HLA-A. For
example, it has a PDB ID “1QVO”, linking it to the PDB.
{
"uniProtKBCrossReferences": [
{
"type": "PDB",
"id": "1QVO"
}
]
}
4.2.2.2 Retrieving Data from UniProt Databases via RESTful APIs
Retrieving data from bioinformatics databases for autoimmune disease research requires understanding the available access methods, including public APIs, FTP downloads, and database-specic
query tools. Many of these databases provide RESTful APIs or other programmatic access points,
allowing researchers to automate data retrieval and processing. The process typically involves sending HTTP requests to the database API, receiving responses in JSON or XML format, and parsing
the data using Python libraries such as requests, pandas, and Biopython.
RESTful APIs (Representational State Transfer Application Programming Interfaces) are a set
of web service design principles that enable communication between different systems over the
internet. RESTful APIs use standard HTTP methods, such as GET, POST, PUT, and DELETE,
to facilitate interactions between clients (such as web browsers or Python scripts) and servers
(such as bioinformatics databases). They allow applications to request and retrieve data from
databases without requiring direct access to the underlying storage. In the eld of bioinformatics, where massive datasets related to genes, proteins, and molecular structures are frequently
accessed and analyzed, RESTful APIs have become an essential tool for automating data retrieval
and processing.
Bioinformatics databases store vast amounts of biological data, ranging from genomic sequences
to protein structures and metabolic pathways. Traditionally, researchers had to manually download and process these datasets, which was time-consuming and inefcient. With the adoption of
RESTful APIs, researchers can now retrieve only the necessary data in a structured format, minimizing storage and computation overhead. These APIs provide standardized endpoints, typically
URLs, through which users can query databases and obtain results in machine-readable formats
such as JSON or XML. This approach enables seamless integration of bioinformatics databases
with various programming environments, particularly Python, which is widely used in computational biology and data science.

135 Bioinformatics Databases
The concept of REST was rst introduced by Roy Fielding in his doctoral dissertation at the
University of California, Irvine, in 2000. Fielding described REST as an architectural style for
designing scalable web services that leverage the principles of the HTTP protocol. Unlike earlier
web service models, such as SOAP (Simple Object Access Protocol), REST emphasized simplicity, statelessness, and a uniform interface. This made it particularly attractive for applications that
required fast, lightweight, and scalable communication over the internet.
As web applications grew in complexity, RESTful APIs gained popularity due to their efciency
and ease of implementation. Many companies and institutions started adopting RESTful APIs to
facilitate interactions between their services. In bioinformatics, the need for programmatic access
to large datasets led to the development of RESTful APIs by organizations such as the NCBI,
European Bioinformatics Institute (EBI), and UniProt Consortium. These APIs provide researchers
with an efcient way to query biological databases without manually downloading massive datasets.
The introduction of RESTful APIs in bioinformatics marked a signicant shift in how researchers
accessed biological information. Instead of dealing with static les and local databases, researchers
could now send HTTP requests to web-based servers, retrieve relevant data in real time, and integrate it directly into their computational workows. This approach not only improved accessibility
but also enabled large-scale, automated analyses that would have been infeasible with traditional
data retrieval methods.
RESTful APIs are designed based on a set of architectural principles that ensure they remain
scalable, maintainable, and easy to use. These principles dene how clients and servers should
communicate over the internet, ensuring consistency across different applications. The six core
principles of RESTful APIs are the following.
4.2.2.2.1 Statelessness
One of the fundamental principles of REST is statelessness, which means that each API request
must contain all the necessary information for the server to process it. The server does not retain
any client-specic state between requests. This design choice enhances scalability since the server
does not need to manage user sessions. For instance, when querying a bioinformatics database for a
gene sequence, the request must include all relevant parameters (such as the gene name or accession
number) so that the server can process it independently.
4.2.2.2.2 Client–Server Architecture
RESTful APIs follow a client–server model, where the client (such as a Python script) sends requests
to a server (such as the NCBI database) that processes the request and returns the response. This
separation of concerns allows clients to evolve independently of the server, enabling exibility in
how data is accessed and used. For example, a bioinformatics researcher can use a Python script
to query the UniProt API for protein sequences while the underlying database remains unchanged.
4.2.2.2.3 Uniform Interface
A uniform interface ensures that all API interactions follow a consistent structure. This typically
includes the following:
Resource Identication: Each resource is identied by a unique URL (e.g., https://rest.uniprot.
org/uniprotkb/P04637.json for retrieving protein data from UniProt).
Standard HTTP Methods:
• GET for retrieving data (e.g., fetching a gene sequence),
• POST for submitting new data,
• PUT for updating existing data,
• DELETE for removing data.
Standard Response Formats: Most APIs return data in JSON or XML, making it easier to
parse and use in programming environments.

136 Bioinformatics of Autoimmune Diseases
4.2.2.2.4 Cacheability
RESTful APIs allow responses to be cached to improve performance. When retrieving frequently
accessed bioinformatics data, caching mechanisms can reduce the load on servers and decrease
response times. For instance, if a researcher repeatedly queries the same gene sequence from
Ensembl, caching can help avoid redundant requests.
4.2.2.2.5 Layered System
A RESTful API may consist of multiple layers, where clients do not directly interact with the database server but instead go through intermediaries such as load balancers or proxies. This design
improves security, scalability, and exibility. In bioinformatics, multiple servers may be involved in
handling requests for large datasets, ensuring efcient data distribution.
4.2.2.2.6 Code-on-Demand
Although not commonly used, RESTful APIs can send executable code, such as JavaScript, to
clients to extend their functionality dynamically. This principle is optional and rarely applied in
bioinformatics, where the primary goal is to retrieve structured data.
By adhering to these principles, RESTful APIs ensure that biological databases can handle high
volumes of requests efciently while maintaining exibility for diverse computational needs.
4.2.2.3 Retrieving Autoimmune Disease Data via RESTful APIs
To study autoimmune diseases, bioinformatics databases provide vast amounts of genetic, protein,
and pathway-related data. Using RESTful APIs, researchers can programmatically retrieve information related to autoimmune diseases from various bioinformatics resources.
Steps for Using RESTful APIs
1. Identify the API
Before querying a bioinformatics database, determine which API provides the relevant
data. Many databases offer RESTful APIs as follows:
• NCBI Entrez API – For accessing genetic, protein, and disease-related data.
• Ensembl REST API – For retrieving genome annotation and variation data.
• KEGG API – For accessing pathway, disease, and drug interaction data.
• UniProt API – For protein sequence and functional information.
2. Obtain API Access
Some APIs require authentication or an API key to prevent excessive trafc and ensure
security. Public APIs may have usage limits but do not require authentication. Registered
APIs (e.g., NCBI, UniProt) may require an API key for extended access. OAuth-based
authentication is necessary for restricted datasets.
3. Understand API Documentation
Each API provides documentation outlining:
• Endpoints (e.g., https://rest.uniprot.org/uniprotkb/search?query=autoimmune)
• Parameters (e.g., query lters like disease names, gene symbols, or organism type)
• Response format (JSON, XML, or text-based formats)
4. Construct API Requests
Using API documentation, formulate the correct request format. RESTful APIs typically
support the following:
• GET Requests – For retrieving data (most common).
• POST Requests – For submitting data or batch queries.
5. Send Requests
Send API requests using tools as follows:
• Command Line (cURL)
• Python (requests, urllib modules)
• Postman – A GUI-based API testing tool.

137 Bioinformatics Databases
6. Handle API Responses
Most bioinformatics APIs return responses in JSON or XML format.
7. Process and Analyze Data
Once retrieved, the data can be processed for bioinformatics analysis:
• Convert to CSV, pandas DataFrame, or SQL database for easy handling.
• Perform sequence alignment, gene enrichment analysis, or pathway mapping.
• Visualize data using Matplotlib, Seaborn, or Cytoscape.
8. Optimize Requests
To prevent excessive queries and improve efciency:
• Implement Rate-Limiting: Many APIs restrict requests per second/minute.
• Use Caching: Store responses locally to avoid redundant API calls.
• Paginate Requests: Retrieve large datasets in chunks using pagination parameters.
The following examples demonstrate how to use RESTful APIs to retrieve data from various
bioinformatics databases. However, these methods are not limited to just these databases; they can
be generalized for accessing data from other sources as well. The output is typically in JSON or
XML format, which facilitates data extraction using JSON or XML parsers. This exibility allows
researchers to efciently process and analyze the retrieved information for their specic needs.
4.2.2.3.1 Using Command Line (cURL) with RESTful APIs
The command line tool cURL (Client URL) is a powerful utility used for transferring data between
a client and a server. It is widely utilized in the context of RESTful APIs, allowing users to send
HTTP requests directly from the command line without requiring a web browser or GUI application. With cURL, developers and system administrators can interact with APIs efciently, retrieving
or sending data using standard HTTP methods such as GET, POST, PUT, PATCH, and DELETE.
This makes it an essential tool for testing, debugging, and automating API interactions.
One of the most common uses of cURL in RESTful API development is fetching data from a
web service. By using a simple command like curl https://api.example.com/data, users can make
a GET request and retrieve JSON, XML, or plain text responses. Similarly, developers can send
POST requests with JSON payloads using the -X POST ag along with the -d option to specify request body data. For authentication, cURL supports headers such as authorization tokens,
API keys, and session cookies, making it suitable for interacting with both public and secured
endpoints.
cURL is highly exible and available on multiple platforms, including Linux, macOS, and
Windows. On Unix-based systems, it is often pre-installed, whereas on Windows, it can be installed
manually or accessed through the Windows Subsystem for Linux (WSL). This cross-platform availability ensures that developers can use cURL seamlessly across different environments, whether
working on cloud-based servers, local development machines, or automated CI/CD pipelines.
Beyond simple API requests, cURL supports advanced features such as handling redirects,
retries, and rate limits, making it a reliable choice for interacting with RESTful services in production environments. Developers also leverage cURL within shell scripts to automate API calls, fetch
and process responses, or trigger actions in microservices architectures. Due to its lightweight and
scriptable nature, cURL remains one of the most widely used tools for RESTful API communication, offering a simple yet powerful interface for interacting with web services.
The cURL can be run as a Bash script, which is essentially a plain text le that contains a
sequence of commands intended for execution within a Unix-based operating system. Save the
script in a text le with a .sh extension, which indicates that it is a shell script.
After saving the script, you can execute it by using the bash command followed by the script’s
lename. For example, if the script is named script.sh, you can run it by entering the following
command in the terminal:
bash script.sh

138 Bioinformatics of Autoimmune Diseases
Alternatively, you can make the script executable and run it directly:
chmod +x script.sh
./script.sh
By using Bash scripting, you can automate repetitive tasks, streamline workows, and execute
complex sequences of commands efciently. Bash scripts are widely used in bioinformatics.
4.2.2.3.1.1 Fetching Protein Information from UniProt You may need to install jq, which is
a lightweight and powerful command-line JSON processor that allows users to parse, lter, and
manipulate JSON data easily. It is especially useful when working with RESTful APIs that return
large amounts of structured data in JSON format.
sudo apt update
sudo apt install jq -y
UniProt provides a query-based endpoint where you can search for specic diseases. You can
use the curl command in Bash to fetch proteins related to autoimmune diseases. The script is also
available in un ipro t _ rest f ul1.s h.
UNI_URL="https://rest.uniprot.org/uniprotkb/search"
PARAMS="?query=autoimmune+disease&format=json"
curl -X GET \
${UNI_URL}${PARAMS} \
-H "Accept: application/json" \
> uniprot_autoimmune.json
When you run the above script, it sends a GET request to UniProt’s search API to nd proteins
associated with “autoimmune disease”, retrieves the data in JSON format, and saves the output to
a le named “uniprot _ autoimmune.json”. Later, we will demonstrate how to use a JSON
parser to extract information from a JSON-formatted le.
You can rene your query by adding additional lters. For example, to only retrieve reviewed
Swiss-Prot entries (curated proteins) (u nipr ot _ re st f ul2.s h):
URL="https://rest.uniprot.org/uniprotkb/search"
PARAM="?query=autoimmune+disease+AND+reviewed:true&format=json"
curl -X GET \
"${URL}${PARAM}" \
-H "Accept: application/json" \
> uniprot_autoimmune_reviewed.json
The following Bash script retrieves the Accession (unique protein ID), Protein Name, Gene
Name, Organism Name, and Keywords (which may include disease-related terms) (uniprot _
re stf ul3.s h ).
URL="https://rest.uniprot.org/uniprotkb/search"
PARAM1="?query=autoimmune+disease"
PARAM2="&fields=accession,protein_name,gene_names,organism_name,keyword"
PARAM3="&format=json"
curl -X GET \
"${URL}${PARAM1}${PARAM2}${PARAM3}" \
-H "Accept: application/json" \
> uniprot_prot_info.json

139 Bioinformatics Databases
FIGURE 4.4 Fields in JSON format extracted using jq command.
To get manually reviewed (high-quality) proteins (u n ipro t _ restf ul4.sh):
URL="https://rest.uniprot.org/uniprotkb/search"
PARAM1="?query=autoimmune+disease+AND+reviewed:true"
PARAM2="&fields=accession,protein_name,gene_names,organism_name,keyword"
PARAM3="&format=json"
curl -X GET \
"${URL}${PARAM1}${PARAM2}${PARAM3}" \
-H "Accept: application/json" \
> uniprot_prot_info_reviewed.json
The next Bash script (unip rot _ r estf u l5.s h) retrieves UniProt data in JSON format and
saves it to a le named uniprot _ autoimmune.json. Then, it uses jq, a command-line JSON
processor, to extract and format specic elds from the JSON response (Figure 4.4). The jq com-
mand reads the le and processes each result, selecting key details such as the UniProt accession
number, protein name, gene name, organism name, and keywords.
It rst accesses .results[], which represents each entry in the JSON response. The Accession
eld is extracted using .prim aryAccession, which uniquely identies each protein. The
Protein eld is retrieved from .proteinDescription.recommendedName.fullName,
which provides the full recommended name of the protein. Similarly, the Gene eld is extracted
from. genes[0].geneName.value, which picks the rst gene name associated with the protein.
The Organism eld is taken from .organism.commonName, providing the common name of
the species. Finally, the Keywords eld lists relevant biological terms associated with the protein
entry, helping to identify whether it relates to autoimmune diseases.
This approach allows ltering and structuring the output in a readable format, making it easier
to analyze disease-related proteins.
URL="https://rest.uniprot.org/uniprotkb/search"
PARAM="?query=autoimmune+disease&format=json"
curl -X GET \
"${URL}${PARAM}" \
-H "Accept: application/json" \

140 Bioinformatics of Autoimmune Diseases
> uniprot_autoimmune.json
jq '
.results[] |
{
Accession:.primaryAccession,
Protein:.proteinDescription.recommendedName.fullName.value,
Gene:.genes[0].geneName.value,
Organism:.organism.commonName,
Keywords:.keywords
}
' uniprot_autoimmune.json > selected_fields.json
Parsing a JSON le and transforming it into a CSV le involves reading the structured data,
extracting relevant elds, and formatting them into a tabular form. JSON is a widely used format for
storing and exchanging data, typically organized as key-value pairs within nested structures. CSV,
on the other hand, is a simple text format where data is arranged in rows and columns, making it
suitable for spreadsheets and databases. The conversion process requires handling the hierarchical
nature of JSON, especially when dealing with nested lists or dictionaries, and ensuring that the
output maintains readability.
The rst step in parsing a JSON le is to load its contents into a Python program using the json
module. If the JSON le contains a well-structured array of objects, it can be loaded directly using
js on.lo a d(). However, if the le consists of multiple individual JSON objects separated by new
lines, each object must be parsed separately to avoid errors. Once the JSON data is loaded, the next
step is to extract the required elds. Since JSON can store nested structures, special handling is
required for lists and sub-dictionaries. For example, if a JSON object contains a list of keywords,
these must be attened and joined into a single string to t within a CSV cell.
Writing the extracted data to a CSV le is done using Python’s csv module. The DictWriter
class is commonly used, allowing each JSON object to be mapped to a corresponding row in the
CSV format. A header row is usually written rst, specifying the column names based on the JSON
keys. Iterating over the JSON data, the script writes each row, ensuring that complex data types such
as lists are formatted properly, often by concatenating list values with a delimiter like a vertical bar
(|). The resulting CSV le is then saved to disk, ready for use in spreadsheet applications or further
data processing.
Handling JSON-to-CSV conversion requires addressing potential errors such as missing keys,
irregular data structures, or improperly formatted JSON. If a JSON le is not enclosed in a proper
array, adjustments must be made to convert it into a valid list before parsing. Additionally, encoding considerations are essential, especially when dealing with special characters, ensuring that the
CSV le remains readable across different platforms. By following these steps, JSON data can be
effectively transformed into a structured, tabular format that is widely compatible with various
analytical tools and databases.
import json
import csv
# Define file paths
json_file_path = "selected_fields.json" # Update the path if necessary
csv_file_path = "output.csv"
# Read the JSON file and fix formatting issues
with open(json_file_path, "r", encoding="utf-8") as file:
content = file.read()
# Ensure JSON objects are correctly structured as a list
content = "[" + content.replace("}\n{", "},\n{") + "]"
try:
data = json.loads(content) # Convert corrected content to JSON

141 Bioinformatics Databases
except json.JSONDecodeError as e:
print(f"Error parsing JSON: {e}")
exit(1)
# Open CSV file for writing
with open(csv_file_path, "w", newline="", encoding="utf-8") as csv_file:
fieldnames =["Accession","Protein","Gene","Organism","Keywords"]
writer = csv.DictWriter(csv_file, fieldnames=fieldnames)
writer.writeheader() # Write CSV header
# Process each JSON object and write to CSV
for entry in data:
keywords = "|".join([kw["name"] for kw in entry.get("Keywords",
[])])
writer.writerow({
"Accession": entry["Accession"],
"Protein": entry["Protein"],
"Gene": entry["Gene"],
"Organism": entry["Organism"],
"Keywords": keywords
})
print(f"CSV file has been created successfully: {csv_file_path}")
The above Python script “js o n 2 c s v.p y ” begins by dening le paths for both the input JSON
le and the output CSV le. It then reads the JSON le’s contents, which may contain multiple
separate JSON objects rather than a properly formatted array. Since JSON parsers expect a single
valid structure, the script ensures that the data is properly formatted by wrapping the objects inside
square brackets and replacing improperly formatted delimiters to create a valid JSON array. This
preprocessing step is crucial for handling raw JSON les that do not conform to the standard list
format.
Once the JSON content is corrected, the script attempts to parse it using the jso n.lo ad s()
function. If the data is properly structured, it is loaded into a Python list, where each element represents a separate JSON object. If an error occurs during parsing, the script outputs a message and
exits, preventing further issues. After successfully parsing the JSON data, the script opens a CSV
le for writing and denes column headers corresponding to the JSON keys. The DictWriter
class from Python’s csv module is used to facilitate the conversion, ensuring that each JSON object
is written as a row in the CSV format.
During the conversion process, the script iterates through each JSON object, extracting relevant
elds such as accession number, protein name, gene name, organism, and keywords. Since the
“Keywords” eld is stored as a list of dictionaries, the script processes this nested structure by
extracting only the “name” values and joining them with a | separator. This ensures that multiple
keywords are stored in a single CSV cell without losing information. Finally, the script writes each
formatted row to the CSV le, providing a structured output that can be easily analyzed or imported
into spreadsheet applications.
By following this structured approach, the script successfully transforms JSON data into a CSV
le while handling potential formatting issues. The inclusion of error handling ensures that the
script can process real-world JSON les without failing due to minor inconsistencies. Once the
conversion is complete, the script outputs a conrmation message, indicating that the CSV le has
been created successfully. This makes it a reliable solution for converting hierarchical JSON data
into a structured format suitable for analysis and reporting.
4.2.2.3.2 Using Python with RESTful API
RESTful API provides a structured way for Python programs to interact with external databases
and retrieve information in a programmatic manner. The UniProt REST API allows researchers

142 Bioinformatics of Autoimmune Diseases
and developers to access biological data on proteins, including sequences, functional annotations,
and cross-references to other databases. Using Python, one can send HTTP requests to the UniProt
API, specifying the desired query parameters, and receive responses in a structured format such as
JSON. This enables automation of large-scale data retrieval, reducing the need for manual searches
on the UniProt website. The API is particularly useful for bioinformatics applications, where vast
amounts of protein data must be analyzed efciently.
Python provides built-in and third-party libraries like requests and http.c l ie nt to communicate with RESTful APIs. The requests library simplies the process by allowing users to send
GET or POST requests and handle responses with minimal code. When searching for protein data
in UniProt, a Python script can construct a query URL, send a request, and parse the returned JSON
data into a structured dictionary. This allows users to extract specic information, such as protein
sequences, functional annotations, or cross-references to PDB, Kyoto Encyclopedia of Genes and
Genomes (KEGG), or Ensembl. The ability to programmatically access and lter UniProt data
makes it easier to integrate with bioinformatics pipelines, where automation is crucial.
RESTful APIs support exible querying, enabling searches based on protein accession numbers,
gene names, organism names, or functional keywords. For example, querying the UniProt API for
proteins encoded by the HLA-A gene can return multiple related entries, including sequence variants and isoforms. Developers can rene these searches using query parameters to limit results to
reviewed Swiss-Prot entries, exclude unreviewed TrEMBL data, or retrieve only specic protein
attributes. The JSON response format is particularly advantageous, as it can be easily processed
using Python’s json module, enabling structured storage, ltering, and analysis of protein data.
By leveraging RESTful APIs, bioinformatics researchers can scale their workows to analyze
thousands of protein records without manual intervention. They can programmatically update their
datasets by periodically re-fetching protein information, ensuring they always work with the latest
biological data. This approach also supports integration with machine learning models, where protein features extracted from UniProt can serve as input for predictive analysis. Overall, using Python
to interact with the UniProt API enhances efciency, allowing scientists to rapidly retrieve and
analyze high-quality protein data for research in genomics, structural biology, and drug discovery.
4.2.2.3.2.1 Retrieving a UniProt Protein Record in JSON Format The fetch _ hla_ a_
u n ip r o t(), in the Python script “fetch _ un iprots _ reco d.py ”, is designed to retrieve a
protein record from the UniProt database and save it as a JSON le. It rst constructs a request to
the UniProt REST API using the accession number (e.g., P04439), which uniquely identies the
protein of interest. The function then sends an HTTP GET request to fetch the data, ensuring that
the request was successful before proceeding. If the request is valid, the response is parsed into
JSON format, and the data is written to a le, ensuring proper indentation for readability. In case
of connection errors or server failures, the function includes exception handling to notify the user
of any issues. By automating data retrieval, this function facilitates the integration of UniProt data
into bioinformatics pipelines, allowing researchers to quickly obtain and analyze essential protein
information without manual downloads.
import requests
import json
def fetch_hla_a_uniprot(uniprotID, output_file="uniprot.json"):
# UniProt API URL for HLA-A (P04439)
url = f"https://rest.uniprot.org/uniprotkb/{uniprotID}.json"
try:
# Fetch data from UniProt API
response = requests.get(url)
response.raise_for_status()# Raise an error for HTTP failures
# Parse JSON response
data = response.json()

143 Bioinformatics Databases
# Save JSON data to a file
with open(output_file, "w", encoding="utf-8") as json_file:
json.dump(data, json_file, indent=4)
print(f"{uniprotID} record saved successfully as
'{output_file}'.")
except requests.exceptions.RequestException as e:
print(f"Failed to fetch data from UniProt: {e}")
# Run the function
uniprotID = "P04439"
fetch_hla_a_uniprot(uniprotID, "hla_a.json")
4.2.2.3.2.2 Fetching Disease-Associated Proteins from UniProt Using Python This Python
program “fetch _ uniprots _ by _ disease.py” retrieves proteins associated with auto-
immune diseases from the UniProt database using the UniProt REST API. It allows researchers
to fetch UniProt accession IDs, protein names, gene names, and associated organisms by simply
providing a disease name. The retrieved data is structured into a pandas DataFrame and saved as a
CSV le, making it easy to analyze and integrate into further research (Figure 4.5).
One of the key advantages of using UniProt’s JSON-based API response is its exibility;
researchers can easily extract additional elds such as molecular functions, subcellular localization, or interaction data, simply by modifying the query. The program is structured to handle nested
JSON elds properly, ensuring that protein names, gene names, and other details are extracted
cleanly without errors.
For example, when querying systemic lupus erythematosus (SLE), the output includes proteins
like cytotoxic T-lymphocyte protein 4 (CTLA4), alpha-1-antitrypsin (SERPINA1), and HLA class
II histocompatibility antigen (HLA-DRB1), among others. The results are formatted with column
names using underscores for easy processing in downstream bioinformatics tools. The saved CSV
le ensures that researchers can analyze the data ofine or import it into computational pipelines.
By leveraging UniProt’s structured JSON format, researchers can efciently fetch and expand
upon disease-specic protein data with ease, making this script an essential tool for those working
in bioinformatics, immunology, and molecular biology.
4.2.2.3.2.3 Fetching FASTA Sequences of Proteins Associated with Autoimmune Diseases
FASTA sequences are widely used in various bioinformatics and immunological research applications for studying autoimmune diseases. These sequences, representing the amino acid structures of
proteins, play a crucial role in understanding disease mechanisms, developing diagnostic tools, and
designing targeted therapies.
FIGURE 4.5 CSV containing UniProt protein data linked to autoimmune diseases.
Соседние файлы в папке Библиотека им академика М.И. Перельмана
