Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Cedric Midoux
Easy16S
Commits
9ad33f01
Commit
9ad33f01
authored
Apr 09, 2021
by
mahendra-mariadassou
Browse files
Add pairwise compairison in alpha-diversity ANOVA
parent
540cdc77
Changes
2
Hide whitespace changes
Inline
Side-by-side
panels/richnessA-server.R
View file @
9ad33f01
...
...
@@ -136,7 +136,7 @@ output$alphaAnovaUI <- renderUI({
)
})
output
$
alphaAnova
<-
renderPrint
({
model
<-
reactive
({
validate
(
need
(
physeq
(),
"Requires an abundance dataset"
),
need
(
input
$
anovaRichnessMeasure
,
""
),
...
...
@@ -145,8 +145,28 @@ output$alphaAnova <- renderPrint({
anova_data
<-
cbind
(
estimate_richness
(
physeq
(),
measures
=
input
$
anovaRichnessMeasure
),
as
(
sample_data
(
physeq
()),
"data.frame"
))
formula
<-
paste0
(
input
$
anovaRichnessMeasure
,
" ~ "
,
input
$
anovaCovariate
)
model
<-
do.call
(
"lm"
,
list
(
formula
=
as.formula
(
formula
),
data
=
as.name
(
"anova_data"
)))
print
(
model
)
anova
(
model
)
do.call
(
"lm"
,
list
(
formula
=
as.formula
(
formula
),
data
=
as.name
(
"anova_data"
)))
})
output
$
alphaAnova
<-
renderPrint
({
validate
(
need
(
model
(),
""
))
print
(
model
())
anova
(
model
())
})
output
$
anovaHSD
<-
DT
::
renderDT
({
validate
(
need
(
model
(),
""
),
need
(
physeq
(),
"Requires an abundance dataset"
),
need
(
input
$
anovaRichnessMeasure
,
""
),
need
(
input
$
anovaCovariate
,
"Select a covariate"
)
)
var
<-
get_variable
(
physeq
(),
input
$
anovaCovariate
)
if
(
!
(
is.factor
(
var
)
||
is.character
(
var
)))
{
tibble
::
tibble
(
.rows
=
0
)
}
else
{
TukeyHSD
(
aov
(
model
()))[[
1
]]
%>%
as_tibble
(
rownames
=
"Pair"
)
%>%
beautifulTable
()
%>%
DT
::
formatSignif
(
columns
=
c
(
"diff"
,
"lwr"
,
"upr"
,
"p adj"
),
digits
=
4
)
}
})
panels/richnessA-ui.R
View file @
9ad33f01
...
...
@@ -2,5 +2,12 @@ alphaPlot <- fluidPage(outputCodeButton(withLoader(plotOutput("alphaPlot", heigh
uiOutput
(
"alphaPlotUI"
))
alphaTable
<-
fluidPage
(
uiOutput
(
"alphaTable"
))
alphaAnova
<-
fluidPage
(
uiOutput
(
"alphaAnovaUI"
),
verbatimTextOutput
(
"alphaAnova"
)
verbatimTextOutput
(
"alphaAnova"
),
box
(
title
=
"Table of pairwise comparisons"
,
width
=
NULL
,
status
=
"primary"
,
collapsible
=
TRUE
,
collapsed
=
TRUE
,
DT
::
DTOutput
(
"anovaHSD"
))
)
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