-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
HeidiSeibold
committed
Aug 24, 2023
1 parent
cd440de
commit 6ad9694
Showing
13 changed files
with
196 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
## Version control | ||
|
||
Version control is a big topic for me. It completely changed the way I work. I am happy that we get to talk about version control as part of this 6 step process towards reproducibility. | ||
|
||
### What is version control? | ||
|
||
Let's say you are writing a paper. You will edit your paper and might want to keep different versions of it. A common way to handle that is by using different file names for different versions. | ||
|
||
|
||
|
||
::: captioned-image-container | ||
![http://www.phdcomics.com/comics/archive/phd101212s.gif](http://www.phdcomics.com/comics/archive/phd101212s.gif){fig-alt="http://www.phdcomics.com/comics/archive/phd101212s.gif"} | ||
::: | ||
|
||
This way of "version control" is outdated and error-prone (hence the pixelated image 😜). The most common proper version control system today is [Git](https://git-scm.com/), which I'd like to introduce to you now. | ||
|
||
### Git for version control | ||
|
||
Git is free and open source 😃🙌. | ||
|
||
With Git you can track different versions of your paper. For each version you can add a description ("commit message") and you even automatically track who made which change if you are working in a group. You can always go back to old versions. | ||
|
||
The way you work with Git is that you have the version database both on our computers and on a server. To get the changes from and to the server you use commands (`pull` = download stuff from server, `push` = upload stuff to server). | ||
|
||
::: captioned-image-container | ||
![](images/vc-server.jpg){fig-alt="Reproducibility scale: a scale showing **not reproducible** on one end and **reproducible** on the other end."} | ||
::: | ||
|
||
Most researchers use GitLab or GitHub as platforms for working with Git and they also serve as a neat front end for the server. GitLab and GitHub give us some extra neat features for collaboration (e.g. issues, Wiki, ...). | ||
|
||
Learning Git can be daunting 🙀. I recommend learning it with a group or in a class. I am always happy to teach version control. You can also check if there is a free [Software Carpentry](https://software-carpentry.org/) class in your area. | ||
|
||
### Other version control systems | ||
|
||
There are many other ways of doing version control out there. | ||
|
||
**Subversion:** Simpler systems like Subversion are used less these days as Git offers more flexibility. | ||
|
||
**Google docs and friends:** Many online text editors (Google Docs, OneDrive, ...) offer versioning now. It is not as advanced and versatile, but a nice way to work in a [WYSIWYG](https://en.wikipedia.org/wiki/WYSIWYG) (What You See Is What You Get) editor. Git really only works with real text files, so people usually use LaTeX or Markdown (not WYSIWYG) to write texts when using Git. | ||
|
||
**Versioning data:** Version control of data is a difficult task. Let's leave that for another day. See [here](https://the-turing-way.netlify.app/reproducible-research/vcs/vcs-data.html) for more info for now. | ||
|
||
|
||
## Further reading | ||
- [Version Control](https://the-turing-way.netlify.app/reproducible-research/vcs.html), The Turing Way | ||
- [Version Control with Git](https://swcarpentry.github.io/git-novice/), Software Carpentry | ||
- [Version Control with Git](https://annakrystalli.me/rrresearchACCE20/version-control-with-git.html) (for R users), Anna Krystalli | ||
- [Set up Git with RStudio & GitLab](https://gitlab.com/HeidiSeibold/setup-git-rstudio-gitlab), Heidi Seibold | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
## Stabilize your computing environment and software | ||
|
||
This topic may sound technical and boring at first, but please bare | ||
with me 🙏. **It will be useful!** | ||
|
||
|
||
Have you ever had the problem that you ran an old code and it just did | ||
not work anymore? After hours of digging into the issue you find that it's because the | ||
software package you use has changed in the meantime 🧐 | ||
|
||
Or have you tried to reproduce someone else's code, which seems to run on | ||
their machine but not on yours and you just don't know why. | ||
|
||
This chapter is all about avoiding such problems in the future | ||
by **stabilizing your computing environment and software**. ✅ | ||
|
||
|
||
### What is a computing environment? | ||
|
||
Your computing environment is defined by your computer, the operating | ||
system and the software installed. If you update your operating system | ||
or your software, your computing environment changes. In R, for example, | ||
you can learn a lot about your computing environment by typing | ||
`sessionInfo()`. | ||
|
||
```{r} | ||
sessionInfo() | ||
``` | ||
|
||
It tells the R version, operating system, loaded R packages as well as | ||
their versions. | ||
|
||
### Options for stabilizing your computing environment | ||
|
||
#### 1) Record your computing environment {.unnumbered} | ||
|
||
Document the software versions you used. For example if you use R, you | ||
could copy the output of `sessionInfo()` into your README or somewhere | ||
else where future you (and others) can find this information. This is | ||
not exactly "stabilizing" but it gives the possibility to install the | ||
same software versions again. | ||
|
||
#### 2) Use one virtual machine per research project {.unnumbered} | ||
|
||
You don't need to know what a virtual machine is or how to set it up to | ||
be able to do this. I used to ask the wonderful IT person at my | ||
institute to set up a virtual machine for me and if your IT supporters | ||
know their job, they'll be able to help you here. | ||
|
||
A virtual machine is essentially a virtual computer on another computer | ||
or server (To those nerds out there, I know I am probably explaining it | ||
incorrectly but for the purpose of what we want to achieve here, it's | ||
good enough). If you have one virtual machine for each project, you can | ||
keep the computing environment stable by not installing or updating | ||
software after you've finished the research project. | ||
|
||
The downside of this strategy is that this is only for future you and | ||
your collaborators, but not for other researchers who want to work with | ||
the same computing environment. | ||
|
||
#### 3) Use one container per research project {.unnumbered} | ||
|
||
Containers are similar to virtual machines (think little computer inside | ||
your computer). The big difference is that you can make them available | ||
for others. So you can send your container image (or the file describing | ||
it) to others. | ||
|
||
::: captioned-image-container | ||
![](images/docker-computers.jpg) | ||
::: | ||
|
||
Popular container tools are **Docker and Apptainer** (formerly | ||
Singularity). Learning to work with containers is not super easy, but it | ||
is worth the time and actually can be applied in so many other | ||
situations. So, a great skill to have even if you decide to quit | ||
research. | ||
|
||
#### 4) Other {.unnumbered} | ||
|
||
There are many other options out there. I wrote down the three that are | ||
least dependent on the actual software you use. For R users, check out | ||
packages `logrx`, `rang`, `packrat`, `versions`, and `renv`. | ||
|
||
|
||
### Further reading | ||
|
||
- [Reproducible | ||
Environments](https://the-turing-way.netlify.app/reproducible-research/renv.html), | ||
The Turing Way | ||
- Video: [How can software containers help your | ||
research?](https://youtu.be/HelrQnm3v4g), Paula Andrea Martinez + | ||
Australian Research Data Commons | ||
- [R Docker tutorial](https://jsta.github.io/r-docker-tutorial/), | ||
maintained by Jemma Stachelek | ||
|
||
That's all for this chapter. I hope it was helpful and not too technical. Happy | ||
researching! 🙌 | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## Automate your code | ||
|
||
TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
## Licensing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
## Where to publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
## FAIR revisited |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.