Skip to content

Commit 89b74cd

Browse files
committed
WIP
1 parent 3af9ba6 commit 89b74cd

File tree

1 file changed

+50
-41
lines changed

1 file changed

+50
-41
lines changed

vignettes/writing_templates_and_data_guides.Rmd

Lines changed: 50 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ vignette: >
1010
```{r, include = FALSE}
1111
knitr::opts_chunk$set(
1212
collapse = TRUE,
13-
comment = "#>"
13+
comment = "#>",
14+
echo = FALSE
1415
)
1516
```
1617

@@ -47,37 +48,64 @@ of data by the user.
4748

4849
## Structuring a template
4950

51+
To provide a link between the data structures of programming languages and
52+
those in a spreadsheet we consider the following four types of data structures
53+
in a template:
54+
55+
- **keyvalue**: a key-value pair, where the key is a variable name and the value
56+
is the value of that variable. The key and value are placed in horizontally
57+
adjacent cells (columns). The key, or its translated short name (see below)
58+
is to be used as the parameter name in the scripts and should conform to
59+
variable naming rules for the scripting language used. The key is found in
60+
the left-most cell of a cell range. The value can be a single value (one cell)
61+
or a vector of values (multiple cells).
62+
- **cells**: occasionally it may be more convenient to read values from single
63+
cells and provide the keys (names) of the corresponding variables in the data
64+
guide. These data will be stored as key-value pairs, but in contrast to the
65+
**keyvalue** data type where a variable name is provided in the template
66+
the data guide must provide a variable name.
67+
- **table**: tabular data where columns represent variables and rows represent
68+
items in which these variables are assessed. Column names are written in the
69+
first row and are used as variable names.
70+
- **platedata**: data are registered in the same row-column format as the
71+
microplate in which the experiment was performed. The first row contains the
72+
variable name in its left-most cell, and is followed by (integer) column names.
73+
Every subsequent row contains the row name (in capital letters) followed by the
74+
values for each well. Both variable name and data are read by the script. The
75+
column and row names are ignored. Therefore, the first row and column in the
76+
range could also be empty, except for the variable name. Plate data are stored
77+
as tables in which, apart from the variables provided in the template two
78+
additional columns are added, namely row and column, corresponding to the row
79+
and column in a microplate.
80+
5081
Below is an example of the front page of a template (of the fitc-t4 TTR assay),
5182
illustrating a number of ideas and concepts that we discuss below.
5283

53-
![front page](images/template_frontpage.png){width=100%}
84+
```{r, out.width="100%", fig.cap="First page of a template"}
85+
knitr::include_graphics("images/template_frontpage.png")
86+
```
5487

55-
### A template must have a version number
88+
### A template has a version number
5689

5790
Unique template version numbers are a way to prevent misunderstandings
5891
between users and are also needed here to check whether a data guide is
5992
compatible with the template version.
6093

61-
#### Version numbering rules
62-
63-
We follow the R-package version rules. A version number has the structure
64-
**<kbd>major.minor</kbd>** or **<kbd>major.minor.patch</kbd>**, where
65-
<kbd>major</kbd>, <kbd>minor</kbd> and <kbd>patch</kbd> are each
94+
**Version numbering rules**. We follow the R-package version rules. A version
95+
number has the structure <kbd>major.minor</kbd> or <kbd>major.minor.patch</kbd>,
96+
where <kbd>major</kbd>, <kbd>minor</kbd> and <kbd>patch</kbd> are each
6697
integer values. A version consisting of only a major number is invalid, but
6798
will be interpreted as having a minor version <kbd>0</kbd>, *i.e.* a version
6899
"<kbd>2</kbd>" will be interpreted as "<kbd>2.0</kbd>".
69100

70101
In practice this means that the format of the cell in which the version number
71102
is recorded should be *text*, and not *general* or *number*
72103

73-
#### A template name is optional
74-
75-
Preferably, a template also has a name. Note that the example in the figure
76-
above doesn't have a name.
77-
78-
#### Checking compatibilty of template versions and a guide version
104+
**A template name is optional**. Preferably, a template also has a name. Note
105+
that the example in the figure above doesn't have a name.
79106

80-
We use template version numbers to check compatibility with a guide. In principle
107+
**Checking compatibilty of template versions and a guide version**. We use
108+
template version numbers to check compatibility with a guide. In principle
81109
the same guide can be used for multiple versions of a template as long as the
82110
locations and names of variables indexed in the guide did not change. This is the
83111
case when, for example, only explanatory texts or calculations or data validity
@@ -105,7 +133,10 @@ the data is entered.
105133

106134
### A single source of parameters
107135

108-
![The parameters as key-value pairs](images/parameters.png){width=35%}
136+
```{r, out.width="40%", fig.align='center', fig.cap="The parameters as key-value pairs"}
137+
knitr::include_graphics("images/parameters.png")
138+
```
139+
109140

110141
Parameters needed for calculations, for example for acceptance criteria of
111142
measurements are best entered on a separate sheet, and referred to by absolute
@@ -116,36 +147,14 @@ well.
116147

117148
### Use of hidden worksheets for data transfer
118149

119-
![A hidden sheet with links to plate-formetted data](images/data.png){width=100%}
120150

151+
```{r, out.width="100%", fig.align='center', fig.cap="A hidden sheet with links to plate-formatted data"}
152+
knitr::include_graphics("images/data.png")
153+
```
121154

122155

123156
## What else?
124157

125-
To facilitate automatic reading from the spreadsheet by scripts data must be
126-
in either of these four formats:
127-
128-
- **keyvalue** format. Here, the key and value are placed in horizontally
129-
adjacent cells (columns). The key, or its translated short name (see below)
130-
is to be used as the parameter name in the
131-
scripts and should conform to variable naming rules for the scripting language
132-
used. The key is found in the left-most cell of a cell range. The value can be a
133-
single value (one cell) or a vector of values (multiple cells).
134-
- **platedata** format. Here the data are registered in the same row-column
135-
format as the microplate in which the experiment was performed. The first row
136-
contains the variable name in its left-most cell, and is followed by (integer)
137-
column names. Every subsequent row contains the row name (in capital letters)
138-
followed by the values for each well. Both variable name and data are read by
139-
the script. The column and row names are ignored. Therefore, the first row
140-
and column in the range could also be empty, except for the variable name.
141-
- **table** format. This is the format for tabular data where columns represent
142-
variables and rows represent items in which these variables are assessed. Column
143-
names are written in the first row.
144-
- **cells** format. Occasionally it may be more convenient to read values from
145-
single cells and provide the keys (names) of the corresponding variables in the
146-
data guide.
147-
148-
149158
The keyvalue format will be mostly used for metadata and parameters. All keyvalue
150159
will be aggregated in a single named list called "keyvalue".
151160

0 commit comments

Comments
 (0)