Skip to contents

Parses and tidies output files from Tool1. Table schemas and file patterns are defined in inst/config/tools/tool1/schema.yaml. Custom parse and tidy methods are provided for tables that require non-standard handling.

Super class

nemo::Tool -> Tool1

Methods

Inherited methods


Method new()

Create a new Tool1 object.

Usage

Tool1$new(path = NULL, files_tbl = NULL)

Arguments

path

(character(1))
Output directory of tool. If files_tbl is supplied, this is ignored.

files_tbl

(tibble(n))
Tibble of files from list_files_dir().

Returns

(R6::R6Class())
R6 object.


Method tidy_table3()

Tidy table3.tsv file with type conversion enabled.

Usage

Tool1$tidy_table3(x)

Arguments

x

(character(1) or tibble())
Path to file or already parsed tibble.

Returns

(tibble())
Tidy data in enframed tibble.


Method tidy_table7()

Tidy table7.tsv file.

Usage

Tool1$tidy_table7(x)

Arguments

x

(character(1) or tibble())
Path to file or already parsed tibble.

Returns

(tibble())
Tidy data in enframed tibble.

Examples

indir <- system.file("extdata/tool1", package = "nemo")
dir1 <- tempdir()
obj1 <- Tool1$new(indir)

p3 <- system.file("extdata/tool1/latest/sampleA.tool1.table3.tsv", package = "nemo")
(tidy3 <- obj1$tidy_table3(p3))
#> # A tibble: 1 × 2
#>   name   data            
#>   <chr>  <list>          
#> 1 table3 <tibble [1 × 5]>

obj1$run(output_dir = dir1, format = "parquet", input_id = "run1")
(lf <- list.files(dir1, pattern = "tool1.*parquet", full.names = FALSE))
#>  [1] "metadata_tool1.parquet"         "sampleA_2_tool1_table1.parquet"
#>  [3] "sampleA_2_tool1_table2.parquet" "sampleA_2_tool1_table3.parquet"
#>  [5] "sampleA_2_tool1_table4.parquet" "sampleA_2_tool1_table6.parquet"
#>  [7] "sampleA_3_tool1_table1.parquet" "sampleA_tool1_table1.parquet"  
#>  [9] "sampleA_tool1_table2.parquet"   "sampleA_tool1_table3.parquet"  
#> [11] "sampleA_tool1_table4.parquet"   "sampleA_tool1_table6.parquet"  

obj2 <- Tool1$new(indir)$tidy()

# table7 fans out into the table7main + table7dp outputs
indir7 <- system.file("extdata/tool1_outputs", package = "nemo")
dir7 <- tempfile()
obj7 <- Tool1$new(indir7)$tidy()
(t7 <- obj7$get_tbls())
#> # A tibble: 2 × 10
#>   tool_parser  parser bname        size lastmodified        path  pattern prefix
#>   <chr>        <chr>  <chr>       <fs:> <dttm>              <chr> <chr>   <chr> 
#> 1 tool1_table7 table7 sampleA.to…    99 2026-11-09 07:10:24 /hom… "\\.to… sampl…
#> 2 tool1_table7 table7 sampleA.to…    82 2026-11-09 07:10:24 /hom… "\\.to… sampl…
#> # ℹ 2 more variables: prefix_suffix <chr>, tidy <list>
obj7$write(output_dir = dir7, format = "parquet", input_id = "run1")
(lf7 <- sort(basename(obj7$written_files$outpath)))
#> [1] "sampleA_2_tool1_table7dp.parquet"   "sampleA_2_tool1_table7main.parquet"
#> [3] "sampleA_tool1_table7dp.parquet"     "sampleA_tool1_table7main.parquet"