diff isolib.R @ 2:b3251a7dae25 draft

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/isolib commit b9574494a6f9d2239dc81899e6d4074b33b078b7
author recetox
date Wed, 24 Apr 2024 14:51:32 +0000
parents 8a1893635ac0
children 6b0fef8a77c0
line wrap: on
line diff
--- a/isolib.R	Tue Apr 23 07:42:32 2024 +0000
+++ b/isolib.R	Wed Apr 24 14:51:32 2024 +0000
@@ -2,6 +2,7 @@
 library(Spectra)
 library(MsBackendMsp)
 library(MetaboCoreUtils)
+library(readr)
 
 #' @param args A list of command line arguments.
 main <- function() {
@@ -9,7 +10,11 @@
   data(adducts)
 
   args <- commandArgs(trailingOnly = TRUE)
-  compound_table <- read.delim(args[1], stringsAsFactors = FALSE)
+  compound_table <- read_tsv(
+    file = args[1],
+    col_types = "ccd",
+    col_select = tidyselect::all_of(c("name", "formula")) | tidyselect::any_of("rt")
+  )
   adducts_to_use <- c(unlist(strsplit(args[2], ",", fixed = TRUE)))
 
   chemforms <- compound_table$formula