learn field paramters as list

learn_field(lines, sep)

Arguments

lines

a vector of character strings from template file.

sep

a character specifying the separator.

Value

a list of field parameters containing

labels

a vector of characters specifying the filed name. In DATASET_HEATMAP, the labels are shown as heatamp column names.

colors

define colors for each individual field column (use hexadecimal, RGB or RGBA notation; if using RGB/RGBA, COMMA cannot be used as SEPARATOR)

shapes

Shape should be a number between 1 and 6, or any protein domain shape definition. 1-square, 2-circle, 3-star, 4-right pointing triangle, 5-left pointing triangle, 6-checkmark

Examples

tree <- system.file("extdata",
                    "tree_of_itol_templates.tree",
                    package = "itol.toolkit")
df_frequence <- data.table::fread(system.file("extdata",
                                              "templates_frequence.txt",
                                              package = "itol.toolkit"))
## create unit
unit <- create_unit(data = df_frequence,
                    key = "Quickstart",
                    type = "DATASET_HEATMAP",
                    tree = tree)
#> Using the first column as id: templates
## write unit
file <- tempfile()
write_unit(unit,file)
## Learn legend parameters
lines <- line_clean(file=file)
sep = learn_separator(file = file)
learn_field(lines = lines, sep = sep)
#> $labels
#>  [1] "10.1016/j.jhazmat.2022.129230"  "10.1016j.envpol.2022.120243"   
#>  [3] "10.1128/mSystems.00258-21"      "10.1038/s41467-022-31113-w"    
#>  [5] "10.1128/mSystems.00093-19"      "10.3390/pathogens11091022"     
#>  [7] "10.1038/s41467-022-33238-4"     "10.1099/mgen.0.000839"         
#>  [9] "10.1038/s41467-019-10191"       "10.1038/s41598-018-25545-y"    
#> [11] "10.1016/j.cub.2021.01.001"      "10.3389/fpls.2021.693039"      
#> [13] "10.1128/spectrum.02211-22"      "10.1371/journal.pgen.1010097"  
#> [15] "10.1371/journal.pgen.1010112"   "10.1101/2022.06.22.497255"     
#> [17] "10.1186/s40168-021-01016-x"     "10.1101/2022.12.08.519582"     
#> [19] "10.1016/j.foodcont.2021.108572" "10.1016/j.foodres.2022.111998" 
#> [21] "10.1038/s41467-022-35452-6"    
#> 
#> $colors
#> NULL
#> 
#> $shapes
#> NULL
#>