This is a Molecular weigth calculator for a protein that takes into account both the chain length and the hydrophobic percentage of it. Just submit those two parameters and push Submit!.
library(shiny)
## Warning: package 'shiny' was built under R version 4.2.3
# Define UI
ui <- fluidPage(
titlePanel("Molecular weight calculator for proteins"),
mainPanel(
tags$h1("Welcome to the Molecular Weight Calculator"),
tags$p("This application allows you to calculate the molecular weight of a protein based on the chain length of your protein and the percentage of hydrophobic residues present in it."),
sidebarLayout(
sidebarPanel(
numericInput(inputId = "numericInput", label = "Number of residues (amino acids)", value = 50),
sliderInput(inputId = "sliderInput", label = "Percentage of hydrophobic residues", min = 0, max = 100, value = 50),
actionButton(inputId = "submitBtn", label = "Submit")
),
mainPanel(
textOutput(outputId = "result")
)
)
)
)
# Define server
shinyServer(function(input, output) {
# Perform actions when submit button is clicked
observeEvent(input$submitBtn, {
numericValue <- input$numericInput
sliderValue <- input$sliderInput
# Multiply the numeric value by 110
result <- numericValue * 110*0.01*numericValue
# Display the result
output$result <- renderText({
paste("Result in daltons:", result)
})
})
})