Skip to content

Commit

Permalink
added logo and made esthetic changes to web
Browse files Browse the repository at this point in the history
  • Loading branch information
ssnn-airr committed May 6, 2024
1 parent df8bd3d commit bf7d3d7
Show file tree
Hide file tree
Showing 11 changed files with 539 additions and 149 deletions.
3 changes: 2 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ binder
docker
LICENSE
^.*\.code-workspace
^R/\.repcred-package.R
^R/\.repcred-package.R
^logo
4 changes: 3 additions & 1 deletion inst/rstudio/templates/project/project_files/index.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ output:
toc:
scroll_highlight: yes
collapse: subsection
depth: 4
depth: 4
before: |
<li class="toc-logo"><a href="./"><img src="logo.svg"></a></li>
download: yes
sharing: no
keep_md: true
Expand Down
Binary file not shown.
145 changes: 145 additions & 0 deletions inst/rstudio/templates/project/project_files/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
161 changes: 74 additions & 87 deletions inst/shiny-app/server.R
Original file line number Diff line number Diff line change
@@ -1,90 +1,77 @@
server <- function(input, output) {

original_help_text = "Repcred is an R program that allows you to see visually statistics and information about your repertoire."
output$help_info <- renderText({paste("<h2>Repcred</h2>\n",original_help_text)})


dataValues <- reactiveValues(
repcred_report_path=NULL
)



observe({

val= input$input_chk

if(val==TRUE){
output$condInput <- renderUI({ fileInput("genome", "Choose germline reference FASTA File",
multiple = TRUE,
accept = c("text/tab-separated-values",".fasta",".fna",".ffn",".frn",".fa","text/plain"))
})
}

if(val==FALSE){
output$condInput <- renderUI({})
}


})

help_text="The repertoire file should contain the speficied rows as set out by the AIRR guidelines.Please be aware some stats will be unable to be run if there is missing data in some columns. This is mainly the sumrep stats , if there are specific stats you need makesure the related columns that are required are filled."
help_text2 = "Many of the statistics can be run without a genome file but the genome file does allow missing genes to be pin pointed and gene usage to be analysed."

observeEvent(input$help, {
output$help_info <- renderText({paste("<h2>Repertoire File</h2>\n",help_text,"\n<h2> Genome File </h2>\n",help_text2)})


})

observeEvent(input$go, {
output$openResultsBtn <- renderUI({

#req(input$file1)
withProgress(
tryCatch(
{
dataValues$repcred_report_path <- repcred_report(input$file1$datapath,
genome_file=input$genome$datapath,
#sumrep = input$sumrep,
downsample = input$input_downsample)

},
error = function(e) {
stop(e)

dataValues <- reactiveValues(
repcred_report_path=NULL
)

observe({

val= input$input_chk

if(val==TRUE){
output$condInput <- renderUI({ fileInput("genome",
"Choose germline reference FASTA File",
multiple = TRUE,
accept = c("text/tab-separated-values",".fasta",".fna",".ffn",".frn",".fa","text/plain"))
})
}

if(val==FALSE){
output$condInput <- renderUI({})
}

})

help_text2 = "Many of the statistics can be run without a genome file but the genome file does allow missing genes to be pin pointed and gene usage to be analysed."

observeEvent(input$go, {
output$openResultsBtn <- renderUI({

#req(input$file1)
withProgress(
tryCatch(
{
dataValues$repcred_report_path <- repcred_report(input$file1$datapath,
genome_file=input$genome$datapath,
#sumrep = input$sumrep,
downsample = input$input_downsample)

},
error = function(e) {
stop(e)
}
),
message="Analyzing repertoire..."
)

if (!is.null(dataValues$repcred_report_path)) {

#repcred::replaceChapterClassType(dataValues$repcred_report_path)
shiny::addResourcePath(basename(dirname(dataValues$repcred_report_path)),dirname(dataValues$repcred_report_path))

output$downloadResults <- downloadHandler(
filename = function() {
"report.zip"
},
content = function(fname) {
zip(zipfile=fname, files=dirname(dataValues$repcred_report_path))
if(file.exists(paste0(fname, ".zip"))) {file.rename(paste0(fname, ".zip"), fname)}
},
contentType = "application/zip"
)

div(
actionButton(inputId='openResultsBtn',
label= 'Open analysis results',
icon = icon("link"),
style="color: #fff; background-color: #f39c12; border-color: #f39c12",
onclick =paste0("window.open('",file.path(".",basename(dirname(dataValues$repcred_report_path)),basename(dataValues$repcred_report_path)),"', '_blank')")
),
downloadButton("downloadResults")
)
}
),
message="Analyzing repertoire..."
)

if (!is.null(dataValues$repcred_report_path)) {

#repcred::replaceChapterClassType(dataValues$repcred_report_path)
shiny::addResourcePath(basename(dirname(dataValues$repcred_report_path)),dirname(dataValues$repcred_report_path))

output$downloadResults <- downloadHandler(
filename = function() {
"report.zip"
},
content = function(fname) {
zip(zipfile=fname, files=dirname(dataValues$repcred_report_path))
if(file.exists(paste0(fname, ".zip"))) {file.rename(paste0(fname, ".zip"), fname)}
},
contentType = "application/zip"
)

div(
actionButton(inputId='openResultsBtn',
label= 'Open analysis results',
icon = icon("link"),
style="color: #fff; background-color: #f39c12; border-color: #f39c12",
onclick =paste0("window.open('",file.path(".",basename(dirname(dataValues$repcred_report_path)),basename(dataValues$repcred_report_path)),"', '_blank')")
),
downloadButton("downloadResults")
)
}
})
})


})
})


}
117 changes: 64 additions & 53 deletions inst/shiny-app/ui.R
Original file line number Diff line number Diff line change
@@ -1,56 +1,67 @@
# Define UI
options(shiny.maxRequestSize = 0)
ui <- fluidPage(

tags$head(
tags$link(rel = "stylesheet", type = "text/css", href = "repcred.css")
),

# Sidebar layout
sidebarLayout(
sidebarPanel(align="center",
# App title
fluidRow(titlePanel("Repcred"),
#Help Button
actionButton("help" , "Help")),
br(),
# Input
fileInput("file1", "Choose TSV File (REQUIRED)",
multiple = FALSE,
accept = c("text/tab-separated-values",
".tsv",".csv",".tab", "text/plain")),
#Downsampled input
checkboxInput("input_downsample", "Downsampled repertoire?", value = TRUE ),
#Genome fasta file upload
checkboxInput("input_chk", "Upload germline reference set?", value = FALSE ),
uiOutput("condInput"),

#selectInput("sumrep" , "Select Sumrep stats to run. Full stats takes longer to run but gives pairwise statistics , Basic statistics is faster but contains less statistics." , choices=c("Full sumrep stats" , "Basic sumrep stats")),




actionButton("go", "Run analysis"),

# Output
uiOutput("openResultsBtn")

),


mainPanel = ({
htmlOutput("help_info")
}
)

)



)






ui <- fluidPage(

tags$head(
tags$link(rel = "stylesheet", type = "text/css", href = "repcred.css")
),

tags$script(
HTML(
"$(function () {
$('[data-toggle=tooltip]').tooltip();
});"
)
),

