Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TDD_MAPKi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LBMC
ReGArDS
TDD_MAPKi
Commits
6db81916
Commit
6db81916
authored
Aug 30, 2022
by
nfontrod
Browse files
Options
Downloads
Patches
Plain Diff
src/07_ribosome_density.py: fix stats filename
parent
7ba444b0
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/07_ribosome_density.py
+15
-11
15 additions, 11 deletions
src/07_ribosome_density.py
with
15 additions
and
11 deletions
src/07_ribosome_density.py
+
15
−
11
View file @
6db81916
...
@@ -7,7 +7,6 @@ The goal of this script is to compute the ribosomal density for genes in \
...
@@ -7,7 +7,6 @@ The goal of this script is to compute the ribosomal density for genes in \
experiment 245-6-7
experiment 245-6-7
"""
"""
from
multiprocessing
import
context
from
pathlib
import
Path
from
pathlib
import
Path
from
typing
import
List
from
typing
import
List
import
doctest
import
doctest
...
@@ -210,20 +209,22 @@ def avg_replicate(df_density: pd.DataFrame) -> pd.DataFrame:
...
@@ -210,20 +209,22 @@ def avg_replicate(df_density: pd.DataFrame) -> pd.DataFrame:
return
df
return
df
def
statistical_analysis
(
df_density
:
pd
.
DataFrame
,
output
:
Path
)
->
float
:
def
statistical_analysis
(
df_density
:
pd
.
DataFrame
,
output
:
Path
,
list_type
:
str
)
->
float
:
"""
Get the density pvalue
"""
Get the density pvalue
:param df_density: A density dataframe
:param df_density: A density dataframe
:type df_density: pd.DataFrame
:type df_density: pd.DataFrame
:param outout: The folder where the diagnostics will be produced
:param outout: The folder where the diagnostics will be produced
:param the kind of list studied
:return: The pvalue needed
:return: The pvalue needed
"""
"""
pandas2ri
.
activate
()
pandas2ri
.
activate
()
output
=
output
/
"
diag
"
output
=
output
/
"
diag
"
output
.
mkdir
(
exist_ok
=
True
)
output
.
mkdir
(
exist_ok
=
True
)
treat
=
df_density
[
"
treatment
"
].
unique
()[
0
]
treat
=
df_density
[
"
treatment
"
].
unique
()[
0
]
outfig
=
output
/
f
"
diag_
{
treat
}
.pdf
"
outfig
=
output
/
f
"
diag_
{
treat
}
_
{
list_type
}
.pdf
"
outpval
=
output
/
f
"
diag_pval_
{
treat
}
.txt
"
outpval
=
output
/
f
"
diag_pval_
{
treat
}
_
{
list_type
}
.txt
"
stat_s
=
r
(
f
"""
stat_s
=
r
(
f
"""
require(
"
DHARMa
"
)
require(
"
DHARMa
"
)
require(
"
glmmTMB
"
)
require(
"
glmmTMB
"
)
...
@@ -263,15 +264,18 @@ def create_density_figure(df_density: pd.DataFrame, gene_file: Path,
...
@@ -263,15 +264,18 @@ def create_density_figure(df_density: pd.DataFrame, gene_file: Path,
data
=
df_mean
,
kind
=
"
violin
"
,
height
=
10
,
aspect
=
1.7
,
data
=
df_mean
,
kind
=
"
violin
"
,
height
=
10
,
aspect
=
1.7
,
palette
=
{
"
TDD_BRAF
"
:
"
#a600ff
"
,
"
CTRL
"
:
"
dimgrey
"
,
palette
=
{
"
TDD_BRAF
"
:
"
#a600ff
"
,
"
CTRL
"
:
"
dimgrey
"
,
"
TDD_DMSO
"
:
"
#ff8400
"
},
cut
=
True
)
"
TDD_DMSO
"
:
"
#ff8400
"
},
cut
=
True
)
pdmso
=
statistical_analysis
(
df_density
[
df_density
[
"
treatment
"
]
==
"
DMSO
"
].
copy
(),
pdmso
=
statistical_analysis
(
output_file
.
parent
)
df_density
[
df_density
[
"
treatment
"
]
==
"
DMSO
"
].
copy
(),
pbraf
=
statistical_analysis
(
df_density
[
df_density
[
"
treatment
"
]
==
"
BRAF
"
].
copy
(),
output_file
.
parent
,
gene_file
.
stem
)
output_file
.
parent
)
pbraf
=
statistical_analysis
(
df_density
[
df_density
[
"
treatment
"
]
==
"
BRAF
"
].
copy
(),
output_file
.
parent
,
gene_file
.
stem
)
pdmso
=
"
%.2e
"
%
pdmso
pdmso
=
"
%.2e
"
%
pdmso
pbraf
=
"
%.2e
"
%
pbraf
pbraf
=
"
%.2e
"
%
pbraf
g
.
fig
.
suptitle
(
f
"
Ribosome density between
{
gene_file
.
stem
}
and CTRL
"
g
.
fig
.
suptitle
(
f
"
Ribosome density
"
f
"
between
{
gene_file
.
stem
}
and CTRL
"
f
"
genes in BRAF and DMSO condition
\n
"
f
"
genes in BRAF and DMSO condition
\n
"
f
"
(p_treatment_BRAF =
{
pbraf
}
& p_treatment_
BRAF
=
{
pdmso
}
"
)
f
"
(p_treatment_BRAF =
{
pbraf
}
& p_treatment_
DMSO
=
{
pdmso
}
"
)
g
.
set
(
ylabel
=
"
log10(density +1)
"
)
g
.
set
(
ylabel
=
"
log10(density +1)
"
)
g
.
savefig
(
output_file
)
g
.
savefig
(
output_file
)
...
...
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