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

Added global R4 computation.

parent 9b4e17e3
Branches master
No related tags found
No related merge requests found
__copyright__ = "Copyright (C) 2022-2023 Blaise Li"
__licence__ = "GNU GPLv3"
__version__ = "0.28.0"
__version__ = "0.28.1"
from .libcodonusage import (
aa2colour,
aa_usage,
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment