alleleTools.format.from_ikmb_hla module

Consensus HLA Genotyping Module.

This module generates consensus HLA genotypes from multiple genotyping algorithm results. It handles the integration of results from different HLA typing tools, resolves conflicts, and produces high-confidence consensus calls. It is initially designed to work with the JSON reports generated by the IKMB HLA genotyping pipeline.

Input formats: - JSON reports from IKMB HLA genotyping pipeline

Author: Nicolás Mendoza Mejía (2023)

class alleleTools.format.from_ikmb_hla.ConsensusGene(name: str, calls: dict, allele_parser: AlleleParser, coverage: List[dict] = [])[source]

Bases: Gene

consensus_dict(min_support: float) dict[source]

Convert this object into a dictionary

Parameters:

min_support (float) – Minimum support threshold for consensus calls.

Returns:

Dictionary representation of the consensus gene.

Return type:

dict

get_consensus_call(min_support: float) Tuple[List[str], List[float]][source]

Determine the consensus alleles and returns two values

Parameters:

min_support (float) – Minimum support threshold for consensus calls.

Returns:

list of consensus alleles support: percentage of algorithms supported the consensus alleles

Return type:

alleles

set_consensus_settings(normalize_weight: bool, max_support: float)[source]
class alleleTools.format.from_ikmb_hla.ConsensusReport(report: dict, allele_parser: AlleleParser)[source]

Bases: Report

consensus(min_support: float) List[dict][source]

Generate a consensus report for the given sample.

Parameters:

min_support (float) – Minimum support threshold for consensus calls.

Returns:

Consensus report for the given sample.

Return type:

List[dict]

alleleTools.format.from_ikmb_hla.call_function(args)[source]

Main function to execute consensus genotyping.

Processes multiple JSON genotyping reports and generates consensus HLA calls using evidence-based algorithms. Outputs results in allele table format.

Parameters:

args – Parsed command line arguments containing: - input: List of JSON file handles with genotyping reports - output: Path to output consensus file

alleleTools.format.from_ikmb_hla.reports_as_allele_table(reports: DataFrame, phe_file: str) AlleleTable[source]
alleleTools.format.from_ikmb_hla.setup_parser(subparsers)[source]

Set up the argument parser for the consensus command.

Parameters:

subparsers – The subparsers object to add this command to.

Returns:

The configured parser for consensus.

Return type:

argparse.ArgumentParser