Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ Imports:
tidytacos
Remotes:
github::LebeerLab/tidytacos,
github::daattali/shinycssloaders
github::daattali/shinycssloaders,
github::Appsilon/shiny.i18n
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export(run_app)
import(ggplot2)
import(magrittr)
import(shiny)
import(shiny.i18n)
importFrom(shiny,shinyApp)
11 changes: 9 additions & 2 deletions R/run_app.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
#'
#' @export
#' @importFrom shiny shinyApp
run_app <- function(){
shinyApp(ui = ui, server = server)
#' @importFrom golem with_golem_options
run_app <- function(onStart=NULL, options=list(), enableBookmarking=NULL){
shinyApp(
ui = ui,
server = server,
onStart = onStart,
options = options,
enableBookmarking = enableBookmarking,
)
}
23 changes: 19 additions & 4 deletions R/server.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
i18n <- shiny.i18n::Translator$new(translation_json_path = "inst/app/translation.json")
i18n$set_translation_language("es")

server <- function(input, output, session){

# i18n_r <- reactive({
# i18n
# })

observeEvent(input$selected_language, {
shiny.i18n::update_lang(input$selected_language, session = session)
#i18n_r()$set_translation_language(input$selected_language)
#cat("Lang updated to:", input$selected_language, "\n")
})

my_color_palette <- c("#00719A","#FCD0BE","#413647","#FF9A73","#063547",
"#992B00","#F3D9AE","#6991B3","#B8062F","#BDECFC",
"#D3D3D3")
Expand All @@ -21,11 +35,12 @@ server <- function(input, output, session){
)

my_data_sidebar_fileinput_tables <- bslib::card_body(
shiny.i18n::usei18n(i18n),
fillable = FALSE,
fileInput("my_data_samples",
label = span("Muestras",
label = span(i18n$t("Muestras"),
bslib::tooltip(bsicons::bs_icon("info-circle"),
"Carga la tabla 'samples.csv'",
i18n$t("Carga la tabla 'samples.csv'"),
placement = "right")),
#buttonLabel = "Buscar 'samples.csv'",
buttonLabel = bsicons::bs_icon("upload"),
Expand Down Expand Up @@ -67,7 +82,7 @@ server <- function(input, output, session){
buttonLabel = bsicons::bs_icon("upload"),
accept = c(".biom"),
width = "100%",
placeholder = "Ningún archivo seleccionado"
placeholder = i18n$t("Ningún archivo seleccionado")
)
)
)
Expand Down Expand Up @@ -1123,7 +1138,7 @@ server <- function(input, output, session){
xref="paper", xanchor="left",
showarrow=FALSE) %>%
plotly::layout(barmode = "stack",
xaxis = list(title = "Muestras", showticklabels=FALSE),
xaxis = list(title = i18n$t("Muestras"), showticklabels=FALSE),
yaxis = list(title = "Abundancia Relativa"),
legend = list(title = list(text = "Taxón")))
})
Expand Down
123 changes: 65 additions & 58 deletions R/ui.R

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ knitr::opts_chunk$set(
# VTOOL

<!-- badges: start -->
[![es](https://img.shields.io/badge/lang-es-yellow.svg)](https://github.com/mticlla/VTOOL/blob/master/README.md)
[![en](https://img.shields.io/badge/lang-en-red.svg)](https://github.com/mticlla/VTOOL/blob/master/README.en.md)
<!-- badges: end -->
<p align="center"><img src="man/figures/vtool_logo_1.svg" width="200"/></p>

Expand Down
53 changes: 53 additions & 0 deletions README.en.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
output: github_document
---

<!-- README.en.md is generated from README.Rmd. Please edit that file -->

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# VTOOL

<!-- badges: start -->
[![es](https://img.shields.io/badge/lang-es-yellow.svg)](https://github.com/jonatasemidio/multilanguage-readme-pattern/blob/master/README.md)
<!-- badges: end -->
<p align="center"><img src="man/figures/vtool_logo_1.svg" width="200"/></p>

VTOOL is a shiny application designed to explore microbial sequencing data with a focus on vaginal microbiota in relation to socio-demographic, clinical or lifestyle factors.

VTOOL has been developed following a user-centered-design (UCD) approach.

The initial conceptual approach of VTOOL is as follows:

![](man/figures/vtool_ventana_1_1.png)

![](man/figures/vtool_ventana_2_1.png)

![](man/figures/vtool_ventana_3.png)

![](man/figures/vtool_ventana_4.png)

## Install

To install the development version of VTOOL in R, you can use the following command:

```
# install.packages("devtools") #un-comment if devtools not installed already
devtools::install_github("mticlla/VTOOL")
```

## Usage

Once installed, VTOOL can be accessed through a web application or run locally.

```
library(VTOOL)
VTOOL::run_app()
```
44 changes: 44 additions & 0 deletions README.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

<!-- README.en.md is generated from README.Rmd. Please edit that file -->

# VTOOL

<!-- badges: start -->
[![es](https://img.shields.io/badge/lang-es-yellow.svg)](https://github.com/jonatasemidio/multilanguage-readme-pattern/blob/master/README.md)
<!-- badges: end -->
<p align="center">
<img src="man/figures/vtool_logo_1.svg" width="200"/>
</p>

VTOOL is a shiny application designed to explore microbial sequencing
data with a focus on vaginal microbiota in relation to
socio-demographic, clinical or lifestyle factors.

VTOOL has been developed following a user-centered-design (UCD)
approach.

The initial conceptual approach of VTOOL is as follows:

![](man/figures/vtool_ventana_1_1.png)

![](man/figures/vtool_ventana_2_1.png)

![](man/figures/vtool_ventana_3.png)

![](man/figures/vtool_ventana_4.png)

## Install

To install the development version of VTOOL in R, you can use the
following command:

# install.packages("devtools") #un-comment if devtools not installed already
devtools::install_github("mticlla/VTOOL")

## Usage

Once installed, VTOOL can be accessed through a web application or run
locally.

library(VTOOL)
VTOOL::run_app()
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# VTOOL

<!-- badges: start -->
[![es](https://img.shields.io/badge/lang-es-yellow.svg)](https://github.com/mticlla/VTOOL/blob/master/README.md)
[![en](https://img.shields.io/badge/lang-en-red.svg)](https://github.com/mticlla/VTOOL/blob/master/README.en.md)
<!-- badges: end -->
<p align="center">
<img src="man/figures/vtool_logo_1.svg" width="200"/>
Expand Down
47 changes: 47 additions & 0 deletions inst/app/conversion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import json
import pandas as pd

def excel_to_json(filepath):
df = pd.read_excel(filepath)
df = df.fillna("TODO")
outf = "/".join(filepath.split(".")[:-1]) + ".json"
translations = df.to_dict(orient="records")
lang = df.columns.to_list()
lang.pop("es")
# needs to be first!
lang.insert(0, "es")
data = dict(
languages = lang,
translation = translations
)
with open(outf, "w", encoding="utf-8") as f:
json.dump(data, f, ensure_ascii=False, indent=4)


def json_to_excel(filepath):
with open(filepath) as f:
data = json.load(f)
df = pd.DataFrame(data["translation"])
outf = "/".join(filepath.split(".")[:-1]) + ".xlsx"
df.to_excel(outf, index=False)

if __name__ == "__main__":
import sys
import os
if len(sys.argv) < 2:
print("Please choose a file to convert")
exit(0)
filepath = sys.argv[1]
if not os.path.exists(filepath):
print(f"File {filepath} does not exist")
exit(0)

ext = filepath.split(".")[-1]

if ext == 'json':
json_to_excel(filepath)
elif ext == "xlsx":
excel_to_json(filepath)
else:
raise ValueError(f"Filetype {ext} not supported")

Loading