-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.R
70 lines (30 loc) · 1.66 KB
/
server.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Copyright (C) 2016-2017 Mohammad Tarek Mansour - AFSponge BioInformatics Lab
#AFSponge-Egypt IGEM2017
# This file is the server part of the platform.
# ------------------------------------------------------------------------------------
library(shiny)
library(deSolve)
library(ggplot2)
shinyServer(function(input, output) {
output$default <- renderText({ input$text })
IGEM <- function(t, state, parameters) { # returns rate of change
with(as.list(c(state, parameters)), {
dCircularRNA = ksc - kgc* CircularRNA +( -kas * miRNA * CircularRNA +kgc*Sponge)
dmiRNA = ksmi - kgmi + (-kas* miRNA *CircularRNA+kds * Sponge)
dSponge = kas*miRNA*CircularRNA - (kds + kgc)*Sponge
return(list(c(dCircularRNA, dmiRNA,dSponge)))
})
}
output$guessPlot <- reactivePlot(function() {
state <- c(CircularRNA = input$C, miRNA = input$Mi, Sponge = input$CM)
parameters <- c( ksc = input$ksc, kas = input$kas, kds = input$kds, kgc = input$kgc, ksmi = input$ksmi, kgmi = input$kgmi )
time <- seq(0, input$tmax, by = 0.1)
## Integration with 'ode'
out <- ode(y = state, times = time, func = IGEM, parms = parameters)
## Ploting
out.df = as.data.frame(out) # required by ggplot: data object must be a data frame
library(reshape2)
out.m = melt(out.df, id.vars='time') # this makes plotting easier by puting all variables in a single column
print(ggplot(data = out.m, aes(time, value, color = variable)) + geom_point())
})
})