Skip to content

Commit

Permalink
fix targets
Browse files Browse the repository at this point in the history
  • Loading branch information
Adafede committed Aug 2, 2024
1 parent de84ea8 commit 9d58ab3
Show file tree
Hide file tree
Showing 34 changed files with 62 additions and 57 deletions.
8 changes: 8 additions & 0 deletions R/tima-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,11 @@
## usethis namespace: end
NULL
.datatable.aware <- TRUE
.onLoad <- function(libname, pkgname) {
Sys.setenv(TAR_CONFIG = system.file("pipelines/_targets.yaml", package = "tima"))
invisible()
}

.onAttach <- function(libname, pkgname) {
packageStartupMessage("Welcome to Taxonomically Informed Metabolite Annotation")
}
1 change: 0 additions & 1 deletion inst/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -2364,7 +2364,6 @@ server <- function(input, output, session) {
)
targets::tar_make(
names = targets::matches("^ann_pre$"),
script = system.file("pipelines/_targets.R", package = "tima"),
garbage_collection = TRUE,
reporter = "verbose_positives"
)
Expand Down
3 changes: 3 additions & 0 deletions inst/pipelines/_targets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
main:
script: inst/pipelines/_targets.R
2 changes: 1 addition & 1 deletion inst/scripts/annotate_masses.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ log_debug(
log_debug("Authors: ", crayon::green("AR"), "\n")
log_debug("Contributors: ", crayon::blue("CH"), crayon::cyan("MS"), "\n")

targets::tar_make(names = matches("^ann_ms1_pre"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("^ann_ms1_pre"))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/annotate_spectra.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ log_debug(
log_debug("Authors: ", crayon::green("AR"), "\n")
log_debug("Contributors: ...")

targets::tar_make(names = matches("^ann_spe_pre"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("^ann_spe_pre"))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/create_components.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ log_debug(
log_debug("Authors: ", crayon::green("AR"), "\n")
log_debug("Contributors: ...")

targets::tar_make(names = matches("fea_com"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("fea_com"))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/create_edges_spectra.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ log_debug(
log_debug("Authors: ", crayon::green("AR"), "\n")
log_debug("Contributors: ", crayon::blue("CH"), crayon::cyan("MS"), "\n")

targets::tar_make(names = matches("fea_edg_spe"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("fea_edg_spe"))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/filter_annotations.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ log_debug(
log_debug("Authors: ", crayon::green("AR"), "\n")
log_debug("Contributors: ...")

targets::tar_make(names = matches("^ann_fil"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("^ann_fil"))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/get_gnps_tables.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ log_debug(
log_debug("Authors: ", crayon::green("AR"), "\n")
log_debug("Contributors: ...")

targets::tar_make(names = matches("gnps_tables"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("gnps_tables"))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/get_isdb_lotus.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ log_debug(
log_debug("Authors: ", crayon::green("AR"), "\n")
log_debug("Contributors: ...")

targets::tar_make(names = matches("lib_spe_is_lot"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("lib_spe_is_lot"))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/get_lotus.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ log_debug(
log_debug("Authors: ", crayon::green("AR"), "\n")
log_debug("Contributors: ...")

targets::tar_make(names = matches("lib_sop_lot$"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("lib_sop_lot$"))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/get_massbank_spectra.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ log_debug(
log_debug("Authors: ", crayon::green("AR"), "\n")
log_debug("Contributors: ...")

targets::tar_make(names = matches("lib_spe_exp_mb_raw"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("lib_spe_exp_mb_raw"))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/prepare_annotations_gnps.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ log_debug(
log_debug("Authors: ", crayon::green("AR"), "\n")
log_debug("Contributors: ...")

targets::tar_make(names = matches("^ann_spe_exp_gnp_pre"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("^ann_spe_exp_gnp_pre"))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/prepare_annotations_sirius.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ log_debug(
log_debug("Authors: ", crayon::green("AR"), "\n")
log_debug("Contributors: ...")

targets::tar_make(names = matches("^ann_sir_pre"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("^ann_sir_pre"))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/prepare_annotations_spectra.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ log_debug("Authors: ", crayon::green("AR"), "\n")
log_debug("Contributors: ...")

## Not ann_spe because of `ann_spe_int` (see #69)
targets::tar_make(names = c(matches("^ann_spe_is"), script = system.file("pipelines/_targets.R", package = "tima")))
targets::tar_make(names = c(matches("^ann_spe_is")))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/prepare_features_components.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ log_debug(
log_debug("Authors: ", crayon::green("AR"), "\n")
log_debug("Contributors: ...")

targets::tar_make(names = matches("fea_com_pre"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("fea_com_pre"))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/prepare_features_edges.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ log_debug(
log_debug("Authors: ", crayon::green("AR"), "\n")
log_debug("Contributors: ...")

targets::tar_make(names = matches("fea_edg_pre"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("fea_edg_pre"))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/prepare_features_tables.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ log_debug(
log_debug("Authors: ", crayon::green("AR"), "\n")
log_debug("Contributors: ...")

targets::tar_make(names = matches("fea_pre"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("fea_pre"))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/prepare_libraries_rt.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ log_debug(
log_debug("Authors: ", crayon::green("AR"), "\n")
log_debug("Contributors: ...")

targets::tar_make(names = matches("lib_rt"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("lib_rt"))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/prepare_libraries_sop_closed.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ log_debug(
log_debug("Authors: ", crayon::green("AR"), "\n")
log_debug("Contributors: ...")

targets::tar_make(names = matches("lib_sop_clo_pre"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("lib_sop_clo_pre"))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/prepare_libraries_sop_ecmdb.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ log_debug(
log_debug("Authors: ", crayon::green("AR"), "\n")
log_debug("Contributors: ...")

targets::tar_make(names = matches("lib_sop_ecm_pre"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("lib_sop_ecm_pre"))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/prepare_libraries_sop_hmdb.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ log_debug(
log_debug("Authors: ", crayon::green("AR"), "\n")
log_debug("Contributors: ...")

targets::tar_make(names = matches("lib_sop_hmd_pre"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("lib_sop_hmd_pre"))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/prepare_libraries_sop_lotus.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ log_debug(
log_debug("Authors: ", crayon::green("AR"), "\n")
log_debug("Contributors: ...")

targets::tar_make(names = matches("lib_sop_lot_pre"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("lib_sop_lot_pre"))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/prepare_libraries_sop_merged.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ log_debug(
log_debug("Authors: ", crayon::green("AR"), "\n")
log_debug("Contributors: ...")

targets::tar_make(names = matches("lib_sop_mer"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("lib_sop_mer"))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/prepare_libraries_spectra.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ log_debug(
log_debug("Authors: ", crayon::green("AR"), "\n")
log_debug("Contributors: ...")

targets::tar_make(names = matches("lib_spe_exp_int_pre"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("lib_spe_exp_int_pre"))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/prepare_libraries_spectra_is_lotus.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ log_debug(
log_debug("Authors: ", crayon::green("AR"), "\n")
log_debug("Contributors: ...")

targets::tar_make(names = matches("lib_spe_is_lot_pre"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("lib_spe_is_lot_pre"))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/prepare_params.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ log_debug(
log_debug("Authors: ", crayon::green("AR"))
log_debug("Contributors: ...")

targets::tar_make(names = matches("par_"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("par_"))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/prepare_taxa.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ log_debug(
)
log_debug("Contributors: ...")

targets::tar_make(names = matches("tax_pre"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("tax_pre"))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/tima_full.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ log_debug(
log_debug("Authors: ", crayon::green("AR"), "\n")
log_debug("Contributors: ", crayon::blue("PMA"), "\n")

targets::tar_make(names = matches("^ann_pre$"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("^ann_pre$"))

end <- Sys.time()

Expand Down
2 changes: 1 addition & 1 deletion inst/scripts/weight_annotations.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ log_debug(
)
log_debug("Contributors: ...")

targets::tar_make(names = matches("ann_pre$"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("ann_pre$"))

end <- Sys.time()

Expand Down
22 changes: 10 additions & 12 deletions vignettes/articles/I-gathering.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ tima::get_file(
MassBank is downloaded and used by default.

```{r spectra-mb, results="hide", message=FALSE, warning=FALSE, include = FALSE}
targets::tar_make(names = matches("lib_spe_exp_mb_raw"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("lib_spe_exp_mb_raw"))
```

We are currently working to get all MONA and GNPS experimental spectra easily available.
Expand All @@ -129,11 +129,11 @@ For more info, see <https://doi.org/10.5281/zenodo.5607185>.
It is made available in both polarities.

```{r get-isdb-lotus, results="hide", message=FALSE, warning=FALSE, include = FALSE}
targets::tar_make(names = matches("lib_spe_is_lot"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("lib_spe_is_lot"))
```

```{r prepare-isdb-lotus-1, results="hide", message=FALSE, warning=FALSE, include = FALSE}
targets::tar_make(names = matches("lib_spe_is_lot_pre"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("lib_spe_is_lot_pre"))
```

You can also complement with the in silico spectra from HMDB (not running by default as quite long):
Expand All @@ -156,7 +156,7 @@ It could also be a library of in silico predicted retention times.
If you want to prepare you own library, have a look at `inst/params/user/prepare_libraries_rt.yaml`, and then:

```{r rts-2, results="hide", message=FALSE, warning=FALSE}
targets::tar_make(names = matches("lib_rt"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("lib_rt"))
```

#### Structure-Organism Pairs
Expand All @@ -171,11 +171,11 @@ As we developed [LOTUS](https://lotusnprod.github.io/lotus-manuscript)^[For more
we provide it here as a starting point for your structure-organism pairs library.

```{r get-lotus, results="hide", message=FALSE, warning=FALSE, include = FALSE}
targets::tar_make(names = matches("lib_sop_lot$"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("lib_sop_lot$"))
```

```{r prepare-lotus-2, results="hide", message=FALSE, warning=FALSE, include = FALSE}
targets::tar_make(names = matches("lib_sop_lot_pre"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("lib_sop_lot_pre"))
```

The process to download LOTUS looks like this:
Expand All @@ -186,7 +186,6 @@ targets::tar_visnetwork(
exclude = c(
contains("benchmark"),
),
script = system.file("pipelines/_targets.R", package = "tima"),
targets_only = TRUE,
degree_from = 8
)
Expand All @@ -201,15 +200,15 @@ If a newer version exists, it will fetch it and re-run needed steps accordingly.
By default, we also complement LOTUS pairs with the ones coming from [ECMDB](https://ecmdb.ca/).

```{r prepare-ecmdb-1, results="hide", message=FALSE, warning=FALSE, include = FALSE}
targets::tar_make(names = matches("lib_sop_ecm_pre"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("lib_sop_ecm_pre"))
```

##### HMDB

And we do the same with the ones coming from [HMDB](https://hmdb.ca/).

```{r prepare-hmdb, results="hide", message=FALSE, warning=FALSE, include = FALSE}
targets::tar_make(names = matches("lib_sop_hmd_pre"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("lib_sop_hmd_pre"))
```

For these first steps, you do not need to change any parameters as they are implemented *by default*.
Expand All @@ -224,15 +223,15 @@ If you need help formatting your library or would like to share it with us for i
Before running the corresponding code, do not forget to modify `inst/params/user/prepare_libraries_sop_closed.yaml`

```{r prepare-closed, results="hide", message=FALSE, warning=FALSE}
targets::tar_make(names = matches("lib_sop_clo_pre"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("lib_sop_clo_pre"))
```

##### Merging

Once all sub-libraries are ready, they are then merged in a single file that will be used for the next steps.

```{r libraries-sop-1, results="hide", message=FALSE, warning=FALSE, include = FALSE}
targets::tar_make(names = matches("lib_sop_mer"), script = system.file("pipelines/_targets.R", package = "tima"))
targets::tar_make(names = matches("lib_sop_mer"))
```

```{r libraries-sop-2, echo=FALSE, message=FALSE, warning=FALSE, out.width="100%"}
Expand All @@ -243,7 +242,6 @@ targets::tar_visnetwork(
contains("par_"),
contains("paths")
),
script = system.file("pipelines/_targets.R", package = "tima"),
targets_only = TRUE,
degree_from = 8
)
Expand Down
Loading

0 comments on commit 9d58ab3

Please sign in to comment.