diff --git a/R/mix.R b/R/mix.R index e1afbcd328639d47e753a4c61f3f470376124a9c..5d8ce29a0e33a102e42e986ba58e25098c947346 100644 --- a/R/mix.R +++ b/R/mix.R @@ -326,18 +326,6 @@ preProc <- function (summ,noiseFac=3,errRT=0.5,intThreshMS1=1e5,intThreshMS2=500 summ } -smiles2img <- function(smiles, kekulise=TRUE, width=300, height=300, - zoom=1.3,style="cow", annotate="off", abbr="on",suppressh=TRUE, - showTitle=FALSE, smaLimit=100, sma=NULL) { - dep <- rcdk::get.depictor(width = width, height = height, zoom = zoom, style = style, annotate = annotate, - abbr = abbr, suppressh = suppressh, showTitle = showTitle, smaLimit = smaLimit, - sma = NULL) - - mol <- RMassBank::getMolecule(smiles) - z<-rcdk::view.image.2d(mol, depictor=dep) - grid::rasterGrob(z) -} - gen_ms2_spec_data <- function(id,tag,iMS2rt,data,luckyN=NA) { ## Given the id, tag and the index of the MS2 spectrum, return the ## dataframe of the spectrum, with luckyN number of lagerst diff --git a/R/plotting.R b/R/plotting.R index 7d203b3557ef6e9a1499cb80ca7928980b46126f..01529c55924ea9a26883e120c8b663729d539cd8 100644 --- a/R/plotting.R +++ b/R/plotting.R @@ -339,6 +339,17 @@ plot_save_single <- function(plot,decotab,extension,proj_path,subdir=FIG_TOPDIR, ## NEW BEGINNINGS +smiles2img <- function(smiles, kekulise=TRUE, width=300, height=300, + zoom=1.3,style="cow", annotate="off", abbr="on",suppressh=TRUE, + showTitle=FALSE, smaLimit=100, sma=NULL) { + dep <- rcdk::get.depictor(width = width, height = height, zoom = zoom, style = style, annotate = annotate, + abbr = abbr, suppressh = suppressh, showTitle = showTitle, smaLimit = smaLimit, + sma = NULL) + + mol <- RMassBank::getMolecule(smiles) + z<-rcdk::view.image.2d(mol, depictor=dep) + grid::rasterGrob(z) +} theme_eic <- function(...) theme_light()+ggplot2::theme(axis.title=ggplot2::element_text(size=15L), axis.text=ggplot2::element_text(size=12L,colour="black"), diff --git a/R/shiny-ui-base.R b/R/shiny-ui-base.R index f2bf6ae59387c8e8213b19475bdc28980959834b..e93fa9ae54dccefc41b0847c7f59be7277fb0384 100644 --- a/R/shiny-ui-base.R +++ b/R/shiny-ui-base.R @@ -1276,8 +1276,22 @@ mk_shinyscreen_server <- function(projects,init) { p3 <- rf_plot_spec_ms2() combine_plots(p1,p2,p3) + },height=1000) + output$plot_hover_out <- renderText({ + inp1 <- input$plot_hover[[1]] + inp2 <- input$plot_hover[[2]] + res <- if (all(!(c(is.null(inp1),is.null(inp2))))) { + paste0('(', + format(inp1,digits=5), + ',', + format(inp2,digits=2,scientific=T), + ')') + } else "Currently not in the plot." + + }) + output$plot_struct <- renderPlot({ rf_plot_struct() }) @@ -2007,18 +2021,7 @@ mk_shinyscreen_server <- function(projects,init) { rf_plot_spec_facet() }) - output$plot_hover_out <- renderText({ - inp1 <- input$plot_hover[[1]] - inp2 <- input$plot_hover[[2]] - res <- if (all(!(c(is.null(inp1),is.null(inp2))))) { - paste0('(', - format(inp1,digits=5), - ',', - format(inp2,digits=2,scientific=T), - ')') - } else "Currently not in the plot." - - }) + output$dwn_proj_b <- shiny::downloadHandler( filename=function() { diff --git a/inst/rmd/app.Rmd b/inst/rmd/app.Rmd index 67e0740f4ce12ba160fc45f4ed4c14449963bf32..1ebb857e743f68617a44791faff6c7fc061cd43a 100644 --- a/inst/rmd/app.Rmd +++ b/inst/rmd/app.Rmd @@ -614,13 +614,17 @@ DT::dataTableOutput("setid_table") <div style="display: flex; flex-flow: column; padding-right:1.0em"> ### Compound Index ```{r, echo=F} -selectInput("cindex_group",label="Group",choices=c(NA_character_,"adduct","tag"), multiple=T) +selectInput("cindex_group",label="Group", + choices=c(NA_character_, + "adduct","tag"), + multiple=T, + selected=c("adduct","tag")) ``` <div style="display: flex; flex-flow: row nowrap"> ```{r, echo=F} -selectInput("sort1",label="Sort by ", choices=shinyscreen:::ARRANGE_CHOICES,width="15%") -selectInput("sort2",label="then by ", choices=shinyscreen:::ARRANGE_CHOICES,width="15%") +selectInput("sort1",label="Sort by ", choices=shinyscreen:::ARRANGE_CHOICES,width="15%",selected="quality") +selectInput("sort2",label="then by ", choices=shinyscreen:::ARRANGE_CHOICES,width="15%",selected="mz") selectInput("sort3",label="then", choices=shinyscreen:::ARRANGE_CHOICES,width="15%") selectInput("sort4",label="and finally by", choices=shinyscreen:::ARRANGE_CHOICES,width="15%") ``` @@ -640,25 +644,6 @@ DT::DTOutput("cindex") <div style="display: flex; flex-direction: row; flex-wrap: nowrap;"> <!-- EICs and Structure --> <div style="width: 80%; overflow-y: scroll;"> <!-- EIC ID Plot --> ```{r,echo=F} -## plotOutput("plot_eic_ms1", -## hover = hoverOpts(id="plot_hover", -## delayType = "throttle", -## delay=100), -## dblclick = "plot_rt_click", -## brush = "plot_brush") -## plotOutput("plot_eic_ms2", -## hover = hoverOpts(id="plot_hover", -## delayType = "throttle", -## delay=100), -## dblclick = "plot_rt_click", -## brush = "plot_brush") -## plotOutput("plot_spec_ms2", -## hover = hoverOpts(id="plot_hover", -## delayType = "throttle", -## delay=100), -## dblclick = "plot_mz_click", -## brush = brushOpts(id="plot_mz_brush")) - plotOutput("plot_eic_combined", ## height="100%", hover = hoverOpts(id="plot_hover", @@ -669,24 +654,24 @@ plotOutput("plot_eic_combined", ``` </div> <!-- EIC ID Plot --> -<div style="width: 20%;"> <!-- Structure --> +<div style="display: flex; flex-direction: column; width=20%;"> <!-- Structure and Dynamic Plot Data --> + ```{r, echo=F} -plotOutput("plot_struct") +plotOutput("plot_struct", width="400%") ``` -</div> <!-- Structure --> + +#### Pointer Position + +```{r, echo=F} +textOutput("plot_hover_out") +``` + +</div> <!-- Structure and Dynamic Plot Data --> + </div> <!-- EICs and Structure --> <div style="display: flex; flex-direction: row; flex-wrap: nowrap;"> <!-- Spec and Details--> -<!-- <div style="width: 40%"> <\!-- MS2 Spec -\-> --> -<!-- ```{r, echo=F} --> -<!-- plotOutput("plot_spec_ms2", --> -<!-- hover = hoverOpts(id="plot_hover", --> -<!-- delayType = "throttle", --> -<!-- delay=100), --> -<!-- dblclick = "plot_mz_click", --> -<!-- brush = brushOpts(id="plot_mz_brush")) --> -<!-- ``` --> -<!-- </div> <\!-- MS2 Spec -\-> --> + <div style="display: flex; flex-direction: row; flex-wrap: nowrap; padding-top: 2em; padding-left: 2em;"> <!-- Modification --> <div> <!-- Select MS1 curve --> ```{r,echo=F} @@ -707,11 +692,6 @@ actionButton(inputId="change_qa_b",label="Commit changes") </div> <!-- Spec and Details--> <div style="display: flex-flow: row nowrap"> <!-- Control Bar --> - -```{r,echo=F} -textOutput("plot_hover_out") -``` - ```{r, echo=F} actionButton("plot_save_single", label="Save this plot")