Repository 'isolib'
hg clone https://toolshed.g2.bx.psu.edu/repos/recetox/isolib

Changeset 4:2b1118bce0b1 (2024-11-01)
Previous changeset 3:6b0fef8a77c0 (2024-05-30) Next changeset 5:964b4559eb1b (2025-05-15)
Commit message:
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/isolib commit e21ab1b7f16bc0a58b33b8e46f828e150372c307
modified:
isolib.R
isolib.xml
added:
test-data/test2.tabular
test-data/test3.tabular
b
diff -r 6b0fef8a77c0 -r 2b1118bce0b1 isolib.R
--- a/isolib.R Thu May 30 14:52:02 2024 +0000
+++ b/isolib.R Fri Nov 01 08:45:59 2024 +0000
[
@@ -3,23 +3,43 @@
 library(MsBackendMsp)
 library(MetaboCoreUtils)
 library(readr)
+library(tidyselect)
 
-#' @param args A list of command line arguments.
-main <- function() {
+
+parse_args <- function() {
+    args <- commandArgs(trailingOnly = TRUE)
+
+    compound_table <- read_tsv(
+        file = args[1],
+        col_types = "ccd",
+        col_select = all_of(c("name", "formula")) | any_of("rt")
+    )
+
+    parsed <- list(
+        compound_table = compound_table,
+        adducts_to_use = c(unlist(strsplit(args[2], ",", fixed = TRUE))),
+        threshold = as.numeric(args[3]),
+        append_adducts = args[4],
+        append_isotopes = args[5],
+        out_format = args[6],
+        outfile = args[7]
+    )
+    return(parsed)
+}
+
+generate_isotope_spectra <- function(compound_table,
+                                     adducts_to_use,
+                                     append_adducts,
+                                     threshold) {
     data(isotopes)
     data(adducts)
 
-    args <- commandArgs(trailingOnly = TRUE)
-    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)))
+    monoisotopic <- isotopes |>
+        dplyr::group_by(element) |>
+        dplyr::slice_max(abundance, n = 1) |>
+        dplyr::filter(!stringr::str_detect(element, "\\[|\\]"))
 
-    chemforms <- compound_table$formula
-    chemforms <- check_chemform(isotopes, chemforms)[, 2]
-
+    chemforms <- check_chemform(isotopes, compound_table$formula)[, 2]
     spectra <- data.frame()
 
     for (current in adducts_to_use) {
@@ -32,12 +52,19 @@
             merged_chemforms <- mergeform(multiplied_chemforms, adduct$Formula_add)
         }
 
-        charge_string <- paste0(if (adduct$Charge > 0) "+" else "-", if (abs(adduct$Charge) > 1) abs(adduct$Charge) else "")
+        charge_string <- paste0(
+            if (adduct$Charge > 0) "+" else "-",
+            if (abs(adduct$Charge) > 1) abs(adduct$Charge) else ""
+        )
         adduct_string <- paste0("[", adduct$Name, "]", charge_string)
         precursor_mz <- calculateMass(multiplied_chemforms) + adduct$Mass
 
-        if (args[4] == TRUE) {
-            names <- paste(compound_table$name, paste0("(", adduct$Name, ")"), sep = " ")
+        if (append_adducts == TRUE) {
+            names <- paste(
+                compound_table$name,
+                paste0("(", adduct$Name, ")"),
+                sep = " "
+            )
         } else {
             names <- compound_table$name
         }
@@ -60,26 +87,94 @@
             isotopes = isotopes,
             chemforms = merged_chemforms,
             charge = adduct$Charge,
-            threshold = as.numeric(args[3]),
+            threshold = threshold,
         )
 
         mzs <- list()
         intensities <- list()
+        isos <- list()
+
         for (i in seq_along(patterns)) {
             mzs <- append(mzs, list(patterns[[i]][, 1]))
             intensities <- append(intensities, list(patterns[[i]][, 2]))
+
+            # select all columns which describe the elemental composition
+            # remove all 12C, 35Cl etc.
+            # remove isotopes which don't occur
+            compositions <- as.data.frame(patterns[[i]][, -c(1, 2)]) |>
+                dplyr::select(-tidyselect::any_of(monoisotopic$isotope)) |>
+                dplyr::select_if(~ !all(. == 0))
+
+            # combine elemental composition into single string
+            compositions <- compositions |>
+                dplyr::rowwise() |>
+                dplyr::mutate(isotopes = paste(
+                    purrr::map2_chr(
+                        names(compositions),
+                        dplyr::c_across(everything()),
+                        ~ paste(.x, .y, sep = ":")
+                    ),
+                    collapse = ", "
+                )) |>
+                dplyr::ungroup() |>
+                dplyr::select(isotopes)
+            isos <- append(isos, list(compositions$isotopes))
         }
 
         spectra_df$mz <- mzs
         spectra_df$intensity <- intensities
+        spectra_df$isotopes <- isos
         spectra <- rbind(spectra, spectra_df)
     }
+    return(spectra)
+}
 
-    sps <- Spectra(spectra)
-    export(sps, MsBackendMsp(), file = args[5])
+write_to_msp <- function(spectra, file) {
+    sps <- Spectra(dplyr::select(spectra, -isotopes))
+    export(sps, MsBackendMsp(), file = file)
 }
 
