Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Blaise LI
libhts
Commits
a763c9a0
Commit
a763c9a0
authored
Sep 24, 2020
by
Blaise Li
Browse files
Catch stats numeric error.
parent
b13207c0
Changes
1
Hide whitespace changes
Inline
Side-by-side
libhts/libhts.py
View file @
a763c9a0
...
...
@@ -456,7 +456,17 @@ def size_factor_correlations(counts_data, summaries, normalizer):
# by_norm = counts_data / size_factors
def
compute_pearsonr_with_size_factor
(
row
):
return
pearsonr
(
row
,
size_factors
)[
0
]
try
:
return
pearsonr
(
row
,
size_factors
)[
0
]
except
ValueError
as
err
:
if
str
(
err
)
==
"array must not contain infs or NaNs"
:
msg
=
(
f
"Cannot compute Pearson correlation with size factors "
f
"when normalizing using
{
normaliser
}
"
)
warnings
.
warn
(
msg
)
return
np
.
nan
else
:
raise
# return by_norm.apply(compute_pearsonr_with_size_factor, axis=1)
return
(
counts_data
/
size_factors
).
apply
(
compute_pearsonr_with_size_factor
,
axis
=
1
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment