index.qmd 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. ---
  2. title: "Replay Illustrations"
  3. author:
  4. - name: Dr. Lennart Wittkuhn
  5. url: https://lennartwittkuhn.com/
  6. affiliation: Max Planck Institute for Human Development
  7. affiliation-url: https://www.mpib-berlin.mpg.de/en
  8. orcid: 0000-0003-2966-6888
  9. format:
  10. html:
  11. toc: true
  12. toc-depth: 4
  13. ---
  14. [![License: CC BY 4.0](https://img.shields.io/badge/License-CC_BY_4.0-lightgrey.svg)](https://creativecommons.org/licenses/by/4.0/)
  15. [![made-with-datalad](https://www.datalad.org/badges/made_with.svg)](https://datalad.org)
  16. ## About
  17. Welcome!
  18. This website contains illustrations that I regularly use in talks about [my work](https://scholar.google.de/citations?user=GXvJB1kAAAAJ&hl=de&oi=ao) on investigating fast sequential memory reactivation (replay) in humans using fMRI.
  19. The source code for this webiste can be found in the corresponding [GitHub repository](https://github.com/lnnrtwttkhn/replay-illustrations).
  20. If you are interested in how this website was created, check out the [Background](#background) section below.
  21. All illustrations are licensed under [Creative Commons Attribution 4.0 International (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/).
  22. Details can be found in the [LICENSE](https://github.com/lnnrtwttkhn/replay-illustrations/blob/master/LICENSE) file.
  23. If you have questions, comments or any suggestions for improvement, please contact me via [email](mailto:wittkuhn@mpib-berlin.mpg.de) or [create a new issue](https://github.com/lnnrtwttkhn/replay-illustrations/issues) on the issue board.
  24. Thank you!
  25. ```{r, echo=FALSE, message=FALSE, include=FALSE}
  26. path_output = here::here("illustrations")
  27. return_code = Sys.getenv("CI")
  28. if (return_code == "true") {
  29. system2("echo", args = c("Running in CI environment"))
  30. branch = Sys.getenv("CI_COMMIT_BRANCH")
  31. repo_url = Sys.getenv("CI_REPOSITORY_URL")
  32. branch = "master"
  33. repo_url = "https://github.com/lnnrtwttkhn/replay-illustrations"
  34. path_template = file.path(repo_url, "-", "jobs", "artifacts", branch, "raw", "output")
  35. } else {
  36. path_template = path_output
  37. }
  38. ```
  39. ## Illustrations
  40. ```{r, echo=FALSE, results='asis'}
  41. newline = "\n\n\n"
  42. extentions = c(".pdf", ".png", ".afdesign")
  43. paths_folders = base::list.dirs(path = path_output, full.names = TRUE, recursive = FALSE)
  44. text_prints = c()
  45. for (path in paths_folders) {
  46. folder_name = base::basename(path)
  47. text_folder = sprintf("### %s%s", folder_name, newline)
  48. cat(text_folder)
  49. files = base::list.files(path = path)
  50. files = files[unlist(lapply(X = files, FUN = function(x) grepl(paste(extentions, collapse = "|"), x)))]
  51. files_unique = unique(unlist(lapply(X = files, FUN = function(x) tools::file_path_sans_ext(x))))
  52. for (file in files_unique) {
  53. text_file = sprintf("#### %s%s", file, newline)
  54. cat(text_file)
  55. text_download = "Download figure as:"
  56. for (ext in extentions) {
  57. path_file = file.path(path_output, folder_name, paste0(file, ext))
  58. path_link = file.path(path_template, folder_name, paste0(file, ext))
  59. if (!file.exists(path_file)) {
  60. next
  61. }
  62. if (Sys.getenv("CI") == "true") {
  63. path_link = paste0(path_link, "?job=renv")
  64. }
  65. if (ext %in% c(".png", ".gif")) {
  66. text_image = sprintf("![](%s)%s", path_file, newline)
  67. cat(text_image)
  68. }
  69. text_download = sprintf(paste(text_download, "[[%s]](%s)"), ext, path_link)
  70. }
  71. text_download = paste0(text_download, newline)
  72. cat(text_download)
  73. }
  74. }
  75. ```
  76. ## Background
  77. The illustrations in this repository were created using [Affinity Designer](https://affinity.serif.com/en-us/) and include images from [BioRender.com](https://biorender.com/).
  78. After creating the illustrations I saved them
  79. The [repository](https://github.com/lnnrtwttkhn/replay-illustrations) is a [DataLad](https://www.datalad.org/) dataset.
  80. If you want to learn more about DataLad, I recommend to take a look at the [DataLad Handbook](http://handbook.datalad.org/en/latest/).
  81. ### Configuring GIN as a data source behind the scenes
  82. Since GitHub can not hold the annexed data itself, I configured a [GIN repository](https://gin.g-node.org/lnnrtwttkhn/replay-illustrations) that holds the annexed data.
  83. Since I did not want to point intersted users to a hosting service that they might not be familiar with,
  84. GIN can perform data hosting in the background by using it as an "autoenabled data source" that a dataset sibling (even if it is published to GitHub or GitLab) can retrieve data from.
  85. To this end, I followed the instructions in the DataLad handbook on [how to use GIN as a data source behind the scenes](https://handbook.datalad.org/en/latest/basics/101-139-gin.html#ginbts).
  86. ### Creating the website using Quarto
  87. Next, I wanted to create a website to provide an overview of all illustrations and make them available for download.
  88. To this end, I chose [Quarto](https://quarto.org/) which is "an open-source scientific and technical publishing system built on Pandoc".
  89. I followed the instructions in the Quarto documentation to [build a basic HTML document](https://quarto.org/docs/output-formats/html-basics.html).
  90. ### Deploying the website using GitHub Actions and GitHub Pages
  91. In the next step, I needed a way to deploy the website to make it available online.
  92. Importantly, I wanted a solution that would automatically update the website whenever a change was made.
  93. Again, I largely followed the instructions in the Quarto documentation on [how to deploy a Quarto website to GitHub pages](https://quarto.org/docs/publishing/github-pages.html).
  94. ### Retrieving annexed data in GitHub Actions using a DataLad Docker container
  95. I then pushed the Docker image of the DataLad container to [dockerhub](https://hub.docker.com/repository/docker/lennartwittkuhn/datalad) to make it publicly available.