-# Get the command line arguments
-args <- commandArgs(trailingOnly = TRUE)
+write_to_table <- function(spectra, file, append_isotopes) {
+    entries <- spectra |>
+        dplyr::rowwise() |>
+        dplyr::mutate(peaks = paste(unlist(mz), collapse = ";")) |>
+        dplyr::mutate(isos = paste(unlist(isotopes), collapse = ";"))
+    result <- tidyr::separate_longer_delim(
+        entries,
+        all_of(c("peaks", "isos")),
+        ";"
+    )
+    result <- result |>
+        dplyr::select(-c("mz", "intensity", "isotopes")) |>
+        dplyr::rename(mz = peaks, isotopes = isos, rt = retention_time)
+
+    if (append_isotopes) {
+        result <- result |>
+            dplyr::mutate(result,
+                full_formula = paste0(formula, " (", isotopes, ")")
+            ) |>
+            dplyr::select(-all_of(c("formula", "isotopes"))) |>
+            dplyr::rename(formula = full_formula) |>
+            dplyr::relocate(formula, .after = name)
+    }
+    readr::write_tsv(result, file = file)
+}
+
+main <- function() {
+    args <- parse_args()
+    spectra <- generate_isotope_spectra(
+        args$compound_table,
+        args$adducts_to_use,
+        args$append_adducts,
+        args$threshold
+    )
+
+    if (args$out_format == "msp") {
+        write_to_msp(spectra, args$outfile)
+    } else if (args$out_format == "tabular") {
+        write_to_table(spectra, args$outfile, args$append_isotopes)
+    }
+}
+
 # Call the main function
 main()
