changeset 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 7a4540275084
children 6b0fef8a77c0
files isolib.R isolib.xml test-data/lc_markers_neg.tsv test-data/markers_no_rt.tsv test-data/test1.msp
diffstat 5 files changed, 84 insertions(+), 4 deletions(-) [+]
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
--- a/isolib.xml	Tue Apr 23 07:42:32 2024 +0000
+++ b/isolib.xml	Wed Apr 24 14:51:32 2024 +0000
@@ -1,4 +1,4 @@
-<tool id="isolib" name="isolib" version="1.0.0+galaxy1" profile="21.09">
+<tool id="isolib" name="isolib" version="1.0.1+galaxy0" profile="21.09">
     <description>create an isotopic pattern library for given compounds and adducts</description>
     <creator>
         <person
@@ -19,6 +19,7 @@
         <requirement type="package" version="1.12.0">bioconductor-spectra</requirement>
         <requirement type="package" version="1.6.0">bioconductor-msbackendmsp</requirement>
         <requirement type="package" version="2.6">r-envipat</requirement>
+        <requirement type="package" version="2.1.5">r-readr</requirement>
     </requirements>
     <command detect_errors="exit_code"><![CDATA[
         Rscript '${__tool_directory__}/isolib.R' '${input_file}' '${ionization.adducts}' '${threshold}' '${append_adduct}' '${isotope_library}'
@@ -55,6 +56,10 @@
             <param name="input_file" value="lc_markers_neg.tsv"/>
             <output name="isotope_library" file="test0.msp"/>
         </test>
+        <test>
+            <param name="input_file" value="markers_no_rt.tsv"/>
+            <output name="isotope_library" file="test1.msp"/>
+        </test>
     </tests>
     <help><![CDATA[
         This tool computes isotopic patterns for given compounds and adduct forms.
--- a/test-data/lc_markers_neg.tsv	Tue Apr 23 07:42:32 2024 +0000
+++ b/test-data/lc_markers_neg.tsv	Wed Apr 24 14:51:32 2024 +0000
@@ -7,8 +7,8 @@
 C6H5NO3	4-nitrophenol	165
 C6H4Cl1N1O2	6-Chloronicotinic acid	172.2
 C19H28N2O5S	Acetochlor mercapturate	607.2
-C19H28N2O5S1	Alachlor mercapturate	607.2
-C10H12N2O3S1	Bentazone	747.6
+C19H28N2O5S1	Alachlor mercapturate	"607.2"
+C10H12N2O3S1	Bentazone	"747.6"
 C4H11O3P1S1	Diethylthiophosphate	177
 C14H17Cl2NO2	Fenhexamid	689.4
 C11H13ClO2	Fenvalerate free acid	585
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/markers_no_rt.tsv	Wed Apr 24 14:51:32 2024 +0000
@@ -0,0 +1,6 @@
+formula	name
+C8H6Cl2O3	2,4-Dichlorophenoxyacetic acid ou 2,4-D
+C9H15N3O1	2-diethylamino-6-methyl pyrimidin-4-ol/one
+C5H2Cl3N1O1	3,5,6-Trichloro-2-pyridinol
+C13H10O3	3-phenoxybenzoic acid
+C13H9FO3	4-Fluoro-3-phenoxybenzoic acid
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test1.msp	Wed Apr 24 14:51:32 2024 +0000
@@ -0,0 +1,64 @@
+NAME: 2,4-Dichlorophenoxyacetic acid ou 2,4-D (M-H)
+msLevel: MS1
+PRECURSORTYPE: [M-H]-
+FORMULA: C8H6Cl2O3
+charge: -1
+ionization_mode: negative
+precursor_mz: 218.962123412
+Num Peaks: 5
+218.962123019909 100
+219.965477859909 8.65258263418579
+220.959172909909 63.9915522703273
+221.962527749909 5.53692193908827
+222.956222799909 10.2372969049151
+
+NAME: 2-diethylamino-6-methyl pyrimidin-4-ol/one (M-H)
+msLevel: MS1
+PRECURSORTYPE: [M-H]-
+FORMULA: C9H15N3O1
+charge: -1
+ionization_mode: negative
+precursor_mz: 180.1142361
+Num Peaks: 3
+180.114235677909 100
+181.111270637909 1.09598940142117
+181.117590517909 9.73415546345901
+
+NAME: 3,5,6-Trichloro-2-pyridinol (M-H)
+msLevel: MS1
+PRECURSORTYPE: [M-H]-
+FORMULA: C5H2Cl3N1O1
+charge: -1
+ionization_mode: negative
+precursor_mz: 195.912920724
+Num Peaks: 7
+195.912920371909 100
+196.916275211909 5.40786414636612
+197.909970261909 95.987328405491
+198.913325101909 5.19086431789525
+199.907020151909 30.7118907147453
+200.910374991909 1.66085732663385
+201.904070041909 3.27550259998867
+
+NAME: 3-phenoxybenzoic acid (M-H)
+msLevel: MS1
+PRECURSORTYPE: [M-H]-
+FORMULA: C13H10O3
+charge: -1
+ionization_mode: negative
+precursor_mz: 213.05571818
+Num Peaks: 2
+213.055717727909 100
+214.059072567909 14.0604467805519
+
+NAME: 4-Fluoro-3-phenoxybenzoic acid (M-H)
+msLevel: MS1
+PRECURSORTYPE: [M-H]-
+FORMULA: C13H9F1O3
+charge: -1
+ionization_mode: negative
+precursor_mz: 231.046296368
+Num Peaks: 2
+231.046295895909 100
+232.049650735909 14.0604467805519
+