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
Kunst, Jonathan
Polyploid datavisualisation
Commits
2f1d670f
Commit
2f1d670f
authored
Nov 15, 2021
by
Kunst, Jonathan
Browse files
Added a panel for model building and visualisation
parent
5d4ff407
Changes
7
Hide whitespace changes
Inline
Side-by-side
plotly_testing.R
View file @
2f1d670f
library
(
plotly
)
# plotly ----
data
(
"diamonds"
,
package
=
'ggplot2'
)
diamonds
...
...
polyploid_vis/app.R
View file @
2f1d670f
...
...
@@ -2,7 +2,7 @@
# R Shiny Script
# Author: Jonathan Kunst
# Date created: 27-09-2021
# Date updated: 2
7-09
-2021
# Date updated: 2
1-10
-2021
# Packages ----
library
(
DT
)
...
...
@@ -88,7 +88,7 @@ ui <- fluidPage(
numericInput
(
inputId
=
'IBD_core'
,
label
=
'Numbers of processing cores'
,
min
=
1
,
value
=
1
,
value
=
detectCores
()
/
2
,
max
=
detectCores
()
-
2
),
# Estimate starter
...
...
@@ -255,15 +255,16 @@ server <- function(input, output, session) {
select_offspring
=
rv
$
select_offspring
(),
multiplot
=
c
(
1
,
1
))
)
output
$
plot_haplo_imp
<-
renderPlot
(
visualiseHaplo
(
IBD_list
=
IBD_imp
(),
display_by
=
"name"
,
linkage_group
=
1
,
select_offspring
=
IBD_imp
()[
1
]
$
offspring
[
3
:
11
],
multiplot
=
c
(
3
,
3
))
)
#
#
output$plot_haplo_imp <- renderPlot(visualiseHaplo(IBD_list = IBD_imp(),
#
display_by = "name",
#
linkage_group = 1,
#
select_offspring = IBD_imp()[1]$offspring[3:11],
#
multiplot = c(3, 3))
#
)
}
# Run Shiny app example ----
shinyApp
(
ui
=
ui
,
server
=
server
)
\ No newline at end of file
shinyApp
(
ui
=
ui
,
server
=
server
)
polyqtlvis/R/app_server.R
View file @
2f1d670f
...
...
@@ -14,4 +14,6 @@ app_server <- function( input, output, session ) {
# IBD estimation ----
mod_IBD_panel_server
(
"IBD_panel_ui_1"
,
rv
=
rv
)
mod_model_panel_server
(
"model_panel_ui_1"
,
rv
=
rv
)
}
polyqtlvis/R/app_ui.R
View file @
2f1d670f
...
...
@@ -17,7 +17,10 @@ app_ui <- function(request) {
# IBD panel ----
tabPanel
(
'IBD'
,
mod_IBD_panel_ui
(
"IBD_panel_ui_1"
)
)
),
# Model panel
tabPanel
(
'Model'
,
mod_model_panel_ui
(
"model_panel_ui_1"
))
)
)
}
...
...
polyqtlvis/R/mod_import.R
View file @
2f1d670f
...
...
@@ -27,7 +27,7 @@ mod_import_server <- function(id, rv, rvlab){
observeEvent
(
input
$
file
,
{
req
(
input
$
file
)
if
(
rvlab
==
'snp'
){
rv
[[
rvlab
]]
<-
read.csv
(
input
$
file
$
datapath
,
row.names
=
1
)
rv
[[
rvlab
]]
<-
as.matrix
(
read.csv
(
input
$
file
$
datapath
,
row.names
=
1
)
)
}
else
{
name
<-
input
$
file
$
name
[
1
]
# if multiple csv length too long
extension
<-
tools
::
file_ext
(
name
)
...
...
polyqtlvis/R/mod_model_panel.R
0 → 100644
View file @
2f1d670f
#' model_panel UI Function
#'
#' @description A shiny Module.
#'
#' @param id,input,output,session Internal parameters for {shiny}.
#'
#' @noRd
#'
#' @importFrom shiny NS tagList
mod_model_panel_ui
<-
function
(
id
){
ns
<-
NS
(
id
)
tagList
(
sidebarLayout
(
sidebarPanel
(
tabsetPanel
(
tabPanel
(
'PolyqtlR'
),
tabPanel
(
'qtlpoly'
)
)
),
mainPanel
()
)
)
}
#' model_panel Server Functions
#'
#' @noRd
mod_model_panel_server
<-
function
(
id
,
rv
){
moduleServer
(
id
,
function
(
input
,
output
,
session
){
ns
<-
session
$
ns
})
}
## To be copied in the UI
# mod_model_panel_ui("model_panel_ui_1")
## To be copied in the server
# mod_model_panel_server("model_panel_ui_1")
polyqtlvis/dev/02_dev.R
View file @
2f1d670f
...
...
@@ -16,13 +16,14 @@
## Dependencies ----
## Add one line by package you want to add as dependency
usethis
::
use_package
(
'polyqtlR'
)
usethis
::
use_package
(
'plotly'
)
usethis
::
use_package
(
'readr'
)
usethis
::
use_package
(
'parallel'
)
usethis
::
use_package
(
'tools'
)
## Add modules ----
## Create a module infrastructure in R/
golem
::
add_module
(
name
=
"
import
_panel"
)
# Name of the module
golem
::
add_module
(
name
=
"
model
_panel"
)
# Name of the module
## Add helper functions ----
...
...
Write
Preview
Supports
Markdown
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