forked from AlexisMaizel/RStudio_paper_writing_course
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathManuscript.qmd
185 lines (130 loc) · 9.02 KB
/
Manuscript.qmd
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
---
title: "New paper template"
subtitle: |
\raggedright Author 1^1,2,\*^ , Author 2^1,2^, Author 3^3^, Author 4E^4^ \newline<br>^1^Heidelberg University, Centre for Organismal Studies (COS), 69120 Heidelberg, Germany \newline<br>^2^Affiliation 2 \newline<br>^3^Affiliation 3 \newline<br>^4^Affiliation 4\newline<br> ^\*^Correspondence: [email protected]
mainfont: Arial
monofont: DejaVu Sans Mono #Times New Roman
fontsize: 11pt
linestretch: 1.2
linkcolor: blue
documentclass: article
crossref:
fig-title: Figure # (default is "Figure")
max-width: 100%
format:
html:
embed-resources: true
pdf:
pdf-engine: xelatex
number-sections: false
margin-left: 0.8in
margin-right: 0.8in
margin-top: 0.8in
margin-bottom: 0.8in
toc: true
keep-tex: true
include-in-header:
text: |
\usepackage{lineno}
include-before-body:
text: |
\linenumbers
bibliography: references.bib #add bibliography in this file
csl: elife.csl #change according to journal
---
```{r include=FALSE}
source("../analysis/scripts/statistics_for_paper.R")
```
# Abstract
[This]{.underline} is an R **Markdown** *document.* ^Markdown^ is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
**text in bold** *italic* [underline]{.underline}
# Introduction
You can add references either by referring to their id in the .bib file e.g., [@Marinkovi2020], or by switching to the visual editor (Cogwheel in the .Rmd menu -\> Use Visual Editor). [@Jokura_2023][@Jokura_2023][@Jacobs2023]
It is now a test to edit the text and see how the changes show up on GitHub.
Test of git show.
In the visual editor mode, go to 'Insert' -\> \@ Citation
You can select a Zotero library, PubMed, CrossRef etc. and insert the citations. [@Jacobs2023]
The easiest way is to use the command line:
```{bash}
#| echo: true
#| eval: false
curl -LH "Accept: application/x-bibtex" https://doi.org/10.7554/eLife.91258.1 >> references.bib
```
*Platynereis dumerilii* is a marine annelid... [@ozpolat2021]
The references are stored in manuscript/references.bib (need to be defined in the Yaml header). This file will automatically updated when you insert a new reference through the Visual editor \> Insert \> Citations.
In this documents, references will be formatted in the style of eLife. This is defined in the Yaml header under: csl: elife.csl. The elife.csl file is saved in the /manuscript folder.
If you would like to use a different citation format, download the respective .csl file (e.g., from the Zotero style repository <https://www.zotero.org/styles>), save it in the /manuscript folder of the project and change the Yaml to csl: your_favourite_journal.csl.
## Results
Inserting Figures <!--# I don't agree here -->
Test comment here. <!--# Hi -->
You can add your figures into the rendered document. We saved the figures into /manuscript/figures or /manuscript/figure_supplements and can insert them from there. We use knitr::include_graphics for this. The title and legend can also be edited, as will as the width of the output figure. Test comment behaviour: <!--# Test comment for git show -->
```{r}
#| echo: false
#| eval: false
print("hi")
```
```{r, out.width = "100%", fig.cap="**Figure 1. A figure** (A) A nice picture. (B) legend. (C) <br> (D) " }
#| echo: false
knitr::include_graphics("figures/Figure1.png")
```
```{r, out.width = "100%", fig.cap="**Figure 1. Our nice figure from yesterday** (A) A nice picture. (B) legend. (C) <br> (D) " }
#| echo: false
knitr::include_graphics("figures/Figure_complex.png")
```
## Equations
Equations can also be inserted, Insert -\> Display Math:
$$
\bar{X} = \frac{\sum_{i=1}^{n} x_{i}}{n}
$$
\
## Sourcing code and working with variable
```{r}
#| include: false
#| eval: true
source(here::here("analysis/scripts/statistics_for_paper.R"))
```
The mean value of Nanog expression was `r Nanog_mean` indicating that Nanog is downregulated. The 'analysis/scripts/statistics_for_paper.R' script is sourced and it runs but the output is not included in the knitted output. But we can access the variables defined in the sourced script simply by adding \` r var_name \` between \` backticks, in this case max_PRC value is `r max_PRC` (now this number comes from our sourced script).
If we update the data, the script can recalculate the variable we want to refer to in the text and update the number.
## Acknowledgements
We would like to thank the Jekely lab for the R project template (<https://github.com/JekelyLab/new_paper_template>) we used to write this paper. This work was funded by ...
## Materials and Methods
You can insert tables from source data, such as .csv or Excel files and render them in html with the tinytable package.
Alternatively, you can use the Markdown grid table format. For more complex tables, you can use the [tablesgenerator](https://www.tablesgenerator.com/markdown_tables) online grid table editor/converter (e.g. converts csv or excel files).
The output may differ between html and pdf, for most consistent results use the grid table format described [here](https://quarto.org/docs/authoring/tables.html).
**Key Resources Table**
```{r tt, echo=FALSE, eval=TRUE}
#| fig-pos: "h"
library(readxl)
library(tinytable)
#read data
resources_table <- readxl::read_xls("../analysis/data/Key_resource_table.xls")
tt(resources_table, theme = "grid", width = 1, placement = "H")
```
| Col1 | Col2 | Col3 | Col4 | Col5 |
|------|------|------|------|------|
| a | b | c | d | e |
| d | | | | |
: Grid Table example {tbl-colwidths="\[10,20,20,20,30\]"}
## Complex grid table example
This table was generated by tt() as the output of an r chunk in a Quarto doc. For larger multi-page tables, this method gives correct page breaks in the pdf and html outputs. You can change the relative column widths with {tbl-colwidths="\[10,20,20,20,30\]"} placed after the table caption declaration at the end.
| Reagent type (species) or resource | Designation | Source or reference | Identifiers | Additional information |
|---------------|---------------|---------------|---------------|---------------|
| biological sample (N. vectensis) | larval, juvenile and adult N. vectensis | Specimens obtained form the Marine Invertebrate Culture Unit of the University of Exeter | N/A | NA |
| biological sample (cDNA) | cDNA obtained from N. vectensis | this study | N/A | RNA extracted with Trizol and cDNA synthesized with cDNA synthesis kit according to manufacturers recommendation |
| biological sample (peptide extract) | peptide extracts obtained from N. vectensis | this study | N/A | Peptides extracted from N. vectensis according to protocol explained in Material and Methods |
| genetic reagent (cDNA synthesis) | SuperScript™ III First-Strand Synthesis System | Invitrogen (from ThermoFisher) | 18080051 | NA |
| genetic reagent (Polymerase) | Q5® Hot Start High-Fidelity DNA Polymerase | New England Biolabs | M0493L | NA |
| genetic reagent (DNA assembly) | NEBuilder® HiFi DNA Assembly Master Mix | New England Biolabs | E2621L | NA |
| genetic reagent (restriction enzyme) | EcoRV restriction enzyme | New England Biolabs | R3195L | NA |
| genetic reagent (restriction enzyme) | Afl2 restriction enzyme | New England Biolabs | R0520L | NA |
: More complex Grid Table example {tbl-colwidths="\[10,20,20,20,30\]"}
## References
```{=html}
<!--
## See https://github.com/hypothesis/client
## Add commenting functionality with this script
-->
```
```{=html}
<script src="hypothes.is/embed.js" async></script>
```