Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
ppernot committed Jul 21, 2022
1 parent 8b6c4ba commit 9f6d163
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
20 changes: 10 additions & 10 deletions server_files/neutralsEdit.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,19 @@ shiny::observeEvent(
# Make copy of source directory
neutralsOrigDir = file.path(neutralsSource,neutralsOrigVersion())
neutralsCopyDir = file.path(neutralsSource,neutralsCopyVersion())
if(!dir.exists(neutralsCopyDir))
dir.create(neutralsCopyDir)
files = list.files(path=neutralsOrigDir)
for(file in files)
if(!dir.exists(neutralsCopyDir)) {
file.copy(
from = file.path(neutralsOrigDir,file),
to = file.path(neutralsCopyDir,file),
overwrite = TRUE
recursive = TRUE
)
id = shiny::showNotification(
h4(paste0('Created version: ', neutralsCopyVersion())),
closeButton = FALSE,
duration = 5
)
id = shiny::showNotification(
h4(paste0('Created new version: ', neutralsCopyVersion())),
closeButton = FALSE,
duration = 5
)
}

# Save modified file to target version
data = isolate(input$ace)
writeLines(
Expand All @@ -119,5 +118,6 @@ shiny::observeEvent(
closeButton = FALSE,
duration = 5
)

}
)
14 changes: 9 additions & 5 deletions server_files/neutralsParse.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ observeEvent(
{
req(neutralsVersion())

pasteNoNA = function(x) {
paste(x[!is.na(x)],collapse=" ")
}

nbReac = 0
reactants = products = params = type = orig = notes = list()

Expand All @@ -41,7 +45,7 @@ observeEvent(
file = file.path(neutralsSource,neutralsVersion(),filename),
header = FALSE
)
comments = apply(scheme, 1, function(x) paste(x[15:length(x)],collapse=" "))
comments = apply(scheme, 1, function(x) pasteNoNA(x[15:length(x)]))
scheme = t(apply(scheme, 1, function(x) gsub(" ", "", x)))
for (i in 1:nrow(scheme)) {
if(substr(scheme[i,1],1,1)=='#') next
Expand All @@ -63,7 +67,7 @@ observeEvent(
file = file.path(neutralsSource,neutralsVersion(),filename),
header = FALSE
)
comments = apply(scheme, 1, function(x) paste(x[25:length(x)],collapse=" "))
comments = apply(scheme, 1, function(x) pasteNoNA(x[25:length(x)]))
scheme = t(apply(scheme, 1, function(x) gsub(" ", "", x)))
for (i in 1:nrow(scheme)) {
if(substr(scheme[i,1],1,1)=='#') next
Expand All @@ -86,7 +90,7 @@ observeEvent(
file = file.path(neutralsSource,neutralsVersion(),filename),
header = FALSE
)
comments = apply(scheme, 1, function(x) paste(x[15:length(x)],collapse=" "))
comments = apply(scheme, 1, function(x) pasteNoNA(x[15:length(x)]))
scheme = t(apply(scheme, 1, function(x) gsub(" ", "", x)))
for (i in 1:nrow(scheme)) {
if(substr(scheme[i,1],1,1)=='#') next
Expand All @@ -109,7 +113,7 @@ observeEvent(
file = file.path(neutralsSource,neutralsVersion(),filename),
header = FALSE
)
comments = apply(scheme, 1, function(x) paste(x[25:length(x)],collapse=" "))
comments = apply(scheme, 1, function(x) pasteNoNA(x[25:length(x)]))
scheme = t(apply(scheme, 1, function(x) gsub(" ", "", x)))
for (i in 1:nrow(scheme)) {
if(substr(scheme[i,1],1,1)=='#') next
Expand All @@ -135,7 +139,7 @@ observeEvent(
header = FALSE,
stringsAsFactors = FALSE
)
comments = apply(scheme, 1, function(x) paste(x[25:length(x)],collapse=" "))
comments = apply(scheme, 1, function(x) pasteNoNA(x[25:length(x)]))
scheme = t(apply(scheme, 1, function(x) gsub(" ", "", x)))
for (i in 1:nrow(scheme)) {
if(substr(scheme[i,1],1,1)=='#') next
Expand Down
4 changes: 2 additions & 2 deletions server_files/neutralsSample.R
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ output$plotRate = renderPlot({

par(
mfrow = c(1, 2),
mar = c(3,3,8,2),
mar = c(3,3,9,2),
mgp = gPars$mgp,
tcl = gPars$tcl,
lwd = gPars$lwd,
Expand Down Expand Up @@ -273,7 +273,7 @@ output$plotRate = renderPlot({
side = 3,
cex = 1.5,
adj = 0,
line = 7,
line = 8,
padj = 1,
col = gPars$cols[1]
)
Expand Down

0 comments on commit 9f6d163

Please sign in to comment.