-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathWF_example.Rmd
More file actions
76 lines (62 loc) · 1.5 KB
/
WF_example.Rmd
File metadata and controls
76 lines (62 loc) · 1.5 KB
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
71
72
73
74
75
76
---
title: "Timecourse of a Model: Autoplotting and saving as .jpeg"
author: "Johanna Daas"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.width = 8,
fig.asp = 10/16,
out.width = "100%",
error = TRUE,
warning = FALSE,
message = FALSE
)
set.seed(1)
```
# Setup
First, load the libraries needed for the workflow
```{r, message = FALSE, results ='hide'}
library(tidyverse)
library(CoRC)
```
# Input
Put in all variables needed to customise the workflow
Put in the path to the model (SBML), as url or local path (as string) and load the model. Use `loadModel()` for .cps models.
```{r}
modelPathSBML <- "./Models/Schaber2012SUP_model.xml"
loadSBML(modelPathSBML)
```
Set the timecourse settings. Further specifications are possible.
```{r}
setTimeCourseSettings(duration = 50,
intervals = 100)
```
Where should the .jpeg image be saved?
```{r}
jpegPath <- "docs/timecourse.jpeg"
```
# Workflow
This should generally not need to be changed, only if the workflow is to be changed more generally.
```{r}
# Check if path is already taken:
if(file.exists(jpegPath))
stop("Error: This file does already exist.")
# Run time course
timecourse <- runTimeCourse()
# Autoplot time course
plot <- autoplot.copasi_ts(timecourse)
# plot and save as pdf
jpeg(jpegPath)
print(plot)
dev.off()
```
# Output
This workflow produces the following output:
```{r}
# Show the Plot
plot
```
and saves the image in the file `r jpegPath`.