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
migale
affiliationExplorer
Commits
0469ca5b
Commit
0469ca5b
authored
Feb 24, 2020
by
mahendra-mariadassou
Browse files
Add table for manual correction of affiliation
parent
dd272522
Changes
2
Hide whitespace changes
Inline
Side-by-side
NAMESPACE
View file @
0469ca5b
...
...
@@ -17,6 +17,8 @@ importFrom(htmltools,tagList)
importFrom(htmltools,tags)
importFrom(magrittr,"%>%")
importFrom(phyloseq,tax_table)
importFrom(phyloseq,taxa_names)
importFrom(phyloseq,taxa_sums)
importFrom(phyloseq.extended,write_phyloseq)
importFrom(shiny,column)
importFrom(shiny,shinyApp)
...
...
R/app_server.R
View file @
0469ca5b
...
...
@@ -36,11 +36,13 @@ app_server <- function(input, output, session) {
affi
<-
all
$
affi
# Store ambiguous ASVs and their affiliation in reactive environment
data
<-
reactiveValues
(
amb_otus
=
unique
(
affi
$
OTU
),
## Ambiguous otus
cleaned
=
phyloseq
::
tax_table
(
physeq
)
[
unique
(
affi
$
OTU
),
]
%>%
as
(
"matrix"
),
##
Their
current affiliation
affi
=
NULL
,
## Placeholder for conflicting affiliations of current
ASV
sequence
=
NULL
## Placeholder for current OTU sequence
amb_otus
=
unique
(
affi
$
OTU
),
## Ambiguous otus
cleaned
=
phyloseq
::
tax_table
(
physeq
)
%>%
as
(
"matrix"
),
##
All
current affiliation
s (not only those of ambiguous OTUs)
affi
=
NULL
,
## Placeholder for conflicting affiliations of current
OTU
sequence
=
NULL
## Placeholder for current OTU sequence
)
## Sort `cleaned` by decreasing taxa abundances
data
$
cleaned
<-
data
$
cleaned
[
phyloseq
::
taxa_sums
(
physeq
)
%>%
sort
(
decreasing
=
TRUE
)
%>%
names
(),
]
# Add ASV Select Input
insertUI
(
...
...
@@ -131,13 +133,14 @@ app_server <- function(input, output, session) {
}
)
## Download biomfile
output
$
download
<-
downloadHandler
(
filename
=
function
()
{
paste0
(
'cleaned_biom-'
,
Sys.Date
(),
'.biom'
)
},
content
=
function
(
con
)
{
## Update taxonomy of object phyloseq
phyloseq
::
tax_table
(
physeq
)[
rownames
(
data
$
cleaned
),
]
<-
data
$
cleaned
phyloseq
::
tax_table
(
physeq
)[
,
]
<-
data
$
cleaned
[
phyloseq
::
taxa_names
(
physeq
),
]
## revert short OTU names back to original names
dict
<-
setNames
(
object
=
dict
$
sequence
,
nm
=
dict
$
OTU
)
...
...
@@ -149,5 +152,17 @@ app_server <- function(input, output, session) {
biom_format
=
"frogs"
)
})
### Page 2 UI elements -----------------------------------------------
output
$
tableFull
<-
DT
::
renderDT
({
data
$
cleaned
},
filter
=
"top"
,
selection
=
list
(
mode
=
'single'
,
selected
=
NULL
,
target
=
'row'
),
editable
=
TRUE
)
## Manual corrections in non ambiguous taxa
observeEvent
(
input
$
tableFull_cell_edit
,
{
data
$
cleaned
[,]
<<-
DT
::
editData
(
data
$
cleaned
,
input
$
tableFull_cell_edit
,
"tableFull"
)
})
})
}
\ No newline at end of file
Sandra Derozier
@sandra.derozier
mentioned in issue
#4 (closed)
·
Feb 28, 2020
mentioned in issue
#4 (closed)
mentioned in issue #4
Toggle commit list
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