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

Option to return proportions too, not just biases.

parent c8e29f65
Branches
No related tags found
No related merge requests found
__copyright__ = "Copyright (C) 2022 Blaise Li" __copyright__ = "Copyright (C) 2022 Blaise Li"
__licence__ = "GNU GPLv3" __licence__ = "GNU GPLv3"
__version__ = "0.21" __version__ = "0.22"
from .libcodonusage import ( from .libcodonusage import (
aa2colour, aa2colour,
aa_usage, aa_usage,
......
...@@ -352,7 +352,7 @@ SUZUKI_DOI = "10.1016/j.febslet.2005.10.032" ...@@ -352,7 +352,7 @@ SUZUKI_DOI = "10.1016/j.febslet.2005.10.032"
SUZUKI_LINK = f"[Suzuki et al (2005)](https://doi.org/{SUZUKI_DOI})" SUZUKI_LINK = f"[Suzuki et al (2005)](https://doi.org/{SUZUKI_DOI})"
def gene_wide_codon_usage(codon_counts, verbose=False): def gene_wide_codon_usage(codon_counts, verbose=False, return_props=False):
""" """
Compute codon usage biases "gene-wide" as the standardized Compute codon usage biases "gene-wide" as the standardized
difference between a gene's codon proportions and global difference between a gene's codon proportions and global
...@@ -414,10 +414,12 @@ across genes) so that they are more comparable between codons. ...@@ -414,10 +414,12 @@ across genes) so that they are more comparable between codons.
# standardized_codon_usage_biases.style.hide(axis="index") # standardized_codon_usage_biases.style.hide(axis="index")
if verbose: if verbose:
display(standardized_codon_usage_biases.head(3)) display(standardized_codon_usage_biases.head(3))
if return_props:
return (standardized_codon_usage_biases, codon_proportions)
return standardized_codon_usage_biases return standardized_codon_usage_biases
def by_aa_codon_usage(codon_counts, verbose=False): def by_aa_codon_usage(codon_counts, verbose=False, return_props=False):
""" """
Compute codon usage biases "by amino-acid" as the standardized Compute codon usage biases "by amino-acid" as the standardized
difference between a gene's codon proportions and global difference between a gene's codon proportions and global
...@@ -495,10 +497,12 @@ across genes) so that they are more comparable between codons. ...@@ -495,10 +497,12 @@ across genes) so that they are more comparable between codons.
# standardized_codon_usage_biases.style.hide(axis="index") # standardized_codon_usage_biases.style.hide(axis="index")
if verbose: if verbose:
display(standardized_codon_usage_biases.head(3)) display(standardized_codon_usage_biases.head(3))
if return_props:
return (standardized_codon_usage_biases, codon_proportions)
return standardized_codon_usage_biases return standardized_codon_usage_biases
def aa_usage(codon_counts, verbose=False): def aa_usage(codon_counts, verbose=False, return_props=False):
""" """
Compute amino-acid usage biases as the standardized Compute amino-acid usage biases as the standardized
difference between a gene's amino-acid proportions difference between a gene's amino-acid proportions
...@@ -563,6 +567,8 @@ across genes) so that they are more comparable between amino-acids. ...@@ -563,6 +567,8 @@ across genes) so that they are more comparable between amino-acids.
# standardized_aa_usage_biases.style.hide(axis="index") # standardized_aa_usage_biases.style.hide(axis="index")
if verbose: if verbose:
display(standardized_aa_usage_biases.head(3)) display(standardized_aa_usage_biases.head(3))
if return_props:
return (standardized_aa_usage_biases, aa_proportions)
return standardized_aa_usage_biases return standardized_aa_usage_biases
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment