API reference

python_codon_tables.csv_string_to_codons_dict(csv_string)

Transform a CSV string of a codon table to a dict.

python_codon_tables.download_codons_table(taxid=316407, target_file=None, timeout=5)

Get all data from all of this package’s builtin codon usage tables.

python_codon_tables.get_all_available_codons_tables(replace_U_by_T=True)

Get all data from all of this package’s builtin codon usage tables.

python_codon_tables.get_codons_table(table_name, replace_U_by_T=True, web_timeout=5)

Get data from one of this package’s builtin codon usage tables.

The table_name argument very flexible on purpose, it can be either an integer representing a taxonomic ID (which will be downloaded from the kazusa database), or a string “12245” representing a TaxID, or a string “e_coli_316407” referring to a builtin table of python_codon_optimization, or a short form “e_coli” which will be automatically extended to “e_coli_316407” (at your own risks).

If a taxonomic ID is provided and no table with this taxID is present in the codon_usage_data/tables/ folder, the table will be downloaded from the http://www.kazusa.or.jp/codon website. As this website sometimes go down, the parameter web_timeout controls how long to wait before a Python exception is raised, informing the user that Kazusa may be down.

The replace_U_by_T argument will replace all codons names from UAA to TAA etc.

Returns a dict {“*”: {‘TAA’: 0.64…}, ‘K’: {‘AAA’: 0.76…}, …}

python_codon_tables.table_with_U_replaced_by_T(table)