Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Bernd Klaus
stat_methods_bioinf
Commits
4d3fb36e
Commit
4d3fb36e
authored
Nov 29, 2017
by
Bernd Klaus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finished factor analysis section, started zinba wave
parent
9e73bbed
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
418 additions
and
194 deletions
+418
-194
.gitignore
.gitignore
+1
-0
data/create_dds_batch_with_geno_confounding.R
data/create_dds_batch_with_geno_confounding.R
+15
-9
data/dds_batch.RData
data/dds_batch.RData
+0
-0
factor_ana_testing_ml.R
factor_ana_testing_ml.R
+7
-6
factor_ana_testing_ml.Rmd
factor_ana_testing_ml.Rmd
+311
-80
factor_ana_testing_ml.html
factor_ana_testing_ml.html
+84
-99
No files found.
.gitignore
View file @
4d3fb36e
...
...
@@ -5,3 +5,4 @@ material_stat_methods/
SRP022054/
rse_gene.Rdata
stockori_tmp.Rmd
factanal.R
data/create_dds_batch_with_geno_confounding.R
View file @
4d3fb36e
...
...
@@ -39,16 +39,17 @@ dds_batch <- DESeq(dds_batch, betaPrior = TRUE)
results
(
dds_batch
)[
50
,]
summary
(
results
(
dds_batch
))
########################################################################
## add genotype confounding
gen
<-
c
(
0
,
1
,
1
,
1
,
0
,
2
,
2
,
2
)
set.seed
(
292827
)
gen
<-
c
(
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
2
,
2
,
2
,
2
,
2
,
2
)
# gen <- 2^gen
colData
(
dds_batch
)
$
gen_back
<-
factor
(
gen
)
res
<-
results
(
DESeq
(
dds_batch
))
summary
(
res
)
idx_fc
<-
abs
(
res
$
log2FoldChange
)
>
0.
8
idx_fc
<-
abs
(
res
$
log2FoldChange
)
>
0.
2
cts
<-
counts
(
dds_batch
)
# adapt fold changes to reflect genetic bias
...
...
@@ -56,20 +57,18 @@ cts <- counts(dds_batch)
for
(
i
in
which
(
idx_fc
)){
if
(
res
[
i
,
"log2FoldChange"
]
>
0
){
cts
[
i
,
colData
(
dds_batch
)
$
condition
==
"B"
]
<-
as.integer
(
round
(
cts
[
i
,
colData
(
dds_batch
)
$
condition
==
"B"
]
/
2
^
(
res
[
i
,
"log2FoldChange"
]
cts
[
i
,
]
<-
as.integer
(
round
(
cts
[
i
,
]
*
2
^
(
res
[
i
,
"log2FoldChange"
]
/
(
2
^
gen
))))
}
else
{
cts
[
i
,
colData
(
dds_batch
)
$
condition
==
"A"
]
<-
as.integer
(
round
(
cts
[
i
,
colData
(
dds_batch
)
$
condition
==
"A"
]
*
2
^
(
res
[
i
,
"log2FoldChange"
]
cts
[
i
,
]
<-
as.integer
(
round
(
cts
[
i
,
]
*
2
^
(
res
[
i
,
"log2FoldChange"
]
/
(
2
^
gen
))))
}
}
set.seed
(
292827
)
#
set.seed(292827)
# poisson <- Vectorize(function(x) {rpois(1, x)})
# c2 <- counts(dds_batch)[idx_fc] + t(base::apply(round(counts(dds_batch) / 1000)* gen,
# 1, poisson))
...
...
@@ -79,6 +78,13 @@ dds_batch <- estimateSizeFactors(dds_batch)
dds_batch
<-
DESeq
(
dds_batch
)
summary
(
results
(
dds_batch
))
# check correlations
cor
(
as.numeric
(
colData
(
dds_batch
)
$
condition
),
as.numeric
(
colData
(
dds_batch
)
$
sex
))
cor
(
as.numeric
(
colData
(
dds_batch
)
$
condition
),
as.numeric
(
colData
(
dds_batch
)
$
gen_back
))
save
(
dds_batch
,
file
=
"dds_batch.RData"
)
\ No newline at end of file
save
(
dds_batch
,
file
=
"dds_batch.RData"
)
data/dds_batch.RData
View file @
4d3fb36e
No preview for this file type
factor_ana_testing_ml.R
View file @
4d3fb36e
...
...
@@ -38,6 +38,7 @@ library("pheatmap")
library
(
"tidyverse"
)
library
(
"Rtsne"
)
library
(
"limma"
)
library
(
"ggthemes"
)
theme_set
(
theme_gray
(
base_size
=
18
))
...
...
@@ -222,10 +223,10 @@ sessionInfo()
## ----unloaAll, echo=FALSE, message=FALSE, eval = FALSE-------------------
pkgs
<-
loaded_packages
()
%>%
filter
(
package
!=
"devtools"
)
%>%
{
.
$
path
}
walk
(
pkgs
,
unload
)
##
##
pkgs <- loaded_packages() %>%
##
filter(package != "devtools") %>%
##
{.$path}
##
##
walk(pkgs, unload)
factor_ana_testing_ml.Rmd
View file @
4d3fb36e
This diff is collapsed.
Click to expand it.
factor_ana_testing_ml.html
View file @
4d3fb36e
This diff is collapsed.
Click to expand it.
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