Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libcodonusage
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Blaise LI
libcodonusage
Commits
3b410576
Commit
3b410576
authored
3 years ago
by
Blaise Li
Browse files
Options
Downloads
Patches
Plain Diff
Function to exclude columns with only NaNs.
parent
a602b0bf
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libcodonusage/__init__.py
+2
-1
2 additions, 1 deletion
libcodonusage/__init__.py
libcodonusage/libcodonusage.py
+24
-0
24 additions, 0 deletions
libcodonusage/libcodonusage.py
with
26 additions
and
1 deletion
libcodonusage/__init__.py
+
2
−
1
View file @
3b410576
__copyright__
=
"
Copyright (C) 2022 Blaise Li
"
__licence__
=
"
GNU GPLv3
"
__version__
=
"
0.1
1
"
__version__
=
"
0.1
2
"
from
.libcodonusage
import
(
aa2colour
,
aa_usage
,
...
...
@@ -8,6 +8,7 @@ from .libcodonusage import (
codon2aa
,
columns_by_aa
,
detect_fishy_genes
,
exclude_all_nan_cols
,
gene_wide_codon_usage
,
load_bias_table
,
load_counts_table
,
...
...
This diff is collapsed.
Click to expand it.
libcodonusage/libcodonusage.py
+
24
−
0
View file @
3b410576
...
...
@@ -545,6 +545,30 @@ across genes) so that they are more comparable between amino-acids.
return
standardized_aa_usage_biases
def
exclude_all_nan_cols
(
standardized_usage_biases
):
"""
Detect columns in *standardized_usage_biases* that contain only NaNs
and remove them from the table.
"""
render_md
(
"""
Standardization may result in division by zero for usage biases
that have a zero standard deviation.
This is expected to be the case for
"
by amino-acid
"
usage biases
for codons corresponding to amino-acids having only one codon:
methionine (M) and tryptophan (W).
"""
)
all_nan_cols
=
standardized_usage_biases
.
columns
[
standardized_usage_biases
.
isna
().
all
()]
if
len
(
all_nan_cols
):
render_md
(
"
The following columns contain only NaNs:
"
)
display
(
all_nan_cols
)
render_md
(
"
This likely resulted from a division by zero.
"
)
render_md
(
"
These columns will be excluded
"
)
return
(
standardized_usage_biases
.
drop
(
columns
=
all_nan_cols
).
fillna
(
0
),
all_nan_cols
)
def
load_bias_table
(
table_path
,
nb_info_cols
=
9
,
nb_cluster_series
=
2
):
"""
Load a table containing by-amino-acid codon usage biases.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment