Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Midoux Cedric
easy16S
Commits
d69aa8f4
Commit
d69aa8f4
authored
Apr 21, 2020
by
Midoux Cedric
Browse files
CLR transfo (retours OC)
parent
b501b52c
Changes
1
Hide whitespace changes
Inline
Side-by-side
panels/dataInput.R
View file @
d69aa8f4
...
...
@@ -300,13 +300,13 @@ output$transformFun <- renderText({
sep
=
"\n"
),
"sqrt"
=
"data_sqrt <- transform_sample_counts(data, sqrt)"
,
"clr"
=
paste
(
"gm_mean <- function(x, na.rm=TRUE) {"
,
" exp(sum(log(x[x > 0 & !is.na(x)]), na.rm=na.rm) / length(x))"
,
" }"
,
"clr <- function(x, base=2) {"
,
" x <- log((x / gm_mean(x)), base)"
,
" x[!is.finite(x) | is.na(x)] <- 0.0"
,
" return(x)"
,
" return(exp(mean(log(x), na.rm=na.rm)))"
,
"}"
,
"clr <- function(x, base=exp(1)) {"
,
" x <- x+1"
,
" x <- log(x/gm_mean(x), base)"
,
" return(x)"
,
"}"
,
"data_clr <- transform_sample_counts(data, clr)"
,
sep
=
"\n"
)
)
...
...
@@ -328,11 +328,11 @@ observeEvent(input$transformData, {
},
"clr"
=
{
gm_mean
<-
function
(
x
,
na.rm
=
TRUE
)
{
exp
(
sum
(
log
(
x
[
x
>
0
&
!
is.na
(
x
)]
),
na.rm
=
na.rm
)
/
length
(
x
))
return
(
exp
(
mean
(
log
(
x
),
na.rm
=
na.rm
)))
}
clr
<-
function
(
x
,
base
=
2
)
{
x
<-
log
((
x
/
gm_mean
(
x
)),
base
)
x
[
!
is.finite
(
x
)
|
is.na
(
x
)]
<-
0.0
clr
<-
function
(
x
,
base
=
exp
(
1
)
)
{
x
<-
x
+1
x
<-
log
(
x
/
gm_mean
(
x
),
base
)
return
(
x
)
}
physeq
(
transform_sample_counts
(
physeq
(),
clr
))
...
...
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