Today we’ll talking about the labnotebook project, born from the need to compile a laboratory notebook automatically, quickly and systematically.
For the uninitiated, in research laboratories it is mandatory to keep track of everything that is done through notebooks called “laboratory notebooks”; the nature of the work of a bioinformatician, however, is very different from that of those at the bench, therefore also the possibility of keeping track of what has been done is.
Many will know git or other version control systems, that are systems that allow you to have a trace of all the changes made to a file, having a history. To access this history, one must have mastery of these systems, which makes it difficult (if not impossible) to read these informations for those who do not use them.
For this reason, I decided to create a package of functions that allow you to transform this history into an html file, which can be customized, easy to export and share. You can find these functions in this repo on github.
To take advantage of these features, you need to have git installed, that the project you are working on is under the control of git, and that the commits are compiled thoroughly.
Notebook structure
The notebook is structured as follows:
As a header there is the name of the notebook, followed by the creation date and the author (taken from the git config file),
Subsequently, for each date we have the list of commits (therefore of the actions carried out) with specified what has been done, the sha of the commit, eventually the file containing the list of executed commands/analyses made, and the list of modified files, indicating whether they have been added (A), modified (M), deleted (D) or renamed (R).
You can find an example here.
Create a notebook
To create a notebook, just be in the project folder where the .git/ folder is located and launch the createnotebook <name_notebook> command.
You will be asked if the .labnotebook folder that will be created should be ignored by git (so if it must be inserted inside the .gitignore file); from that moment the .labnotebook folder will be present where the .git one is located.
Inside the folder we find various files:
Config file
The config file contains some starting settings that can be changed if necessary, being careful not to compromise the functionality of the notebook update and notebook export functions.
Let's see the info contained:
Update the notebook
When you want to update your notebook (and I recommend doing it often, and now you will understand why), just go to the project folder where the .labnotebook/ folder is located and type the command updatenotebook.
At this point you will be asked for confirmation to update the notebook and the notebook update will start: if the SHOW_ANALYSIS_FILES option is equal to “no”, nothing will happen and the notebook will be updated, otherwise for each commit you will be asked which of the modified files is the analysis file (among the various options there is also none, to be selected if no analyzes have been carried out or you do not want to insert any file).
The file being updated is .labnotebook/body.html.
Export the notebook in html format
When you decide you want to export the notebook, just be in the folder containing .labnotebook/ and type exportnotebook <filename.html>.
You will be asked if the css file indicated in the config file should be copied in the head of the html file (if you want to share only the html file) or if it should be linked to in the head (if you want to share both the html file and the css file).
At this point, the notebook is ready to be viewed with a browser, read, browsed and analyzed.