---
title: "General comments about the infrastructure"
author: "Adriano Rutz"
creative_commons: CC BY-SA
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
opengraph:
    image:
      src: https://github.com/taxonomicallyinformedannotation/tima/blob/main/man/figures/logo.svg
      alt: "Taxonomically Informed Metabolite Annotation"
    twitter:
      creator: "@adafede"
vignette: >
  %\VignetteIndexEntry{General comments about the infrastructure}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r setup, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
knitr::opts_knit$set(root.dir = system.file(package = "tima"))
```

```{r tima, results="hide", message=FALSE, warning=FALSE, include = FALSE}
library("tima")
```

This vignette describes the philosophy behind the infrastructure of **TIMA**.

## Philosophy

Our main goals were **flexibility** and **reproducibility**.

### Flexibility

To ensure flexibility, we tried to split the process in as much tiny parts as needed.
So you can decide whether to skip an optional part, add your own processing, etc.
We tried to cover most use cases, but of course they are not exhaustive.
If you feel like something useful to other users is missing, please fill an [issue](https://github.com/taxonomicallyinformedannotation/tima/issues).

### Reproducibility

After some time using TIMA, you will probably wonder:
"*What was the parameters I used to generate this file?*" ...
Or a collaborator might ask you to share your data and parameters.
Writing them down each time might be time consuming and not really in line with modern computational approaches.
Therefore, we chose to implement all parameters of all steps (almost...) as YAML files.
They are human-readable and can be used in batches.
If you do not like YAML, parameters of each steps can also be given as command line arguments.
They will then be saved as YAML you will be able to share.

To ensure optimal reproducibility and avoiding re-computing endlessly steps that did not change, we decided to build a [{targets}](https://books.ropensci.org/targets/) pipeline.
Each step of the whole pipeline will be described next.


```{r chunk-1, echo=FALSE, message=FALSE, warning=FALSE, out.width="100%"}
library(targets)
Sys.setenv(TAR_WARN = "false")
targets::tar_visnetwork(
  names = starts_with("ann"),
  exclude = c(
    tidyselect::contains("benchmark"),
    tidyselect::contains("par_"),
    tidyselect::contains("gnps"),
    tidyselect::contains("input"),
    tidyselect::contains("paths"),
    tidyselect::contains("_is"),
    tidyselect::contains("_exp"),
    tidyselect::contains("library_sop_lotus"),
    tidyselect::contains("library_sop_closed")
  ),
  targets_only = TRUE,
  degree_from = 8
)
```

## Use

Each step is detailed in the related [vignettes](https://taxonomicallyinformedannotation.github.io/tima/articles).

All coming steps admit you already installed `tima`:

```{r eval=FALSE, include=TRUE}
install.packages(
  "tima",
  repos = c(
    "https://taxonomicallyinformedannotation.r-universe.dev",
    "https://bioc.r-universe.dev",
    "https://cloud.r-project.org"
  )
)
tima::install()
tima::get_example_files()
```

We now recommend you to read the [first vignette](https://taxonomicallyinformedannotation.github.io/tima/articles/I-gathering.html).

### tl;dr

If you do not feel like going through all the steps, then just do 🚀:

```{r eval=FALSE, include=TRUE}
tima::run_app()
```

If you do not even need a GUI ☠️:

```{r eval=FALSE, include=TRUE}
tima::tima_full()
```
