py_hla_match.matching.MatchResult
- class py_hla_match.matching.MatchResult(patient, donor, pairing_score, allele_match_levels, ard_match_levels=None, ard_match_level_certainty=None, molecular_match_levels=None, molecular_match_level_certainty=None)[source]
Bases:
objectResult object for comparing two HLA genotype pairs at a single locus.
This class is designed for research use to describe HLA match or mismatch categories between two individuals.
- Variables:
patient – HLA allele pair in the ‘patient’ role.
donor – HLA allele pair in the ‘donor’ role.
pairing_score – Internal ordinal score summarising the two
AlleleMatchLevelvalues.allele_match_levels – Tuple of
AlleleMatchLevelvalues for the two allele-level comparisons (patient allele 1 vs donor allele X, patient allele 2 vs donor allele Y).ard_match_levels – Tuple of
ARDMatchLevelvalues refining ARD-equivalent allele pairs (NOT_APPLICABLEif not ARD-matched).ard_match_certainties – Tuple of
ARDMatchLevelCertaintyvalues indicating how certain the ARD refinement is given typing resolution.molecular_match_levels – Tuple of
MolecularMatchLevelvalues refining ARD-equivalent allele pairs at 1–4-field level (NOT_APPLICABLEif not ARD-matched).molecular_match_certainties – Tuple of
MolecularMatchLevelCertaintyvalues indicating how certain the molecular refinement is given typing resolution.dpb1_tce_status – Optional DPB1 permissive/non-permissive classification from the EBI TCE API (only populated for DPB1 loci).
is_homozygous_patient –
Trueif the patient is homozygous at this locus at ARD-reduced level,Falseif heterozygous, orNoneif ARD-reduced alleles are not available.
- Parameters:
patient (HLAPair)
donor (HLAPair)
pairing_score (int)
allele_match_levels (Tuple[AlleleMatchLevel, AlleleMatchLevel])
ard_match_levels (Tuple[ARDMatchLevel, ARDMatchLevel] | None)
ard_match_level_certainty (Tuple[ARDMatchLevelCertainty, ARDMatchLevelCertainty] | None)
molecular_match_levels (Tuple[MolecularMatchLevel, MolecularMatchLevel] | None)
molecular_match_level_certainty (Tuple[MolecularMatchLevelCertainty, MolecularMatchLevelCertainty] | None)
- get_dpb1_tce_status(api_version='3.0', timeout=10)[source]
Calculate DPB1 permissive/non-permissive classification via EBI API.
Intended for research workflows.
WARNING: may slow things down significantly.
Sets self.dpb1_tce_result to one of: - DPB1Result
- Parameters:
api_version (str) – The version of the EBI API to query (default “3.0”)
timeout (int) – Time in seconds to wait for the API response
- Returns:
The DPB1Result object, or None if the locus is not DPB1
- Return type:
DPB1Result | None
- get_match_level_for_resolution(resolution)[source]
Get locus-level match category for a given resolution.
- Parameters:
resolution (str) – Resolution level (
"basic"or"high").- Returns:
Match level for the given resolution as a string.
- Raises:
ValueError – If an unknown resolution level is requested.
- Return type:
str
- property loci_match_basic_resolution
- property loci_match_high_resolution