Skip to content

Commit

Permalink
add shiny skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
KevCaz committed Nov 30, 2023
1 parent 498a78d commit c743da6
Show file tree
Hide file tree
Showing 14 changed files with 183 additions and 1 deletion.
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: metanetwork
Title: Circular Hierarchical Edge Bundling Graphs
Version: 0.0.0.9005
Version: 0.0.0.9006
Authors@R: c(
person(given = "David",
family = "Beauchesne",
Expand All @@ -24,12 +24,14 @@ Depends:
R (>= 4.1.0)
Imports:
dplyr,
fs,
glue,
graphics,
grDevices,
magick,
methods,
plotrix,
shiny (>= 1.7.0),
utils,
viridis,
vroom
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Generated by roxygen2: do not edit by hand

export(metanetwork)
export(run_metanetwork_app)
importFrom(shiny,runApp)
importFrom(utils,globalVariables)
6 changes: 6 additions & 0 deletions R/shiny.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#' Function to run the shiny app to generate the figure
#'
#' @export
run_metanetwork_app <- function() {
shiny::runApp(fs::path_package("metanetwork", "app"))
}
1 change: 1 addition & 0 deletions R/zzz.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# internals
#' @importFrom utils globalVariables
#' @importFrom shiny runApp
#' @noRd
#'
NULL
Expand Down
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
# metanetwork
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)


Package to generate circular hierarchical edge bundling graphs to represent metanetworks


# Installation

Package must be installed from GitHub.

```R
install.packages("remotes")
remotes::install_github("inSilecoInc/metanetwork")
```

# How to

## Generate the example

```R
library("metanetwork")
metanetwork(
metanetwork:::nodes,
metanetwork:::links,
focus = c("Species", "Drivers", "Managers"),
legend = FALSE,
export = FALSE
)
```

## Shiny App

```R
library("metanetwork")
run_metanetwork_app()
```
3 changes: 3 additions & 0 deletions inst/app/global.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
library(dplyr)
library(metanetwork)

Check warning on line 3 in inst/app/global.R

View workflow job for this annotation

GitHub Actions / ubuntu-22.04 (release)

file=inst/app/global.R,line=3,col=1,[trailing_blank_lines_linter] Trailing blank lines are superfluous.
5 changes: 5 additions & 0 deletions inst/app/server.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
server <- function(input, output, session) {
# INPUTS
r <- reactiveValues()

Check warning on line 3 in inst/app/server.R

View workflow job for this annotation

GitHub Actions / ubuntu-22.04 (release)

file=inst/app/server.R,line=3,col=3,[object_usage_linter] local variable 'r' assigned but may not be used

Check warning on line 3 in inst/app/server.R

View workflow job for this annotation

GitHub Actions / ubuntu-22.04 (release)

file=inst/app/server.R,line=3,col=8,[object_usage_linter] no visible global function definition for 'reactiveValues'

Check warning on line 4 in inst/app/server.R

View workflow job for this annotation

GitHub Actions / ubuntu-22.04 (release)

file=inst/app/server.R,line=4,col=1,[trailing_whitespace_linter] Trailing whitespace is superfluous.
}
55 changes: 55 additions & 0 deletions inst/app/ui.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
ui <- fluidPage(
tags$head(
tags$link(rel = "stylesheet", type = "text/css", href = "extra.css")
),

# Application title
titlePanel("", "metanetwork"),

#
sidebarLayout(
sidebarPanel(
# Title
h3(div("inSileco Metanetwork App")),

# Panels
tabsetPanel(
id = "slc_mode",
tabsetPanel(
id = "params",
# INPUT UIs
tabPanel("params",
icon = icon("user-check"),
numericInput("line_witdh", "Line width", value = 1, step = 0.05)
)
)
),
hr(),
# FOOTER
HTML(
paste0(
"<div id='footer_left'><a href='https://insilecoinc.github.io/' target='_blank'><img src='img/insileco_logo256.png' alt='inSileco logo' width = '100%'/></a></div><div id='footer_right'><h5>This shiny app was built by <a href='https://insilecoinc.github.io/' target='_blank'>inSileco</a> with the ",

Check warning on line 31 in inst/app/ui.R

View workflow job for this annotation

GitHub Actions / ubuntu-22.04 (release)

file=inst/app/ui.R,line=31,col=161,[line_length_linter] Lines should not be more than 160 characters. This line is 308 characters.
a("R package shiny",
href = "https://shiny.rstudio.com/",
target = "_blank"
), ", the source code is available on "
)
),
a(icon("github"),
href = "https://github.com/inSilecoInc/metanetwork", target = "_blank"
),
HTML(".</h5></div>")
),

# RIGHT PANEL
mainPanel(
tabsetPanel(
id = "view_tabs",
tabPanel(
"Figure",
icon = icon("chart-bar")
)
)
)
)
)

Check warning on line 55 in inst/app/ui.R

View workflow job for this annotation

GitHub Actions / ubuntu-22.04 (release)

file=inst/app/ui.R,line=55,col=2,[trailing_blank_lines_linter] Missing terminal newline.
3 changes: 3 additions & 0 deletions inst/app/www/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.html
*.md
*.pdf
60 changes: 60 additions & 0 deletions inst/app/www/extra.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#map-map {
height : 90vh !important;
}

#file_report {
color: #337ab7;
}

.pending{
color: #ccc;
font-size: 1.1em;
}

.green {
color: #34c369;
}

.red {
color: #f03561;
}

.blue {
color: #399ad0;
}

.tbl_preview {
padding: 4px;
background-color: #eee;
border: 1px solid #aaa;
border-radius: 4px;
}

#report_html {
max-height: 900px!important;
}

#iframe_report {
height: 90vh;
}

#footer {
width: 100%;
}

#footer_left {
width: 16%;
display:inline-table;
}

#footer_right {
width: 84%;
display:inline-table;
text-align: center;
}

.shiny-notification {
position:fixed;
top: calc(85%);
left: calc(10%);
}
Binary file added inst/app/www/img/insileco_logo256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added inst/app/www/insileco_logo256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added inst/app/www/warning.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions man/run_metanetwork_app.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c743da6

Please sign in to comment.