Skip to contents

Adding a New Tool

Adding a new tool to a nemo child package consists of the following steps:

  1. Data

Add sample files generated by the tool under inst/extdata/<tool>. Usually the top 10 rows (plus header) of a representative TSV file are fine. DVC is recommended for tracking the files in version control. See vignette("devnotes") for some DVC notes.

  1. Schema

Use config_prep_multi() + config_prep_write() to generate a skeleton schema.yaml from the sample files:

use("nemo")
use("here", "here")
use("glue", "glue")
use("tibble", "tribble")

tool <- "mytool"
d1 <- here(glue("inst/extdata/{tool}/latest"))

x <- tribble(
  ~name    , ~descr                , ~pat                        , ~type , ~path                                      ,
  "table1" , "table1 description." , "\\.mytool\\.table1\\.tsv$" , "tsv" , file.path(d1, "sampleA.mytool.table1.tsv") ,
  "table2" , "table2 description." , "\\.mytool\\.table2\\.csv$" , "csv" , file.path(d1, "sampleA.mytool.table2.csv") ,
)

out <- here(glue("inst/config/tools/{tool}/schema.yaml"))
config_prep_write(config_prep_multi(x), out)

The functions auto-detect raw column names and types; you then fill in the following fields in the generated YAML manually:

  • tidy: column name for the tidy output (snake_case)
  • description: field description (official tool documentation is a good source)
  • versions: explicit array of every tool version the column appears in (e.g. ['v1.2.3', 'latest']); use ['latest'] for columns present only in the current version.

Save the result as inst/config/tools/<tool>/schema.yaml. See Structure for details on the schema format and how Config reads it.

  1. Parsers

Create the R6 class under R/<Tool>.R. Use Tool1 (R/Tool1.R) as a template - it demonstrates the full pattern for initialize(), per-table parse_*() / tidy_*() methods, and roxygen documentation with @testexamples blocks.