Skip to content
Snippets Groups Projects
Commit b046962e authored by Blaise Li's avatar Blaise Li
Browse files

Allow imprecision in global codon proportions sum.

parent 3fbb71e9
No related branches found
No related tags found
No related merge requests found
__copyright__ = "Copyright (C) 2022 Blaise Li"
__licence__ = "GNU GPLv3"
__version__ = "0.17"
__version__ = "0.18"
from .libcodonusage import (
aa2colour,
aa_usage,
......
......@@ -384,7 +384,12 @@ in the global usage.
global_proportions = pd.Series(
normalize(global_usage.values.reshape(1, -1), norm="l1").flatten(),
index=global_usage.index)
assert global_proportions.sum() == 1.
# Can be 0.999999999999...
# if global_proportions.sum() != 1.:
# display(global_proportions)
# display(global_proportions.sum())
assert np.isclose(global_proportions.sum(), 1.)
# assert global_proportions.sum() == 1.
render_md("""
Codon usage biases in genes can then be computed by subtracting
the corresponding global proportion to a codon's proportion.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment