-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from p2m2/develop
0.0.2
- Loading branch information
Showing
8 changed files
with
131 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) | ||
} | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters