Skip to main content

Python Eplet Load Calculator

Project description

DOI Downloads

PELC (Python Eplet Load Calculator)

Overview

PELC is a Python package designed to calculate efficiently the HLA Eplet Load (based on the EpRegistry database) between donors and recipients by loading in a pandas.DataFrame in eplet_comparison.compute_epletic_load the recipients' and donors' typings. See minimal reproducible example for more details.

Getting started

Install from PyPI (recommended)

To use pelc, run pip install pelc in your terminal.

Usage

Here is a minimal example with the file Template.xlsx (click to download):

import pandas as pd

from pelc import eplet_comparison, eplet_comparison_aux, output_type

if __name__ == "__main__":
    input_path: str = "Template.xlsx"

    output_path: str = "MyOutput"
    input_df: pd.DataFrame = pd.read_excel(
        input_path, sheet_name="My Sheet", index_col="Index"
    )

    donordf: pd.DataFrame
    recipientdf: pd.DataFrame
    donordf, recipientdf = eplet_comparison_aux.split_dataframe(input_df)

    eplet_comparison.compute_epletic_load(
        donordf,
        recipientdf,
        output_path,
        output_type.OutputType.DETAILS_AND_COUNT,
        class_i = True,  # Compute class I eplets comparison?
        class_ii = True,  # Compute class II eplets comparison?
        verifiedonly = False,  # How should the epletic charge be computed? Verified eplets only? Or all eplets?
        exclude = None,  # list of indices to exclude
        interlocus2 = True  # whether or not to take into account interlocus eplets for HLA of class II
    )

Advanced usage:

If one wants to determine the eplet mismatches between a donor and a recipient but without taking into account a certain locus, one can use A*, B*, ..., DPB1* as the allele name for both recipients and donors on this locus and the eplet mismatch computation will only take into account the loci filled in.

Exit codes:

- 55: an eplet did not match the regular expression '^\d+' (ABC, DR, DQ or DP) and it also did not match the regular
expression '^.[pqr]*(\d+)' (interlocus2) either.

Unit tests

Tested on Python 3.10.2 & Python 3.11.0.

platform win32 -- Python 3.10.2, pytest-7.2.0, pluggy-1.0.0
plugins: mypy-0.10.0
collected 19 items                                                                                                                                     

unit_tests_mypy.py ..                                                               [ 10%]
unit_tests_simple.py .                                                              [ 15%] 
pelc\__init__.py .                                                                  [ 21%] 
pelc\_unexpected_alleles.py .                                                       [ 26%] 
pelc\epitope_comparison.py .                                                        [ 31%] 
pelc\epitope_comparison_aux.py .                                                    [ 36%] 
pelc\output_type.py .                                                               [ 42%] 
tests\__init__.py .                                                                 [ 47%] 
tests\base_loading_for_tests.py .                                                   [ 52%] 
tests\test_epitope_mismatches.py ......                                             [ 78%]
tests\test_pelc.py ..                                                               [ 89%] 
tests\test_unexpected_alleles.py ..                                                 [100%]
platform win32 -- Python 3.11.0, pytest-7.2.0, pluggy-1.0.0
plugins: mypy-0.10.0
collected 19 items

unit_tests_mypy.py ..                                                               [ 10%]
unit_tests_simple.py .                                                              [ 15%]
pelc\__init__.py .                                                                  [ 21%]
pelc\_unexpected_alleles.py .                                                       [ 26%]
pelc\epitope_comparison.py .                                                        [ 31%]
pelc\epitope_comparison_aux.py .                                                    [ 36%]
pelc\output_type.py .                                                               [ 42%]
tests\__init__.py .                                                                 [ 47%]
tests\base_loading_for_tests.py .                                                   [ 52%]
tests\test_epitope_mismatches.py ......                                             [ 78%]
tests\test_pelc.py ..                                                               [ 89%]
tests\test_unexpected_alleles.py ..                                                 [100%]

About the source code

  • Follows PEP8 Style Guidelines.
  • All functions are unit-tested with pytest.
  • All variables are correctly type-hinted, reviewed with static type checker mypy.
  • All functions are documented with docstrings.

Useful links:

Citation

If you use this software, please cite it as below.

  • APA:
Lhotte, R., Usureau, C., & Taupin, J. (2022). Python Epitope Charge Calculator (Version 0.3.1) [Computer software].
https://doi.org/10.5281/zenodo.7254809
  • BibTeX:
@software{Lhotte_Python_Epitope_Charge_2022,
    author = {Lhotte, Romain and Usureau, Cédric and Taupin, Jean-Luc},
    doi = {doi.org/10.5281/zenodo.7254809},
    month = {10},
    title = {{Python Eplet Load Calculator}},
    version = {0.3.1},
    year = {2022}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pelc-0.3.1.tar.gz (44.1 kB view hashes)

Uploaded Source

Built Distribution

pelc-0.3.1-py3-none-any.whl (46.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page