Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HTRfit
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
yvertlab
evolution_plasticity
plasticity_mutation
HTRfit
Commits
23a127b9
Commit
23a127b9
authored
Mar 28, 2022
by
Arnaud Duvermy
Browse files
Options
Downloads
Patches
Plain Diff
add new src
parent
5d2b07c0
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/htrsim/input_estimation.R
+45
-0
45 additions, 0 deletions
src/htrsim/input_estimation.R
src/htrsim/launch_deseq.R
+9
-0
9 additions, 0 deletions
src/htrsim/launch_deseq.R
src/htrsim/main.R
+26
-0
26 additions, 0 deletions
src/htrsim/main.R
with
80 additions
and
0 deletions
src/htrsim/input_estimation.R
0 → 100644
+
45
−
0
View file @
23a127b9
################### Estimate alpha per gene ########################
estim.alpha
<-
function
(
dds
){
#N.B: alpha = dispersion per gene
#dds <- DESeq2::estimateDispersions(dds, quiet = F)
#dispersion estimation
dispersion_estimate
<-
dispersions
(
dds
)
## Shape and export
names
(
dispersion_estimate
)
<-
tabl_cnts
%>%
rownames
()
## drop NA in dispersion estimate (link to unexpress gene)
### and convert to lovely dataframe
expressed_gene_dispersion
<-
dispersion_estimate
[
!
is.na
(
dispersion_estimate
)]
%>%
data.frame
()
%>%
rownames_to_column
()
%>%
rename
(
.
,
"alpha"
=
.
,
gene_id
=
"rowname"
)
return
(
expressed_gene_dispersion
)
#disp_gene_express %>% dim
#write_tsv(disp_gene_express, 'results/2022-03-03/estimate_dispersion.tsv')
}
################# Estimate mu distribution #########################
estim.mu
<-
function
(
dds
){
mu_estimate
<-
dds
@
assays
@
data
$
mu
#dds@assays@data$mu %>% dim()
#mu_estimate %>% dim()
rownames
(
mu_estimate
)
=
rownames
(
dds
@
assays
@
data
$
counts
)
## drop NA in dispersion estimate (link to unexpress gene)
### and convert to lovely dataframe
mu_gene_express
=
mu_estimate
%>%
na.omit
()
%>%
data.frame
()
colnames
(
mu_gene_express
)
<-
colnames
(
tabl_cnts
)
mu_gene_express
mu_gene_express
<-
mu_gene_express
%>%
mutate
(
gene_id
=
rownames
(
.
))
%>%
select
(
gene_id
,
everything
())
return
(
mu_gene_express
)
#write_tsv(mu_gene_express, 'results/2022-03-03/estimate_mu.tsv')
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/htrsim/launch_deseq.R
0 → 100644
+
9
−
0
View file @
23a127b9
########### LAUNCH DESEQ #############
run.deseq
<-
function
(
tabl_cnts
,
bioDesign
){
## Design model
dds
=
DESeqDataSetFromMatrix
(
countData
=
round
(
tabl_cnts
),
colData
=
bioDesign
,
design
=
~
mutant
+
env
+
mutant
:
env
)
## DESEQ standard analysis
dds
<-
DESeq
(
dds
)
return
(
dds
)
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/htrsim/main.R
0 → 100644
+
26
−
0
View file @
23a127b9
######################### HTRSIM MAIN SRC ###################################
htrsim
<-
function
(
countData
,
bioDesign
,
N_replicates
){
source
(
file
=
"/home/rstudio/mydatalocal/counts_simulation/src/htrsim/launch_deseq.R"
)
dds
<-
run.deseq
(
countData
,
bioDesign
)
source
(
file
=
"/home/rstudio/mydatalocal/counts_simulation/src/htrsim/input_estimation.R"
)
mu.input
=
estim.mu
(
dds
)
alpha.input
=
estim.alpha
(
dds
)
source
(
file
=
"/home/rstudio/mydatalocal/counts_simulation/src/htrsim/setup_cntsGenerator.R"
)
input
=
reshape_input2setup
(
mu.dtf
=
mu.input
,
alpha.dtf
=
alpha.input
)
setup.simulation
<-
setup_countGener
(
bioSample_id
=
input
$
bioSample_id
,
n_rep
=
N_replicates
,
alpha
=
input
$
alpha
,
gene_id
=
input
$
gene_id
,
mu
=
input
$
mu
)
## Generate counts
source
(
file
=
"/home/rstudio/mydatalocal/counts_simulation/src/htrsim/counts_generator.R"
)
htrs
<-
generate_counts
(
setup.simulation
)
return
(
list
(
simul_cnts
=
htrs
,
mu.input
=
mu.input
,
alpha.input
=
alpha.input
,
setup
=
setup.simulation
))
}
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