# App title
fluidRow(
id="div-main",
tags$img(src = "logo.svg", width = "100px"),
tags$h1("Rep-Cred"),
tags$strong("Credibility of a repertoire"),
tags$p("Summary statistics and graphical information to quickly asses the quality of a repertoire."),
tabsetPanel(
tabPanel("Rep-Cred",
br(),
# Input
fileInput("file1",
"Choose repertoire (.tsv) (REQUIRED)",
multiple = FALSE,
accept = c("text/tab-separated-values",
".tsv",".csv",".tab", "text/plain")),
# helpText( "Note: The repertoire file should contain the ",
# "speficied rows as set out by the AIRR guidelines.",
# "Please be aware some stats will be unable to be ",
# "run if there is missing data in some columns. ",
# "This is mainly the sumrep stats , if there are ",
# "specific stats you need makesure the related ",
# "columns that are required are filled."),

# Downsample
checkboxInput("input_downsample", "Downsample repertoire?", value = TRUE ),
# helpText( "Note: Whether to downsample the input repertoire",
# "to 5000 sequences."),

# Genome fasta file upload
checkboxInput("input_chk", "Upload germline reference set?", value = FALSE ),
# helpText( "Note: Many of the statistics can be run without ",
# "a genome file but the genome file does allow ",
# "missing genes to be pin pointed and gene usage ",
# "to be analysed."),

# Sumrep
uiOutput("condInput"),
#selectInput("sumrep" , "Select Sumrep stats to run. Full stats takes longer to run but gives pairwise statistics , Basic statistics is faster but contains less statistics." , choices=c("Full sumrep stats" , "Basic sumrep stats")),
actionButton("go", "Run analysis"),

# Output
uiOutput("openResultsBtn")

),
tabPanel("Help"),
tabPanel("About")
)
)
)
Binary file removed inst/shiny-app/www/logo.png
Binary file not shown.
Loading

0 comments on commit bf7d3d7

Please sign in to comment.