diff --git a/libcodonusage/__init__.py b/libcodonusage/__init__.py index e82dd57bf57002a12cea186a416fcbba98636161..b1e7b7767a58c41b8b08dfeae821fe996af61736 100644 --- a/libcodonusage/__init__.py +++ b/libcodonusage/__init__.py @@ -1,6 +1,6 @@ __copyright__ = "Copyright (C) 2022-2023 Blaise Li" __licence__ = "GNU GPLv3" -__version__ = "0.28.0" +__version__ = "0.28.1" from .libcodonusage import ( aa2colour, aa_usage, diff --git a/libcodonusage/libcodonusage.py b/libcodonusage/libcodonusage.py index f63e15b6a5328b99c024fe94332ae03ff3b6481f..bf629e2157bfc78a87dbb051c7158d7442abbfc1 100644 --- a/libcodonusage/libcodonusage.py +++ b/libcodonusage/libcodonusage.py @@ -667,6 +667,12 @@ We compute the global usage, as the sum of the counts for a given codon, across genes. """) global_usage = counts_for_global.sum(axis=0) + if return_more: + # Same computation as for individual genes, + # but based on the total counts. + global_max_counts = global_usage.T.groupby("aa").max().T + global_r4 = global_usage.div( + global_max_counts) render_md("Then we sum over codons corresponding to the same amino-acid.") global_summed_by_aa = global_usage.groupby(level=0).sum() render_md(""" @@ -702,7 +708,8 @@ across genes) so that they are more comparable between codons. "rscu": rscu, "r4_table": r4_table, "global_proportions": global_proportions, - "global_rscu": global_proportions.mul(degeneracy)} + "global_rscu": global_proportions.mul(degeneracy), + "global_r4": global_r4} return standardized_codon_usage_biases