3.1 Literate programming
Literate programming is a computing approach where the programming code is provided as subsections in a document that is mostly written in a natural language. This creates an environment where the documentation is the main component of the program, rather than an afterthought.
The text is typically written in some sort of ’mark-up’ format, with sections highlighted as title, emphasised or italicised and so on. The code itself can be run on demand in combination with this marked-up text, to produce a report or other document combining the pre-defined text in the literate program with the output of the code.
In terms of using R literate programming techniques for bioinformatics, what this allows us to do is to generate a reusable report template that can be repeatedly run as each lot of data becomes available. The output may be a pdf file suitable for printing or e-mailing, html code for direct display through a web browser, or a number of other formats.
For this workshop, we will use the knitR format, which is built directly into the RStudio platform and generates an html report at the click of a button.