Skip to content

Commit

Permalink
Merge pull request #525 from hechth/hechth/issue524
Browse files Browse the repository at this point in the history
isolib: fix rt column reading and writing
  • Loading branch information
hechth committed Apr 24, 2024
2 parents aea5530 + e433376 commit b957449
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 4 deletions.
7 changes: 6 additions & 1 deletion tools/isolib/isolib.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@ library(enviPat)
library(Spectra)
library(MsBackendMsp)
library(MetaboCoreUtils)
library(readr)

#' @param args A list of command line arguments.
main <- function() {
data(isotopes)
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
Expand Down
7 changes: 6 additions & 1 deletion tools/isolib/isolib.xml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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}'
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions tools/isolib/test-data/lc_markers_neg.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ C13H9FO3 4-Fluoro-3-phenoxybenzoic acid 532.2
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
Expand Down
6 changes: 6 additions & 0 deletions tools/isolib/test-data/markers_no_rt.tsv
Original file line number Diff line number Diff line change
@@ -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
64 changes: 64 additions & 0 deletions tools/isolib/test-data/test1.msp
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b957449

Please sign in to comment.