Skip to contents

Config YAML file parsing.

Public fields

tool

(character(1))
Tool name.

config

(list())
Config list.

raw_schemas_all

(tibble())
All raw schemas for tool.

tidy_schemas_all

(tibble())
All tidy schemas for tool.

Methods


Method new()

Create a new Config object.

Usage

Config$new(tool, pkg)

Arguments

tool

(character(1))
Tool name.

pkg

(character(1))
Package name for config lookup.


Method print()

Print details about the Tool.

Usage

Config$print(...)

Arguments

...

(ignored).


Method read()

Read YAML configs.

Usage

Config$read(pkg)

Arguments

pkg

(character(1))
Package name where the config files are located.

Returns

A list() with the parsed data.


Method get_raw_patterns()

Return all output file patterns.

Usage

Config$get_raw_patterns()


Method get_raw_versions()

Return all output file schema versions.

Usage

Config$get_raw_versions()


Method get_raw_descriptions()

Return all output file descriptions.

Usage

Config$get_raw_descriptions()


Method get_raw_schemas_all()

Return all output file schemas.

Usage

Config$get_raw_schemas_all()


Method get_raw_schema()

Get raw file schema.

Usage

Config$get_raw_schema(x, v = "latest")

Arguments

x

(character(1))
Raw file name.

v

(character(1))
Version (def: latest).


Method are_raw_schemas_valid()

Validate schema.

Usage

Config$are_raw_schemas_valid()


Method get_tidy_descriptions()

Return all tidy tibble descriptions.

Usage

Config$get_tidy_descriptions()


Method get_tidy_schemas_all()

Return all tidy tibble schemas.

Usage

Config$get_tidy_schemas_all()


Method get_tidy_schema()

Get tidy tbl schema.

Usage

Config$get_tidy_schema(x, v = "latest", subtbl = "tbl1")

Arguments

x

(character(1))
Tidy tbl name.

v

(character(1))
Version of schema (def: latest).

subtbl

(character(1))
Subtbl to use (def: tbl1).


Method clone()

The objects of this class are cloneable with this method.

Usage

Config$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

tool <- "tool1"
pkg <- "nemo"
conf <- Config$new(tool, pkg)
conf$get_raw_patterns()
#> # A tibble: 3 × 2
#>   name   value                     
#>   <chr>  <chr>                     
#> 1 table1 "\\.tool1\\.table1\\.tsv$"
#> 2 table2 "\\.tool1\\.table2\\.tsv$"
#> 3 table3 "\\.tool1\\.table3\\.tsv$"
(rv1 <- conf$get_raw_versions())
#> # A tibble: 4 × 2
#>   name   value 
#>   <chr>  <chr> 
#> 1 table1 v1.2.3
#> 2 table1 latest
#> 3 table2 latest
#> 4 table3 latest
conf$get_raw_descriptions()
#> # A tibble: 3 × 2
#>   name   value            
#>   <chr>  <chr>            
#> 1 table1 Table1 for tool1.
#> 2 table2 Table2 for tool1.
#> 3 table3 Table3 for tool1.
conf$get_raw_schemas_all()
#> # A tibble: 4 × 3
#>   name   version schema          
#>   <chr>  <chr>   <list>          
#> 1 table1 v1.2.3  <tibble [5 × 2]>
#> 2 table1 latest  <tibble [7 × 2]>
#> 3 table2 latest  <tibble [3 × 2]>
#> 4 table3 latest  <tibble [2 × 2]>
conf$get_raw_schema("table1")
#> # A tibble: 7 × 2
#>   field      type 
#>   <chr>      <chr>
#> 1 SampleID   c    
#> 2 Chromosome c    
#> 3 Start      i    
#> 4 End        i    
#> 5 metricX    d    
#> 6 metricY    d    
#> 7 metricZ    d    
conf$get_raw_schema("table1", v = "v1.2.3")
#> # A tibble: 5 × 2
#>   field      type 
#>   <chr>      <chr>
#> 1 SampleID   c    
#> 2 Chromosome c    
#> 3 Start      i    
#> 4 End        i    
#> 5 metricX    d    
conf$are_raw_schemas_valid()
#> [1] TRUE
conf$get_tidy_descriptions()
#> # A tibble: 3 × 2
#>   name   value            
#>   <chr>  <chr>            
#> 1 table1 Table1 for tool1.
#> 2 table2 Table2 for tool1.
#> 3 table3 Table3 for tool1.
(ts1 <- conf$get_tidy_schemas_all())
#> # A tibble: 4 × 4
#>   name   version tbl   schema          
#>   <chr>  <chr>   <chr> <list>          
#> 1 table1 v1.2.3  tbl1  <tibble [5 × 3]>
#> 2 table1 latest  tbl1  <tibble [7 × 3]>
#> 3 table2 latest  tbl1  <tibble [3 × 3]>
#> 4 table3 latest  tbl1  <tibble [5 × 3]>
conf$get_tidy_schema("table1")
#> # A tibble: 7 × 3
#>   field      type  description   
#>   <chr>      <chr> <chr>         
#> 1 sample_id  c     sample ID     
#> 2 chromosome c     chromosome    
#> 3 start      i     start position
#> 4 end        i     end position  
#> 5 metric_x   d     metric X      
#> 6 metric_y   d     metric Y      
#> 7 metric_z   d     metric Z      
conf$get_tidy_schema("table1", v = "v1.2.3")
#> # A tibble: 5 × 3
#>   field      type  description   
#>   <chr>      <chr> <chr>         
#> 1 sample_id  c     sample ID     
#> 2 chromosome c     chromosome    
#> 3 start      i     start position
#> 4 end        i     end position  
#> 5 metric_x   d     metric X