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 = NULL, v = NULL)

Arguments

x

(character(1))
Raw file name.

v

(character(1))
Version of schema. If NULL, returns all versions for particular file.


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 = NULL, v = NULL, subtbl = NULL)

Arguments

x

(character(1))
Tidy tbl name.

v

(character(1))
Version of schema. If NULL, returns all versions for particular tbl.

subtbl

(character(1))
Subtbl to use. If NULL, returns all subtbls for particular tbl and version.


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 × 4
#>   name   tbl_description   version schema          
#>   <chr>  <chr>             <chr>   <list>          
#> 1 table1 Table1 for tool1. v1.2.3  <tibble [5 × 2]>
#> 2 table1 Table1 for tool1. latest  <tibble [7 × 2]>
#> 3 table2 Table2 for tool1. latest  <tibble [3 × 2]>
#> 4 table3 Table3 for tool1. latest  <tibble [5 × 2]>
conf$get_raw_schema("table1")
#> # A tibble: 12 × 5
#>    name   tbl_description   version field      type 
#>    <chr>  <chr>             <chr>   <chr>      <chr>
#>  1 table1 Table1 for tool1. v1.2.3  SampleID   c    
#>  2 table1 Table1 for tool1. v1.2.3  Chromosome c    
#>  3 table1 Table1 for tool1. v1.2.3  Start      i    
#>  4 table1 Table1 for tool1. v1.2.3  End        i    
#>  5 table1 Table1 for tool1. v1.2.3  metricX    d    
#>  6 table1 Table1 for tool1. latest  SampleID   c    
#>  7 table1 Table1 for tool1. latest  Chromosome c    
#>  8 table1 Table1 for tool1. latest  Start      i    
#>  9 table1 Table1 for tool1. latest  End        i    
#> 10 table1 Table1 for tool1. latest  metricX    d    
#> 11 table1 Table1 for tool1. latest  metricY    d    
#> 12 table1 Table1 for tool1. latest  metricZ    d    
conf$get_raw_schema("table1", v = "v1.2.3")
#> # A tibble: 5 × 5
#>   name   tbl_description   version field      type 
#>   <chr>  <chr>             <chr>   <chr>      <chr>
#> 1 table1 Table1 for tool1. v1.2.3  SampleID   c    
#> 2 table1 Table1 for tool1. v1.2.3  Chromosome c    
#> 3 table1 Table1 for tool1. v1.2.3  Start      i    
#> 4 table1 Table1 for tool1. v1.2.3  End        i    
#> 5 table1 Table1 for tool1. v1.2.3  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 × 5
#>   name   tbl_description   version tbl   schema          
#>   <chr>  <chr>             <chr>   <chr> <list>          
#> 1 table1 Table1 for tool1. v1.2.3  tbl1  <tibble [5 × 3]>
#> 2 table1 Table1 for tool1. latest  tbl1  <tibble [7 × 3]>
#> 3 table2 Table2 for tool1. latest  tbl1  <tibble [3 × 3]>
#> 4 table3 Table3 for tool1. latest  tbl1  <tibble [5 × 3]>
conf$get_tidy_schema("table1")
#> # A tibble: 12 × 7
#>    name   tbl_description   version tbl   field      type  description   
#>    <chr>  <chr>             <chr>   <chr> <chr>      <chr> <chr>         
#>  1 table1 Table1 for tool1. v1.2.3  tbl1  sample_id  c     sample ID     
#>  2 table1 Table1 for tool1. v1.2.3  tbl1  chromosome c     chromosome    
#>  3 table1 Table1 for tool1. v1.2.3  tbl1  start      i     start position
#>  4 table1 Table1 for tool1. v1.2.3  tbl1  end        i     end position  
#>  5 table1 Table1 for tool1. v1.2.3  tbl1  metric_x   d     metric X      
#>  6 table1 Table1 for tool1. latest  tbl1  sample_id  c     sample ID     
#>  7 table1 Table1 for tool1. latest  tbl1  chromosome c     chromosome    
#>  8 table1 Table1 for tool1. latest  tbl1  start      i     start position
#>  9 table1 Table1 for tool1. latest  tbl1  end        i     end position  
#> 10 table1 Table1 for tool1. latest  tbl1  metric_x   d     metric X      
#> 11 table1 Table1 for tool1. latest  tbl1  metric_y   d     metric Y      
#> 12 table1 Table1 for tool1. latest  tbl1  metric_z   d     metric Z      
conf$get_tidy_schema("table1", v = "v1.2.3")
#> # A tibble: 5 × 7
#>   name   tbl_description   version tbl   field      type  description   
#>   <chr>  <chr>             <chr>   <chr> <chr>      <chr> <chr>         
#> 1 table1 Table1 for tool1. v1.2.3  tbl1  sample_id  c     sample ID     
#> 2 table1 Table1 for tool1. v1.2.3  tbl1  chromosome c     chromosome    
#> 3 table1 Table1 for tool1. v1.2.3  tbl1  start      i     start position
#> 4 table1 Table1 for tool1. v1.2.3  tbl1  end        i     end position  
#> 5 table1 Table1 for tool1. v1.2.3  tbl1  metric_x   d     metric X      
conf$get_tidy_schema("table1", subtbl = "tbl1")
#> # A tibble: 12 × 7
#>    name   tbl_description   version tbl   field      type  description   
#>    <chr>  <chr>             <chr>   <chr> <chr>      <chr> <chr>         
#>  1 table1 Table1 for tool1. v1.2.3  tbl1  sample_id  c     sample ID     
#>  2 table1 Table1 for tool1. v1.2.3  tbl1  chromosome c     chromosome    
#>  3 table1 Table1 for tool1. v1.2.3  tbl1  start      i     start position
#>  4 table1 Table1 for tool1. v1.2.3  tbl1  end        i     end position  
#>  5 table1 Table1 for tool1. v1.2.3  tbl1  metric_x   d     metric X      
#>  6 table1 Table1 for tool1. latest  tbl1  sample_id  c     sample ID     
#>  7 table1 Table1 for tool1. latest  tbl1  chromosome c     chromosome    
#>  8 table1 Table1 for tool1. latest  tbl1  start      i     start position
#>  9 table1 Table1 for tool1. latest  tbl1  end        i     end position  
#> 10 table1 Table1 for tool1. latest  tbl1  metric_x   d     metric X      
#> 11 table1 Table1 for tool1. latest  tbl1  metric_y   d     metric Y      
#> 12 table1 Table1 for tool1. latest  tbl1  metric_z   d     metric Z