b
diff -r 6b0fef8a77c0 -r 2b1118bce0b1 isolib.xml
--- a/isolib.xml Thu May 30 14:52:02 2024 +0000
+++ b/isolib.xml Fri Nov 01 08:45:59 2024 +0000
[
@@ -1,5 +1,5 @@
-<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>
+<tool id="isolib" name="isolib" version="2.6+galaxy0" profile="21.09">
+    <description>create an isotopic pattern library for given compounds and adducts based on enviPat</description>
     <creator>
         <person
             givenName="Helge"
@@ -20,9 +20,23 @@
         <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>
+        <requirement type="package" version="1.3.1">r-tidyr</requirement>
+        <requirement type="package" version="1.5.1">r-stringr</requirement>
+        <requirement type="package" version="1.0.2">r-purrr</requirement>
     </requirements>
     <command detect_errors="exit_code"><![CDATA[
-        Rscript '${__tool_directory__}/isolib.R' '${input_file}' '${ionization.adducts}' '${threshold}' '${append_adduct}' '${isotope_library}'
+        Rscript '${__tool_directory__}/isolib.R'
+            '${input_file}'
+            '${ionization.adducts}'
+            '${threshold}'
+            '${append_adduct}'
+            #if $formatting.out_format == "tabular"
+            '${formatting.append_isotopes}'
+            #else
+            'FALSE'
+            #end if
+            '${formatting.out_format}'
+            '${isotope_library}'
     ]]></command>
     <inputs>
         <param name="input_file" type="data" format="tabular" label="Table with input compounds"/>
@@ -46,9 +60,25 @@
         </conditional>
         <param name="threshold" type="float" min="0" max="100" value="1" label="Threshold" help="Probability threshold to use as cutoff for isotopic pattern distribution - this can be used to remove low abundant peaks and improve computation performance." />
         <param name="append_adduct" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="true" label="Append adduct to compound name" help="Append the adduct string to the compound name for easy identification." />
+        <conditional name="formatting">
+            <param name="out_format" type="select" label="Output Format" help="Choose the output format, either MSP or Tabular">
+                <option value="tabular">tabular</option>
+                <option value="msp" selected="true">msp</option>
+            </param>
+            <when value="tabular">
+                <param name="append_isotopes" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="false" label="Append isotopes to formula" help="Append the isotopic composition to the formula for easy identification." />
+            </when>
+            <when value="msp">
+            </when>
+        </conditional>
     </inputs>
     <outputs>
-        <data format="msp" name="isotope_library"/>
+        <data format="msp" name="isotope_library">
+            <change_format>
+                <when input="formatting.out_format" value="msp" format="msp" />
+                <when input="formatting.out_format" value="tabular" format="tabular" />
+            </change_format>
+        </data>
     </outputs>
 
     <tests>
@@ -60,6 +90,18 @@
             <param name="input_file" value="markers_no_rt.tsv"/>
             <output name="isotope_library" file="test1.msp"/>
         </test>
+        <test>
+            <param name="input_file" value="lc_markers_neg.tsv"/>
+            <param name="out_format" value="tabular"/>
+            <param name="append_isotopes" value="TRUE" />
+            <output name="isotope_library" file="test2.tabular"/>
+        </test>
+        <test>
+            <param name="input_file" value="lc_markers_neg.tsv"/>
+            <param name="out_format" value="tabular"/>
+            <param name="adducts" value="M-H,2M-H"/>
+            <output name="isotope_library" file="test3.tabular"/>
+        </test>
     </tests>
     <help><![CDATA[
         This tool computes isotopic patterns for given compounds and adduct forms.
b
diff -r 6b0fef8a77c0 -r 2b1118bce0b1 test-data/test2.tabular
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test2.tabular Fri Nov 01 08:45:59 2024 +0000
[
b'@@ -0,0 +1,123 @@\n+name\tformula\tadduct\tcharge\tionization_mode\tprecursor_mz\tmsLevel\trt\tmz\n+2,4-Dichlorophenoxyacetic acid ou 2,4-D (M-H)\tC8H6Cl2O3 (13C:0, 37Cl:0)\t[M-H]-\t-1\tnegative\t218.962123412\t1\t484.2\t218.962123019909\n+2,4-Dichlorophenoxyacetic acid ou 2,4-D (M-H)\tC8H6Cl2O3 (13C:1, 37Cl:0)\t[M-H]-\t-1\tnegative\t218.962123412\t1\t484.2\t219.965477859909\n+2,4-Dichlorophenoxyacetic acid ou 2,4-D (M-H)\tC8H6Cl2O3 (13C:0, 37Cl:1)\t[M-H]-\t-1\tnegative\t218.962123412\t1\t484.2\t220.959172909909\n+2,4-Dichlorophenoxyacetic acid ou 2,4-D (M-H)\tC8H6Cl2O3 (13C:1, 37Cl:1)\t[M-H]-\t-1\tnegative\t218.962123412\t1\t484.2\t221.962527749909\n+2,4-Dichlorophenoxyacetic acid ou 2,4-D (M-H)\tC8H6Cl2O3 (13C:0, 37Cl:2)\t[M-H]-\t-1\tnegative\t218.962123412\t1\t484.2\t222.956222799909\n+2-diethylamino-6-methyl pyrimidin-4-ol/one (M-H)\tC9H15N3O1 (13C:0, 15N:0)\t[M-H]-\t-1\tnegative\t180.1142361\t1\t451.8\t180.114235677909\n+2-diethylamino-6-methyl pyrimidin-4-ol/one (M-H)\tC9H15N3O1 (13C:0, 15N:1)\t[M-H]-\t-1\tnegative\t180.1142361\t1\t451.8\t181.111270637909\n+2-diethylamino-6-methyl pyrimidin-4-ol/one (M-H)\tC9H15N3O1 (13C:1, 15N:0)\t[M-H]-\t-1\tnegative\t180.1142361\t1\t451.8\t181.117590517909\n+3,5,6-Trichloro-2-pyridinol (M-H)\tC5H2Cl3N1O1 (13C:0, 37Cl:0)\t[M-H]-\t-1\tnegative\t195.912920724\t1\t499.2\t195.912920371909\n+3,5,6-Trichloro-2-pyridinol (M-H)\tC5H2Cl3N1O1 (13C:1, 37Cl:0)\t[M-H]-\t-1\tnegative\t195.912920724\t1\t499.2\t196.916275211909\n+3,5,6-Trichloro-2-pyridinol (M-H)\tC5H2Cl3N1O1 (13C:0, 37Cl:1)\t[M-H]-\t-1\tnegative\t195.912920724\t1\t499.2\t197.909970261909\n+3,5,6-Trichloro-2-pyridinol (M-H)\tC5H2Cl3N1O1 (13C:1, 37Cl:1)\t[M-H]-\t-1\tnegative\t195.912920724\t1\t499.2\t198.913325101909\n+3,5,6-Trichloro-2-pyridinol (M-H)\tC5H2Cl3N1O1 (13C:0, 37Cl:2)\t[M-H]-\t-1\tnegative\t195.912920724\t1\t499.2\t199.907020151909\n+3,5,6-Trichloro-2-pyridinol (M-H)\tC5H2Cl3N1O1 (13C:1, 37Cl:2)\t[M-H]-\t-1\tnegative\t195.912920724\t1\t499.2\t200.910374991909\n+3,5,6-Trichloro-2-pyridinol (M-H)\tC5H2Cl3N1O1 (13C:0, 37Cl:3)\t[M-H]-\t-1\tnegative\t195.912920724\t1\t499.2\t201.904070041909\n+3-phenoxybenzoic acid (M-H)\tC13H10O3 (13C:0)\t[M-H]-\t-1\tnegative\t213.05571818\t1\t517.8\t213.055717727909\n+3-phenoxybenzoic acid (M-H)\tC13H10O3 (13C:1)\t[M-H]-\t-1\tnegative\t213.05571818\t1\t517.8\t214.059072567909\n+4-Fluoro-3-phenoxybenzoic acid (M-H)\tC13H9F1O3 (13C:0)\t[M-H]-\t-1\tnegative\t231.04629636800001\t1\t532.2\t231.046295895909\n+4-Fluoro-3-phenoxybenzoic acid (M-H)\tC13H9F1O3 (13C:1)\t[M-H]-\t-1\tnegative\t231.04629636800001\t1\t532.2\t232.049650735909\n+4-nitrophenol (M-H)\tC6H5N1O3 (13C:0)\t[M-H]-\t-1\tnegative\t138.01966702000001\t1\t165\t138.019666577909\n+4-nitrophenol (M-H)\tC6H5N1O3 (13C:1)\t[M-H]-\t-1\tnegative\t138.01966702000001\t1\t165\t139.023021417909\n+6-Chloronicotinic acid (M-H)\tC6H4Cl1N1O2 (13C:0, 37Cl:0)\t[M-H]-\t-1\tnegative\t155.985780048\t1\t172.2\t155.985779635909\n+6-Chloronicotinic acid (M-H)\tC6H4Cl1N1O2 (13C:1, 37Cl:0)\t[M-H]-\t-1\tnegative\t155.985780048\t1\t172.2\t156.989134475909\n+6-Chloronicotinic acid (M-H)\tC6H4Cl1N1O2 (13C:0, 37Cl:1)\t[M-H]-\t-1\tnegative\t155.985780048\t1\t172.2\t157.982829525909\n+6-Chloronicotinic acid (M-H)\tC6H4Cl1N1O2 (13C:1, 37Cl:1)\t[M-H]-\t-1\tnegative\t155.985780048\t1\t172.2\t158.986184365909\n+Acetochlor mercapturate (M-H)\tC19H28N2O5S1 (13C:0, 18O:0, 34S:0)\t[M-H]-\t-1\tnegative\t395.164616996\t1\t607.2\t395.164616293909\n+Acetochlor mercapturate (M-H)\tC19H28N2O5S1 (13C:1, 18O:0, 34S:0)\t[M-H]-\t-1\tnegative\t395.164616996\t1\t607.2\t396.167971133909\n+Acetochlor mercapturate (M-H)\tC19H28N2O5S1 (13C:0, 18O:0, 34S:1)\t[M-H]-\t-1\tnegative\t395.164616996\t1\t607.2\t397.160412433909\n+Acetochlor mercapturate (M-H)\tC19H28N2O5S1 (13C:0, 18O:1, 34S:0)\t[M-H]-\t-1\tnegative\t395.164616996\t1\t607.2\t397.168862073909\n+Acetochlor mercapturate (M-H)\tC19H28N2O5S1 (13C:2, 18O:0, 34S:0)\t[M-H]-\t-1\tnegative\t395.164616996\t1\t607.2\t397.171325973909\n+Alachlor mercapturate (M-H)\tC19H28N2O5S1 (13C:0, 18O:0, 34S:0)\t[M-H]-\t-1\tnegative\t395.164616996\t1\t607.2\t395.164616293909\n+Alachlor mercapturate (M-H)\tC19H28N2O5S1 (13C:1, 18O:0, 34S:0)\t[M-H]-\t-1\tnegative\t395.164616996\t1\t607.2\t396.167971133909\n+Alachlor mercapturate (M-H)\tC19H28N2O5S1 (13'..b')\t[M-H]-\t-1\tnegative\t286.943886504\t1\t811.8\t286.943886141909\n+Triclosan (M-H)\tC12H7Cl3O2 (13C:1, 37Cl:0)\t[M-H]-\t-1\tnegative\t286.943886504\t1\t811.8\t287.947240981909\n+Triclosan (M-H)\tC12H7Cl3O2 (13C:0, 37Cl:1)\t[M-H]-\t-1\tnegative\t286.943886504\t1\t811.8\t288.940936031909\n+Triclosan (M-H)\tC12H7Cl3O2 (13C:1, 37Cl:1)\t[M-H]-\t-1\tnegative\t286.943886504\t1\t811.8\t289.944290871909\n+Triclosan (M-H)\tC12H7Cl3O2 (13C:0, 37Cl:2)\t[M-H]-\t-1\tnegative\t286.943886504\t1\t811.8\t290.937985921909\n+Triclosan (M-H)\tC12H7Cl3O2 (13C:1, 37Cl:2)\t[M-H]-\t-1\tnegative\t286.943886504\t1\t811.8\t291.941340761909\n+Triclosan (M-H)\tC12H7Cl3O2 (13C:0, 37Cl:3)\t[M-H]-\t-1\tnegative\t286.943886504\t1\t811.8\t292.935035811909\n+Triclosan glucuronide (M-H)\tC18H15Cl3O8 (13C:0, 37Cl:0, 18O:0)\t[M-H]-\t-1\tnegative\t462.97597448\t1\t665.4\t462.975974117909\n+Triclosan glucuronide (M-H)\tC18H15Cl3O8 (13C:1, 37Cl:0, 18O:0)\t[M-H]-\t-1\tnegative\t462.97597448\t1\t665.4\t463.979328957909\n+Triclosan glucuronide (M-H)\tC18H15Cl3O8 (13C:0, 37Cl:1, 18O:0)\t[M-H]-\t-1\tnegative\t462.97597448\t1\t665.4\t464.973024007909\n+Triclosan glucuronide (M-H)\tC18H15Cl3O8 (13C:0, 37Cl:0, 18O:1)\t[M-H]-\t-1\tnegative\t462.97597448\t1\t665.4\t464.980219897909\n+Triclosan glucuronide (M-H)\tC18H15Cl3O8 (13C:2, 37Cl:0, 18O:0)\t[M-H]-\t-1\tnegative\t462.97597448\t1\t665.4\t464.982683797909\n+Triclosan glucuronide (M-H)\tC18H15Cl3O8 (13C:1, 37Cl:1, 18O:0)\t[M-H]-\t-1\tnegative\t462.97597448\t1\t665.4\t465.976378847909\n+Triclosan glucuronide (M-H)\tC18H15Cl3O8 (13C:0, 37Cl:2, 18O:0)\t[M-H]-\t-1\tnegative\t462.97597448\t1\t665.4\t466.970073897909\n+Triclosan glucuronide (M-H)\tC18H15Cl3O8 (13C:0, 37Cl:1, 18O:1)\t[M-H]-\t-1\tnegative\t462.97597448\t1\t665.4\t466.977269787909\n+Triclosan glucuronide (M-H)\tC18H15Cl3O8 (13C:2, 37Cl:1, 18O:0)\t[M-H]-\t-1\tnegative\t462.97597448\t1\t665.4\t466.979733687909\n+Triclosan glucuronide (M-H)\tC18H15Cl3O8 (13C:1, 37Cl:2, 18O:0)\t[M-H]-\t-1\tnegative\t462.97597448\t1\t665.4\t467.973428737909\n+Triclosan glucuronide (M-H)\tC18H15Cl3O8 (13C:0, 37Cl:3, 18O:0)\t[M-H]-\t-1\tnegative\t462.97597448\t1\t665.4\t468.967123787909\n+Triclosan sulfate (M-H)\tC12H7Cl3O5S1 (13C:0, 37Cl:0, 18O:0, 34S:0)\t[M-H]-\t-1\tnegative\t366.900701364\t1\t695.4\t366.900700731909\n+Triclosan sulfate (M-H)\tC12H7Cl3O5S1 (13C:1, 37Cl:0, 18O:0, 34S:0)\t[M-H]-\t-1\tnegative\t366.900701364\t1\t695.4\t367.904055571909\n+Triclosan sulfate (M-H)\tC12H7Cl3O5S1 (13C:0, 37Cl:0, 18O:0, 34S:1)\t[M-H]-\t-1\tnegative\t366.900701364\t1\t695.4\t368.896496871909\n+Triclosan sulfate (M-H)\tC12H7Cl3O5S1 (13C:0, 37Cl:1, 18O:0, 34S:0)\t[M-H]-\t-1\tnegative\t366.900701364\t1\t695.4\t368.897750621909\n+Triclosan sulfate (M-H)\tC12H7Cl3O5S1 (13C:0, 37Cl:0, 18O:1, 34S:0)\t[M-H]-\t-1\tnegative\t366.900701364\t1\t695.4\t368.904946511909\n+Triclosan sulfate (M-H)\tC12H7Cl3O5S1 (13C:1, 37Cl:1, 18O:0, 34S:0)\t[M-H]-\t-1\tnegative\t366.900701364\t1\t695.4\t369.901105461909\n+Triclosan sulfate (M-H)\tC12H7Cl3O5S1 (13C:0, 37Cl:1, 18O:0, 34S:1)\t[M-H]-\t-1\tnegative\t366.900701364\t1\t695.4\t370.893546761909\n+Triclosan sulfate (M-H)\tC12H7Cl3O5S1 (13C:0, 37Cl:2, 18O:0, 34S:0)\t[M-H]-\t-1\tnegative\t366.900701364\t1\t695.4\t370.894800511909\n+Triclosan sulfate (M-H)\tC12H7Cl3O5S1 (13C:1, 37Cl:2, 18O:0, 34S:0)\t[M-H]-\t-1\tnegative\t366.900701364\t1\t695.4\t371.898155351909\n+Triclosan sulfate (M-H)\tC12H7Cl3O5S1 (13C:0, 37Cl:2, 18O:0, 34S:1)\t[M-H]-\t-1\tnegative\t366.900701364\t1\t695.4\t372.890596651909\n+Triclosan sulfate (M-H)\tC12H7Cl3O5S1 (13C:0, 37Cl:3, 18O:0, 34S:0)\t[M-H]-\t-1\tnegative\t366.900701364\t1\t695.4\t372.891850401909\n+acetamiprid-N-desmethyl (M-H)\tC9H9N4Cl1 (13C:0, 15N:0, 37Cl:0)\t[M-H]-\t-1\tnegative\t207.044297968\t1\t402.6\t207.044297585909\n+acetamiprid-N-desmethyl (M-H)\tC9H9N4Cl1 (13C:0, 15N:1, 37Cl:0)\t[M-H]-\t-1\tnegative\t207.044297968\t1\t402.6\t208.041332545909\n+acetamiprid-N-desmethyl (M-H)\tC9H9N4Cl1 (13C:1, 15N:0, 37Cl:0)\t[M-H]-\t-1\tnegative\t207.044297968\t1\t402.6\t208.047652425909\n+acetamiprid-N-desmethyl (M-H)\tC9H9N4Cl1 (13C:0, 15N:0, 37Cl:1)\t[M-H]-\t-1\tnegative\t207.044297968\t1\t402.6\t209.041347475909\n+acetamiprid-N-desmethyl (M-H)\tC9H9N4Cl1 (13C:1, 15N:0, 37Cl:1)\t[M-H]-\t-1\tnegative\t207.044297968\t1\t402.6\t210.044702315909\n'
b
diff -r 6b0fef8a77c0 -r 2b1118bce0b1 test-data/test3.tabular
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test3.tabular Fri Nov 01 08:45:59 2024 +0000
[
b'@@ -0,0 +1,366 @@\n+name\tadduct\tformula\tcharge\tionization_mode\tprecursor_mz\tmsLevel\trt\tmz\tisotopes\n+2,4-Dichlorophenoxyacetic acid ou 2,4-D (M-H)\t[M-H]-\tC8H6Cl2O3\t-1\tnegative\t218.962123412\t1\t484.2\t218.962123019909\t13C:0, 37Cl:0\n+2,4-Dichlorophenoxyacetic acid ou 2,4-D (M-H)\t[M-H]-\tC8H6Cl2O3\t-1\tnegative\t218.962123412\t1\t484.2\t219.965477859909\t13C:1, 37Cl:0\n+2,4-Dichlorophenoxyacetic acid ou 2,4-D (M-H)\t[M-H]-\tC8H6Cl2O3\t-1\tnegative\t218.962123412\t1\t484.2\t220.959172909909\t13C:0, 37Cl:1\n+2,4-Dichlorophenoxyacetic acid ou 2,4-D (M-H)\t[M-H]-\tC8H6Cl2O3\t-1\tnegative\t218.962123412\t1\t484.2\t221.962527749909\t13C:1, 37Cl:1\n+2,4-Dichlorophenoxyacetic acid ou 2,4-D (M-H)\t[M-H]-\tC8H6Cl2O3\t-1\tnegative\t218.962123412\t1\t484.2\t222.956222799909\t13C:0, 37Cl:2\n+2-diethylamino-6-methyl pyrimidin-4-ol/one (M-H)\t[M-H]-\tC9H15N3O1\t-1\tnegative\t180.1142361\t1\t451.8\t180.114235677909\t13C:0, 15N:0\n+2-diethylamino-6-methyl pyrimidin-4-ol/one (M-H)\t[M-H]-\tC9H15N3O1\t-1\tnegative\t180.1142361\t1\t451.8\t181.111270637909\t13C:0, 15N:1\n+2-diethylamino-6-methyl pyrimidin-4-ol/one (M-H)\t[M-H]-\tC9H15N3O1\t-1\tnegative\t180.1142361\t1\t451.8\t181.117590517909\t13C:1, 15N:0\n+3,5,6-Trichloro-2-pyridinol (M-H)\t[M-H]-\tC5H2Cl3N1O1\t-1\tnegative\t195.912920724\t1\t499.2\t195.912920371909\t13C:0, 37Cl:0\n+3,5,6-Trichloro-2-pyridinol (M-H)\t[M-H]-\tC5H2Cl3N1O1\t-1\tnegative\t195.912920724\t1\t499.2\t196.916275211909\t13C:1, 37Cl:0\n+3,5,6-Trichloro-2-pyridinol (M-H)\t[M-H]-\tC5H2Cl3N1O1\t-1\tnegative\t195.912920724\t1\t499.2\t197.909970261909\t13C:0, 37Cl:1\n+3,5,6-Trichloro-2-pyridinol (M-H)\t[M-H]-\tC5H2Cl3N1O1\t-1\tnegative\t195.912920724\t1\t499.2\t198.913325101909\t13C:1, 37Cl:1\n+3,5,6-Trichloro-2-pyridinol (M-H)\t[M-H]-\tC5H2Cl3N1O1\t-1\tnegative\t195.912920724\t1\t499.2\t199.907020151909\t13C:0, 37Cl:2\n+3,5,6-Trichloro-2-pyridinol (M-H)\t[M-H]-\tC5H2Cl3N1O1\t-1\tnegative\t195.912920724\t1\t499.2\t200.910374991909\t13C:1, 37Cl:2\n+3,5,6-Trichloro-2-pyridinol (M-H)\t[M-H]-\tC5H2Cl3N1O1\t-1\tnegative\t195.912920724\t1\t499.2\t201.904070041909\t13C:0, 37Cl:3\n+3-phenoxybenzoic acid (M-H)\t[M-H]-\tC13H10O3\t-1\tnegative\t213.05571818\t1\t517.8\t213.055717727909\t13C:0\n+3-phenoxybenzoic acid (M-H)\t[M-H]-\tC13H10O3\t-1\tnegative\t213.05571818\t1\t517.8\t214.059072567909\t13C:1\n+4-Fluoro-3-phenoxybenzoic acid (M-H)\t[M-H]-\tC13H9F1O3\t-1\tnegative\t231.04629636800001\t1\t532.2\t231.046295895909\t13C:0\n+4-Fluoro-3-phenoxybenzoic acid (M-H)\t[M-H]-\tC13H9F1O3\t-1\tnegative\t231.04629636800001\t1\t532.2\t232.049650735909\t13C:1\n+4-nitrophenol (M-H)\t[M-H]-\tC6H5N1O3\t-1\tnegative\t138.01966702000001\t1\t165\t138.019666577909\t13C:0\n+4-nitrophenol (M-H)\t[M-H]-\tC6H5N1O3\t-1\tnegative\t138.01966702000001\t1\t165\t139.023021417909\t13C:1\n+6-Chloronicotinic acid (M-H)\t[M-H]-\tC6H4Cl1N1O2\t-1\tnegative\t155.985780048\t1\t172.2\t155.985779635909\t13C:0, 37Cl:0\n+6-Chloronicotinic acid (M-H)\t[M-H]-\tC6H4Cl1N1O2\t-1\tnegative\t155.985780048\t1\t172.2\t156.989134475909\t13C:1, 37Cl:0\n+6-Chloronicotinic acid (M-H)\t[M-H]-\tC6H4Cl1N1O2\t-1\tnegative\t155.985780048\t1\t172.2\t157.982829525909\t13C:0, 37Cl:1\n+6-Chloronicotinic acid (M-H)\t[M-H]-\tC6H4Cl1N1O2\t-1\tnegative\t155.985780048\t1\t172.2\t158.986184365909\t13C:1, 37Cl:1\n+Acetochlor mercapturate (M-H)\t[M-H]-\tC19H28N2O5S1\t-1\tnegative\t395.164616996\t1\t607.2\t395.164616293909\t13C:0, 18O:0, 34S:0\n+Acetochlor mercapturate (M-H)\t[M-H]-\tC19H28N2O5S1\t-1\tnegative\t395.164616996\t1\t607.2\t396.167971133909\t13C:1, 18O:0, 34S:0\n+Acetochlor mercapturate (M-H)\t[M-H]-\tC19H28N2O5S1\t-1\tnegative\t395.164616996\t1\t607.2\t397.160412433909\t13C:0, 18O:0, 34S:1\n+Acetochlor mercapturate (M-H)\t[M-H]-\tC19H28N2O5S1\t-1\tnegative\t395.164616996\t1\t607.2\t397.168862073909\t13C:0, 18O:1, 34S:0\n+Acetochlor mercapturate (M-H)\t[M-H]-\tC19H28N2O5S1\t-1\tnegative\t395.164616996\t1\t607.2\t397.171325973909\t13C:2, 18O:0, 34S:0\n+Alachlor mercapturate (M-H)\t[M-H]-\tC19H28N2O5S1\t-1\tnegative\t395.164616996\t1\t607.2\t395.164616293909\t13C:0, 18O:0, 34S:0\n+Alachlor mercapturate (M-H)\t[M-H]-\tC19H28N2O5S1\t-1\tnegative\t395.164616996\t1\t607.2\t396.167971133909\t13C:1, 18O:0, 34S:0\n+Alachlor mercapturate (M-H)\t[M-H]-\tC19H28N2O5S1\t-1\tnegative\t395.164616996\t1\t607.2\t397.160412433909\t'..b'909\t13C:0, 37Cl:1, 18O:0, 34S:0, 33S:1\n+Triclosan sulfate (2M-H)\t[2M-H]-\tC12H7Cl3O5S1\t-1\tnegative\t734.8086787279999\t1\t695.4\t737.807828895909\t13C:1, 37Cl:0, 18O:0, 34S:1, 33S:0\n+Triclosan sulfate (2M-H)\t[2M-H]-\tC12H7Cl3O5S1\t-1\tnegative\t734.8086787279999\t1\t695.4\t737.809082645909\t13C:1, 37Cl:1, 18O:0, 34S:0, 33S:0\n+Triclosan sulfate (2M-H)\t[2M-H]-\tC12H7Cl3O5S1\t-1\tnegative\t734.8086787279999\t1\t695.4\t738.801523945909\t13C:0, 37Cl:1, 18O:0, 34S:1, 33S:0\n+Triclosan sulfate (2M-H)\t[2M-H]-\tC12H7Cl3O5S1\t-1\tnegative\t734.8086787279999\t1\t695.4\t738.802777695909\t13C:0, 37Cl:2, 18O:0, 34S:0, 33S:0\n+Triclosan sulfate (2M-H)\t[2M-H]-\tC12H7Cl3O5S1\t-1\tnegative\t734.8086787279999\t1\t695.4\t738.809973585909\t13C:0, 37Cl:1, 18O:1, 34S:0, 33S:0\n+Triclosan sulfate (2M-H)\t[2M-H]-\tC12H7Cl3O5S1\t-1\tnegative\t734.8086787279999\t1\t695.4\t738.812437485909\t13C:2, 37Cl:1, 18O:0, 34S:0, 33S:0\n+Triclosan sulfate (2M-H)\t[2M-H]-\tC12H7Cl3O5S1\t-1\tnegative\t734.8086787279999\t1\t695.4\t739.802165505909\t13C:0, 37Cl:2, 18O:0, 34S:0, 33S:1\n+Triclosan sulfate (2M-H)\t[2M-H]-\tC12H7Cl3O5S1\t-1\tnegative\t734.8086787279999\t1\t695.4\t739.804878785909\t13C:1, 37Cl:1, 18O:0, 34S:1, 33S:0\n+Triclosan sulfate (2M-H)\t[2M-H]-\tC12H7Cl3O5S1\t-1\tnegative\t734.8086787279999\t1\t695.4\t739.806132535909\t13C:1, 37Cl:2, 18O:0, 34S:0, 33S:0\n+Triclosan sulfate (2M-H)\t[2M-H]-\tC12H7Cl3O5S1\t-1\tnegative\t734.8086787279999\t1\t695.4\t740.798573835909\t13C:0, 37Cl:2, 18O:0, 34S:1, 33S:0\n+Triclosan sulfate (2M-H)\t[2M-H]-\tC12H7Cl3O5S1\t-1\tnegative\t734.8086787279999\t1\t695.4\t740.799827585909\t13C:0, 37Cl:3, 18O:0, 34S:0, 33S:0\n+Triclosan sulfate (2M-H)\t[2M-H]-\tC12H7Cl3O5S1\t-1\tnegative\t734.8086787279999\t1\t695.4\t740.807023475909\t13C:0, 37Cl:2, 18O:1, 34S:0, 33S:0\n+Triclosan sulfate (2M-H)\t[2M-H]-\tC12H7Cl3O5S1\t-1\tnegative\t734.8086787279999\t1\t695.4\t740.809487375909\t13C:2, 37Cl:2, 18O:0, 34S:0, 33S:0\n+Triclosan sulfate (2M-H)\t[2M-H]-\tC12H7Cl3O5S1\t-1\tnegative\t734.8086787279999\t1\t695.4\t741.801928675909\t13C:1, 37Cl:2, 18O:0, 34S:1, 33S:0\n+Triclosan sulfate (2M-H)\t[2M-H]-\tC12H7Cl3O5S1\t-1\tnegative\t734.8086787279999\t1\t695.4\t741.803182425909\t13C:1, 37Cl:3, 18O:0, 34S:0, 33S:0\n+Triclosan sulfate (2M-H)\t[2M-H]-\tC12H7Cl3O5S1\t-1\tnegative\t734.8086787279999\t1\t695.4\t742.795623725909\t13C:0, 37Cl:3, 18O:0, 34S:1, 33S:0\n+Triclosan sulfate (2M-H)\t[2M-H]-\tC12H7Cl3O5S1\t-1\tnegative\t734.8086787279999\t1\t695.4\t742.796877475909\t13C:0, 37Cl:4, 18O:0, 34S:0, 33S:0\n+Triclosan sulfate (2M-H)\t[2M-H]-\tC12H7Cl3O5S1\t-1\tnegative\t734.8086787279999\t1\t695.4\t742.806537265909\t13C:2, 37Cl:3, 18O:0, 34S:0, 33S:0\n+Triclosan sulfate (2M-H)\t[2M-H]-\tC12H7Cl3O5S1\t-1\tnegative\t734.8086787279999\t1\t695.4\t743.800232315909\t13C:1, 37Cl:4, 18O:0, 34S:0, 33S:0\n+Triclosan sulfate (2M-H)\t[2M-H]-\tC12H7Cl3O5S1\t-1\tnegative\t734.8086787279999\t1\t695.4\t744.793927365909\t13C:0, 37Cl:5, 18O:0, 34S:0, 33S:0\n+acetamiprid-N-desmethyl (2M-H)\t[2M-H]-\tC9H9N4Cl1\t-1\tnegative\t415.095871936\t1\t402.6\t415.095871623909\t13C:0, 15N:0, 37Cl:0\n+acetamiprid-N-desmethyl (2M-H)\t[2M-H]-\tC9H9N4Cl1\t-1\tnegative\t415.095871936\t1\t402.6\t416.092906583909\t13C:0, 15N:1, 37Cl:0\n+acetamiprid-N-desmethyl (2M-H)\t[2M-H]-\tC9H9N4Cl1\t-1\tnegative\t415.095871936\t1\t402.6\t416.099226463909\t13C:1, 15N:0, 37Cl:0\n+acetamiprid-N-desmethyl (2M-H)\t[2M-H]-\tC9H9N4Cl1\t-1\tnegative\t415.095871936\t1\t402.6\t417.092921513909\t13C:0, 15N:0, 37Cl:1\n+acetamiprid-N-desmethyl (2M-H)\t[2M-H]-\tC9H9N4Cl1\t-1\tnegative\t415.095871936\t1\t402.6\t417.102581303909\t13C:2, 15N:0, 37Cl:0\n+acetamiprid-N-desmethyl (2M-H)\t[2M-H]-\tC9H9N4Cl1\t-1\tnegative\t415.095871936\t1\t402.6\t418.089956473909\t13C:0, 15N:1, 37Cl:1\n+acetamiprid-N-desmethyl (2M-H)\t[2M-H]-\tC9H9N4Cl1\t-1\tnegative\t415.095871936\t1\t402.6\t418.096276353909\t13C:1, 15N:0, 37Cl:1\n+acetamiprid-N-desmethyl (2M-H)\t[2M-H]-\tC9H9N4Cl1\t-1\tnegative\t415.095871936\t1\t402.6\t419.089971403909\t13C:0, 15N:0, 37Cl:2\n+acetamiprid-N-desmethyl (2M-H)\t[2M-H]-\tC9H9N4Cl1\t-1\tnegative\t415.095871936\t1\t402.6\t419.099631193909\t13C:2, 15N:0, 37Cl:1\n+acetamiprid-N-desmethyl (2M-H)\t[2M-H]-\tC9H9N4Cl1\t-1\tnegative\t415.095871936\t1\t402.6\t420.093326243909\t13C:1, 15N:0, 37Cl:2\n'