tidytcells.result#

Standardized result objects.

Classes

class tidytcells.result.HLAGene(original_input, error, gene_name=None, allele_designation=None)[source]#

A wrapper object for the HLA gene.

If standardization was successful, this object provides access to the standardized allele/protein/gene and other properties. When failed, the error message(s) and attempted partially standardized gene symbol can be retrieved.

property protein: str | None#

The protein name, if standardization was successful and protein-level information is available, otherwise None.

class tidytcells.result.Junction(original_input, error, corrected_junction=None, species=None)[source]#

A wrapper object for the CDR3 junction sequence.

If standardization was successful, this object provides access to the standardized junction and CDR3. When failed, the error message(s) and attempted partially standardized CDR3 can be retrieved.

property attempted_fix: str | None#

The best attempt at fixing the input sequence, only of standardization failed, if the standardization was a success this returns None.

property cdr3: str | None#

The IMGT-CDR3, excluding conserved leading C and trailing F / W / C if the standardization was successful, otherwise None.

property error: str | None#

The error message, only if standardization failed, otherwise None.

property is_standardized: bool#

True if the standardization was successful, False otherwise.

property junction: str | None#

The IMGT-junction, including conserved leading C and trailing F / W / C if the standardization was successful, otherwise None.

property original_input: str | None#

The original input sequence.

property species: str#

The species used for the gene lookup to validate the CDR3 junction.

class tidytcells.result.MhGene(original_input, error, gene_name=None, allele_designation=None, species=None)[source]#

A wrapper object for the MHC gene.

If standardization was successful, this object provides access to the standardized allele/gene and other properties. When failed, the error message(s) and attempted partially standardized gene symbol can be retrieved.

property allele: str | None#

The allele name, if standardization was successful and allele-level information is available, otherwise None.

property attempted_fix: str | None#

The best attempt at fixing the input symbol, only of standardization failed, if the standardization was a success this returns None.

property error: str | None#

The error message, only if standardization failed, otherwise None.

property gene: str | None#

The gene name, if standardization was successful, otherwise None.

property is_standardized: bool#

True if the standardization was successful, False otherwise.

property original_input: str | None#

The original input symbol.

property species: str#

The species used to validate the gene name.

property symbol: str | None#

The allele or gene (whichever is most precise) if standardization was successful, otherwise None.

class tidytcells.result.ReceptorGene(original_input, error, gene_name=None, allele_designation=None, subgroup_name=None, species=None)[source]#

A wrapper object for the receptor gene.

If standardization was successful, this object provides access to the standardized allele/gene/subgroup and other properties. When failed, the error message(s) and attempted partially standardized gene symbol can be retrieved.

property allele: str | None#

The allele name, if standardization was successful and allele-level information is available, otherwise None.

property attempted_fix: str | None#

The best attempt at fixing the input symbol, only of standardization failed, if the standardization was a success this returns None.

property error: str | None#

The error message, only if standardization failed, otherwise None.

property gene: str | None#

The gene name, if standardization was successful and gene-level information is available, otherwise None.

property gene_type: str | None#

The gene type (‘V’, ‘D’ or ‘J’), if standardization was successful, otherwise None.

get_aa_sequences(sequence_type='ALL', enforce_functional=True)[source]#

Get amino acid sequence information related to the alleles of the standardized symbol

Parameters:
  • sequence_type (str) – Which sequence to return. This can be: - For V genes: ‘FR1’, ‘FR2’, ‘FR3’, ‘CDR1’, ‘CDR2’, ‘V-REGION’ - For D genes: ‘D-REGION’ - For J genes: ‘J-REGION’, ‘J-MOTIF’ - Or ‘ALL’ to return all available sequences

  • enforce_functional (bool) – If True, only information for functional alleles is returned

Returns:

A dictionary with allele names as keys and sequences as values When sequence_type is ‘ALL’, the result is a nested dictionary with allele names as outer keys, sequence types as inner keys, and sequences as inner values.

Return type:

dict

get_all_alleles(enforce_functional=True)[source]#

Get all alleles related to the standardized symbol

Parameters:

enforce_functional (bool) – If True, only functional alleles are returned

Returns:

A list of allele names

Return type:

list

property is_standardized: bool#

True if the standardization was successful, False otherwise.

property locus: str | None#

The locus of the gene. This is typically the three-letter code (‘TRA’, ‘TRB’, ‘TRG’, ‘TRD’, ‘IGH’, ‘IGL’, ‘IGK’), but for TRAV/DV genes, ‘TRA/D’ is returned.

property original_input: str | None#

The original input symbol.

property receptor_type#

‘TR’ for T cell receptor genes, or ‘IG’ for antibody genes if standardization was successful, otherwise None.

property species: str#

The species used to validate the gene name.

property subgroup: str | None#

The subgroup name, if standardization was successful, otherwise None.

property symbol: str | None#

The allele, gene or subgroup (whichever is most precise) if standardization was successful, otherwise None.