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
Method new()
Create a new Tool1 object.
Usage
Tool1$new(path = NULL, files_tbl = NULL)Arguments
path(
character(1))
Output directory of tool. Iffiles_tblis supplied, this is ignored.files_tbl(
tibble(n))
Tibble of files fromlist_files_dir().
Returns
(R6::R6Class())
R6 object.
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")
p5 <- system.file("extdata/tool1/latest/sampleA.tool1.table5.csv", package = "nemo")
(tidy3 <- obj1$tidy_table3(p3))
#> # A tibble: 1 × 2
#> name data
#> <chr> <list>
#> 1 table3 <tibble [1 × 5]>
(raw5 <- obj1$parse_table5(p5))
#> # A tibble: 16 × 5
#> section rg variable count pct
#> <chr> <chr> <chr> <dbl> <dbl>
#> 1 TUMOR MAPPING/ALIGNING SUMMARY NA Total reads 3000000 100
#> 2 TUMOR MAPPING/ALIGNING SUMMARY NA Mapped reads 2900000 96.7
#> 3 TUMOR MAPPING/ALIGNING SUMMARY NA Unmapped reads 100000 3.33
#> 4 TUMOR MAPPING/ALIGNING SUMMARY NA Total bases 450000000 NA
#> 5 NORMAL MAPPING/ALIGNING SUMMARY NA Total reads 1500000 100
#> 6 NORMAL MAPPING/ALIGNING SUMMARY NA Mapped reads 1460000 97.3
#> 7 NORMAL MAPPING/ALIGNING SUMMARY NA Unmapped reads 40000 2.67
#> 8 NORMAL MAPPING/ALIGNING SUMMARY NA Total bases 226500000 NA
#> 9 TUMOR MAPPING/ALIGNING PER RG BC01.1.FC1 Total reads 3000000 100
#> 10 TUMOR MAPPING/ALIGNING PER RG BC01.1.FC1 Mapped reads 2900000 96.7
#> 11 TUMOR MAPPING/ALIGNING PER RG BC01.1.FC1 Unmapped reads 100000 3.33
#> 12 TUMOR MAPPING/ALIGNING PER RG BC01.1.FC1 Total bases 450000000 NA
#> 13 NORMAL MAPPING/ALIGNING PER RG BC02.1.FC1 Total reads 1500000 100
#> 14 NORMAL MAPPING/ALIGNING PER RG BC02.1.FC1 Mapped reads 1460000 97.3
#> 15 NORMAL MAPPING/ALIGNING PER RG BC02.1.FC1 Unmapped reads 40000 2.67
#> 16 NORMAL MAPPING/ALIGNING PER RG BC02.1.FC1 Total bases 226500000 NA
(tidy5 <- obj1$tidy_table5(p5))
#> # A tibble: 1 × 2
#> name data
#> <chr> <list>
#> 1 table5 <tibble [4 × 9]>
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_table5.parquet"
#> [13] "sampleA_tool1_table6.parquet"
obj2 <- Tool1$new(indir)$tidy()
