tidytcells.tr#

Functions to manage TR gene data.

Functions

tidytcells.tr.get_aa_sequence(gene: str, species: str = 'homosapiens') Dict[str, str][source]#

Look up the amino acid sequence of a given TR gene.

Note

This function currently only supports V genes. Support for J genes is planned for the future.

Parameters:
  • gene (str) – Standardized gene name. The gene must be specified to the level of the allele. Note that some genes, notably the non-functional ones, will not have resolvable amino acid sequences.

  • species (str) – Species to which the TR gene in question belongs (see above for supported species). Defaults to "homosapiens".

Returns:

A dictionary with keys corresponding to names of different sequence regions within the gene, and values corresponding to their amino acid sequences.

Return type:

Dict[str, str]

tidytcells.tr.query(species: str = 'homosapiens', precision: str = 'allele', functionality: str = 'any', contains_pattern: str | None = None) FrozenSet[str][source]#

Query the list of all known TR genes/alleles.

Parameters:
  • species (str) – Species to query (see above for supported species). Defaults to "homosapiens".

  • precision (str) – The level of precision to query. allele will query from the set of all possible alleles. gene will query from the set of all possible genes. Defaults to allele.

  • functionality (str) – Gene/allele functionality to subset by. "any" queries from all possible genes/alleles. "F" queries from functional genes/alleles. "NF" queries from psuedogenes and ORFs. "P" queries from pseudogenes. "ORF" queries from ORFs. An allele is considered queriable if its functionality label matches the description. A gene is considered queriable if at least one of its alleles’ functionality label matches the description. Defaults to "any".

  • contains_pattern (str) – An optional regular expression string which will be used to filter the query result. If supplied, only genes/alleles which contain the regular expression will be returned. Defaults to None.

Returns:

The set of all genes/alleles that satisfy the given constraints.

Return type:

FrozenSet[str]

tidytcells.tr.standardise(*args, **kwargs)[source]#

Alias for tidytcells.tr.standardize().

tidytcells.tr.standardize(gene: str | None = None, species: str = 'homosapiens', enforce_functional: bool = False, precision: str = 'allele', on_fail: str = 'reject', suppress_warnings: bool = False) str[source]#

Attempt to standardize a TR gene name to be IMGT-compliant.

Parameters:
  • gene (str) – Potentially non-standardized TR gene name.

  • species (str) – Species to which the TR gene belongs (see above for supported species). Defaults to "homosapiens".

  • enforce_functional (bool) – If True, disallows TR genes that are recognised by IMGT but are marked as non-functional (ORF or pseudogene). Defaults to False.

  • precision (str) – The maximum level of precision to standardize to. "allele" standardizes to the maximum precision possible. "gene" standardizes only to the level of the gene. Defaults to "allele".

  • on_fail (str) – Behaviour when standardization fails. If set to "reject", returns None on failure. If set to "keep", returns the original input. Defaults to "reject".

  • suppress_warnings (bool) – Disable warnings that are usually emitted when standardisation fails. Defaults to False.

Returns:

If the specified species is supported, and gene could be standardized, then return the standardized gene name. If species is unsupported, then the function does not attempt to standardize , and returns the unaltered gene string. Else follows the behaviour as set by on_fail.

Return type:

Union[str, None]