Helpful functions ================= GPMap comes with many helpful functions for enumerating genotype-phenotype maps. This page provides a simple list of those functions. - :ref:`get-all-genotypes-from-mutations` - :ref:`missing-genotypes` - :ref:`genotypes-to-mutations` - :ref:`genotypes-to-binary` - :ref:`get-encoding-table` .. _get-all-genotypes-from-mutations: Get all genotypes from mutations -------------------------------- .. code-block:: python from gpmap.utils import genotypes_to_mutations wildtype = "AAA" genotypes = [ "AAA", "AAB", "ABA", "BAA", "ABB", "BAB", "BBA", "BBB" ] mutations = genotypes_to_mutations(genotypes) .. _`get-encoding-table`: Get mutation encoding table --------------------------- .. code-block:: python from gpmap.utils import get_encoding_table wildtype = "AA" mutations = { 0: ["A", "B"], 1: ["A", "B"] } get_encoding_table(wildtype, mutations) .. raw:: html
binary_index_start | binary_index_stop | binary_repr | genotype_index | mutation_index | mutation_letter | wildtype_letter | |
---|---|---|---|---|---|---|---|
0 | 0 | 1 | 0 | 0 | NaN | A | A |
1 | 0 | 1 | 1 | 0 | 1 | B | A |
2 | 1 | 2 | 0 | 1 | NaN | A | A |
3 | 1 | 2 | 1 | 1 | 2 | B | A |