tidytcells.tcr

Functions to clean and standardise TCR gene data.

Functions

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

Query the list of all known TCR 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 (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.tcr.standardise(gene: str | None = None, species: str = 'homosapiens', enforce_functional: bool = False, precision: str = 'allele', suppress_warnings: bool = False, gene_name: str | None = None) str[source]

Attempt to standardise a TCR gene name to be IMGT-compliant.

Parameters:
  • gene (str) – Potentially non-standardised TCR gene name.

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

  • enforce_functional (bool) – If True, disallows TCR 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 standardise to. 'allele' standardises to the maximum precision possible. 'gene' standardises only to the level of the gene. Defaults to 'allele'.

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

  • gene_name (str) – Alias for the parameter gene.

Returns:

If the specified species is supported, and gene could be standardised, then return the standardised gene name. If species is unsupported, then the function does not attempt to standardise , and returns the unaltered gene string. Else returns None.

Return type:

str or None

tidytcells.tcr.standardize(*args, **kwargs)[source]

Alias for tidytcells.tcr.standardise().