Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libhts
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
libhts
Commits
d4c6916b
Commit
d4c6916b
authored
7 years ago
by
Blaise Li
Browse files
Options
Downloads
Patches
Plain Diff
Moved stuff to common libraries, test size factor.
parent
4d3532cc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libhts/__init__.py
+1
-1
1 addition, 1 deletion
libhts/__init__.py
libhts/libhts.py
+26
-0
26 additions, 0 deletions
libhts/libhts.py
with
27 additions
and
1 deletion
libhts/__init__.py
+
1
−
1
View file @
d4c6916b
from
.libhts
import
do_deseq2
,
median_ratio_to_pseudo_ref_size_factors
,
size_factor_correlations
,
status_setter
from
.libhts
import
do_deseq2
,
median_ratio_to_pseudo_ref_size_factors
,
plot_counts_distribution
,
plot_norm_correlations
,
size_factor_correlations
,
status_setter
This diff is collapsed.
Click to expand it.
libhts/libhts.py
+
26
−
0
View file @
d4c6916b
...
...
@@ -13,6 +13,7 @@ import pandas as pd
from
scipy.stats.stats
import
pearsonr
# To compute geometric mean
from
scipy.stats.mstats
import
gmean
import
seaborn
as
sns
from
rpy2.robjects
import
r
,
pandas2ri
,
Formula
,
StrVector
as_df
=
r
(
"
as.data.frame
"
)
from
rpy2.rinterface
import
RRuntimeError
...
...
@@ -115,6 +116,31 @@ def size_factor_correlations(counts_data, summaries, normalizer):
return
(
counts_data
/
size_factors
).
apply
(
compute_pearsonr_with_size_factor
,
axis
=
1
)
def
plot_norm_correlations
(
correlations
):
#fig, (ax1, ax2) = plt.subplots(nrows=2, ncols=1, sharex=True)
#correlations.plot.kde(ax=ax1)
#sns.violinplot(data=correlations, orient="h", ax=ax2)
#ax2.set_xlabel("Pearson correlation coefficient")
ax
=
sns
.
violinplot
(
data
=
correlations
,
cut
=
0
)
ax
.
set_ylabel
(
"
Pearson correlation coefficient
"
)
def
plot_counts_distribution
(
data
,
xlabel
):
# TODO: try to plot with semilog x axis
#ax = data.plot.kde(legend=None)
#ax.set_xlabel(xlabel)
#ax.legend(ncol=len(REPS))
try
:
ax
=
data
.
plot
.
kde
()
except
ValueError
as
e
:
msg
=
""
.
join
([
"
There seems to be a problem with the data.
\n
"
,
"
The data matrix has %d lines and %d columns.
\n
"
%
(
len
(
data
),
len
(
data
.
columns
))])
warnings
.
warn
(
msg
)
raise
ax
.
set_xlabel
(
xlabel
)
def
status_setter
(
lfc_cutoffs
=
None
):
if
lfc_cutoffs
is
None
:
lfc_cutoffs
=
[
0.5
,
1
,
2
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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