alleleTools.plot.graph_pathogens module
Pathogen Recognition Visualization Module.
This module provides functionality to query the IEDB (Immune Epitope Database) for visualizing the results of epitope assays related to a specific HLA allele. It helps researchers understand which pathogens might the provided allele bind to, potentially providing resistance against or susceptibility to infections.
Data source: IEDB (Immune Epitope Database) - https://www.iedb.org/
Author: Nicolás Mendoza Mejía (2025)
- alleleTools.plot.graph_pathogens.adjustFigAspect(fig, aspect: float = 1)[source]
Adjust subplot parameters to achieve the correct aspect ratio.
This function modifies the figure layout to ensure proper proportions for publication-quality plots.
- Parameters:
fig (matplotlib.figure.Figure) – Figure object to adjust
aspect (float) – Desired aspect ratio (default: 1)
- alleleTools.plot.graph_pathogens.call_function(args)[source]
Main function to execute pathogen association analysis and visualization.
This function orchestrates the complete workflow: 1. Queries IEDB for epitope-MHC binding data 2. Extracts and processes NCBI taxonomy IDs 3. Retrieves taxonomic information from NCBI 4. Generates separate visualizations for bacteria and viruses
- Parameters:
args – Parsed command line arguments containing: - email: Email for NCBI API access - allele: HLA allele to analyze - min_epitope_len: Minimum epitope length filter - max_epitope_len: Maximum epitope length filter - source: Source organism filter - host: Host organism filter - output_basename: Base name for output files
- alleleTools.plot.graph_pathogens.graph_by_genus(data: DataFrame, division: str, output_file: str)[source]
Generate a stacked bar chart showing assay results by pathogen genus.
Creates a visualization of epitope binding assay results grouped by pathogen genus, with bars showing the distribution of qualitative measures (positive, negative, etc.) for each genus.
- Parameters:
data (pd.DataFrame) – Merged dataset with IEDB and taxonomy information
division (str) – Taxonomic division to filter by (e.g., “Bacteria”, “Viruses”)
output_file (str) – Path for the output SVG file
Note
The function filters data by the specified division and creates a stacked percentage bar chart showing assay result distributions.