Skip to content

Commit

Permalink
Merge pull request #11 from p2m2/develop
Browse files Browse the repository at this point in the history
0.0.2
  • Loading branch information
ofilangi authored Mar 20, 2023
2 parents ad03970 + 1982f67 commit d502c40
Show file tree
Hide file tree
Showing 8 changed files with 131 additions and 110 deletions.
9 changes: 5 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ workflows:
- build
context:
- DOCKER_CONTEXT
- GITHUB_CONTEXT
- SHINYAPP_CONTEXT
filters:
tags:
only: /.*/
branches:
only:
- develop

jobs:
build:
working_directory: ~/tmp
Expand Down Expand Up @@ -96,5 +95,7 @@ jobs:
- run:
name: deployment on https://www.shinyapps.io/
command: |
[ -z "${CIRCLE_TAG}" ] && export APP_NAME="${CIRCLE_PROJECT_REPONAME}-${CIRCLE_BRANCH}" || export APP_NAME="${CIRCLE_PROJECT_REPONAME}"
# publish only tag release
export APP_NAME="${CIRCLE_PROJECT_REPONAME}"
export GITHUB_PAT=${GITHUB_TOKEN}
./publish_rshinyapp.sh
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: oligopeptidesMatching
Title: Library of functions for in silico construction and detection of oligopeptides
Description: In order to compute from amino acids molecular weight the putative oligomers of various oligomerization degree.
Version: 0.0.1
Version: 0.0.2
Authors@R: c(
person(given = "Kevin",
family = "Billet",
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# oligopeptides_matching

[![p2m2](https://circleci.com/gh/p2m2/oligopeptides_matching.svg?style=shield)](https://app.circleci.com/pipelines/github/p2m2)
[![](https://img.shields.io/badge/Shiny-shinyapps.io-blue?style=flat&labelColor=white&logo=RStudio&logoColor=blue)](https://p2m2.shinyapps.io/oligopeptides_matching/)
[![](https://img.shields.io/badge/stable-shinyapps.io-blue?style=flat&labelColor=white&logo=RStudio&logoColor=blue)](https://p2m2.shinyapps.io/oligopeptides_matching/)

In order to compute from amino acids molecular weight the putative oligomers of various oligomerization degree

Expand Down Expand Up @@ -109,12 +109,11 @@ install.packages("shiny")
install.packages("DT")

library(shiny)
library(DT)

library(devtools)
library(roxygen2)
document()
runApp("exampleOligopeptidesMatching_aa")
runApp("oligopeptides_matching")
```

### Examples
Expand Down
97 changes: 2 additions & 95 deletions oligopeptides_matching/app.R
Original file line number Diff line number Diff line change
@@ -1,99 +1,6 @@
library(shiny)
library(DT)

# Constants
### Amino acids
aa <- c("A", "C", "D", "E", "F", "G", "H", "I", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "V", "W", "Y")

### amino acids molecular weight
mass_aa <- c(89.047679, 121.019751, 133.037509, 147.053159, 165.078979,
75.032029, 155.069477, 131.094629, 146.105528, 131.094629,
149.051051,132.053493, 115.063329, 146.069143, 174.111676,
105.042594,119.058244, 117.078979,204.089878, 181.073894)

aa_mw <- setNames(mass_aa, aa)

### Polyphenols
polyphenol <- c("Cyanidin",
"Cyanidin 3,5-O-diglucoside",
"Cyanidin 3-O-(6''-acetyl-galactoside)",
"Cyanidin 3-O-(6''-acetyl-glucoside)",
"Cyanidin 3-O-(6''-caffeoyl-glucoside)")

### polyphenol molecular weight
mass_polyphenol <- c(287.244, 611.525,491.422, 491.422, 611.527)

pp_mw <- setNames(mass_polyphenol, polyphenol)

### reaction elements
H2O <- 18.010565
H <- 1.007825

ionization_list = stats::setNames(c(H),c("H"))


# See above for the definitions of ui and server
ui <- fluidPage(

# App title ----
titlePanel("Oligopeptides Matching"),

# Sidebar layout with a input and output definitions ----
sidebarLayout(

# Sidebar panel for inputs ----
sidebarPanel(

# Input: Numeric entry for number of obs to view ----
numericInput(inputId = "od",
label = "Oligomerization degree:",
value = 3),
numericInput(inputId = "mz_obs",
label = "M/z observed :",
value = 953.669),
numericInput(inputId = "ppm_error",
label = "Tolerance:",
value = 10)
),
# Main panel for displaying outputs ----
mainPanel(
h3("Oligopeptides"),
# Output: HTML table with requested number of observations ----
DT::dataTableOutput("view")
)
)
)

server <- function(input, output) {



output$view <- DT::renderDataTable(
{aa_combined <- get_oligopeptides(
aminoacids = aa_mw,
chemical_reaction = H2O,
ionization = ionization_list,
oligomerization_degree = input$od)

aa_combined_names <- c(aa_combined$id)
aa_combined_mass <- c(aa_combined$MW)
aa_combined_mw <- setNames(aa_combined_mass, aa_combined_names)

combined_compounds <- get_combination_compounds(
compounds_1 = aa_combined_mw,
compounds_2 = pp_mw,
chemical_reaction = H2O,
ionization = setNames(c(H), c("H")))
mz_obs <- 953.669
combined_compounds_near_obs <-
match_mz_obs(input$mz_obs, combined_compounds,
ppm_error = input$ppm_error)

return(combined_compounds_near_obs)
}

)

}
source(server.R)
source(ui.R)

shinyApp(ui = ui, server = server)
29 changes: 29 additions & 0 deletions oligopeptides_matching/data.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Constants
### Amino acids
aa <- c("A", "C", "D", "E", "F", "G", "H", "I", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "V", "W", "Y")

### amino acids molecular weight
mass_aa <- c(89.047679, 121.019751, 133.037509, 147.053159, 165.078979,
75.032029, 155.069477, 131.094629, 146.105528, 131.094629,
149.051051,132.053493, 115.063329, 146.069143, 174.111676,
105.042594,119.058244, 117.078979,204.089878, 181.073894)

aa_mw <- setNames(mass_aa, aa)

### Polyphenols
polyphenol <- c("Cyanidin",
"Cyanidin 3,5-O-diglucoside",
"Cyanidin 3-O-(6''-acetyl-galactoside)",
"Cyanidin 3-O-(6''-acetyl-glucoside)",
"Cyanidin 3-O-(6''-caffeoyl-glucoside)")

### polyphenol molecular weight
mass_polyphenol <- c(287.244, 611.525,491.422, 491.422, 611.527)

pp_mw <- setNames(mass_polyphenol, polyphenol)

### reaction elements
H2O <- 18.010565
H <- 1.007825

ionization_list = stats::setNames(c(H),c("H"))
42 changes: 42 additions & 0 deletions oligopeptides_matching/server.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
library(shiny)
library(DT)
library(oligopeptidesMatching)

source("./data.R")

server <- function(input, output) {

combination_compounds <- reactive({
aaa_combined <- get_oligopeptides(
aminoacids = aa_mw,
chemical_reaction = H2O,
ionization = ionization_list,
oligomerization_degree = input$od)

aa_combined <- as.data.frame(aaa_combined)
aa_combined_names <- c(aa_combined$id)
aa_combined_mass <- c(aa_combined$MW)
aa_combined_mw <- setNames(aa_combined_mass, aa_combined_names)

return(get_combination_compounds(compounds_1 = aa_combined_mw,
compounds_2 = pp_mw,
chemical_reaction = H2O,
ionization = setNames(c(H),c("H"))))
})
# =====
# All arrangement AA with PolyPhenols
output$view_arrangement <- DT::renderDataTable(
combination_compounds()
)
# =====
# Filtering on a single Value

output$view_filter_mz_obs <- DT::renderDataTable(
{
return(match_mz_obs(
input$mz_obs,
combination_compounds(),
ppm_error = input$ppm_error))
}
)
}
44 changes: 44 additions & 0 deletions oligopeptides_matching/ui.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
ui <- navbarPage("Oligopeptides Matching",
tabPanel("Combination AA Polyphenol",

# Sidebar layout with a input and output definitions ----
sidebarLayout(

# Sidebar panel for inputs ----
sidebarPanel(
# Input: Numeric entry for number of obs to view ----
numericInput(inputId = "od",
label = "Oligomerization degree:",
value = 3)
),
# Main panel for displaying outputs ----
mainPanel(
h3("Oligopeptides"),
# Output: HTML table with requested number of observations ----
DT::dataTableOutput("view_arrangement")
)
)
),
tabPanel("Match a single Mz",
# Sidebar layout with a input and output definitions ----
sidebarLayout(

# Sidebar panel for inputs ----
sidebarPanel(
numericInput(inputId = "mz_obs",
label = "M/z observed :",
value = 953.669),
numericInput(inputId = "ppm_error",
label = "Tolerance:",
value = 10)
),
# Main panel for displaying outputs ----
mainPanel(
h3("Oligopeptides"),
# Output: HTML table with requested number of observations ----
DT::dataTableOutput("view_filter_mz_obs")
)
)
),
tabPanel("Match a list of Mz")
)
13 changes: 6 additions & 7 deletions publish_rshinyapp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

install.packages('rsconnect')

library(devtools)
library(roxygen2)
document()
install()
#library(devtools)
#library(roxygen2)
#document()
#install()

library(rsconnect)

Expand All @@ -32,7 +32,6 @@ if ( nchar(APP_NAME)<=0 ) {

install.packages("shiny")
install.packages("DT")
library(shiny)
library(DT)
devtools::install_github("p2m2/oligopeptides_matching")

rsconnect::deployApp('oligopeptides_matching',appName=APP_NAME,forceUpdate = TRUE)
rsconnect::deployApp('oligopeptides_matching',appName=APP_NAME,forceUpdate = TRUE)

0 comments on commit d502c40

Please sign in to comment.