Skip to contents

Parses files with no header and two columns representing key-value pairs.

Usage

parse_file_keyvalue(fpath, pname, schemas_all, delim = "\t", ...)

Arguments

fpath

(character(1))
File path.

pname

(character(1))
Parser name.

schemas_all

(tibble())
Tibble with name, version and schema list-col.

delim

(character(1))
File delimiter.

...

Passed on to readr::read_delim.

Examples

path <- system.file("extdata/tool1", package = "nemo")
x <- Tool1$new(path)
schemas_all <- x$config$get_schemas_raw()
pname <- "table3"
f <- function(ver) file.path(path, ver, "sampleA.tool1.table3.tsv")
# v1.0.0: 3 key-value pairs (SampleID, QCStatus, TotalReads)
(d3_v1  <- parse_file_keyvalue(f("v1.0.0"), pname, schemas_all))
#> # A tibble: 1 × 3
#>   SampleID QCStatus TotalReads
#>   <chr>    <chr>    <chr>     
#> 1 sampleA  Pass     10000     
# latest: 5 key-value pairs
(d3_lat <- parse_file_keyvalue(f("latest"), pname, schemas_all))
#> # A tibble: 1 × 5
#>   SampleID QCStatus TotalReads MappedReads UnmappedReads
#>   <chr>    <chr>    <chr>      <chr>       <chr>        
#> 1 sampleA  Pass     10000      9500        500