Skip to content

Commit ac51302

Browse files
Copilothechth
andauthored
isolib: strip terminal polarity markers from formulas before isotopic parsing (#758)
* Initial plan * Handle polarity symbols in isolib formulas * Refine polarity stripping to terminal charge markers * Cover additional terminal charge notation forms * Restrict polarity stripping to sign-led suffixes * Update isolib version from galaxy3 to galaxy4 * Modify output structure for isotope library test * Change expected column count from 4 to 9 * Update expected line count in isotope_library output --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Helge Hecht <helge.hecht@recetox.muni.cz>
1 parent 1a6a307 commit ac51302

3 files changed

Lines changed: 26 additions & 1 deletion

File tree

tools/isolib/isolib.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ parse_args <- function() {
4646

4747
# Extract selected columns
4848
compound_table <- compound_table_full[, intersect(c("name", "formula", "rt"), colnames(compound_table_full)), drop = FALSE]
49+
compound_table$formula <- stringr::str_remove(
50+
compound_table$formula,
51+
"\\s*[+-]\\d*$"
52+
)
4953

5054
# Extract remaining columns
5155
remaining_columns <- setdiff(colnames(compound_table_full), colnames(compound_table))

tools/isolib/isolib.xml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<tool id="isolib" name="isolib" version="2.6+galaxy3" profile="23.0" license="MIT">
1+
<tool id="isolib" name="isolib" version="2.6+galaxy4" profile="23.0" license="MIT">
22
<description>create an isotopic pattern library for given compounds and adducts based on enviPat</description>
33
<creator>
44
<person
@@ -236,6 +236,21 @@
236236
</conditional>
237237
<output name="isotope_library" file="test9.tsv" ftype="tabular"/>
238238
</test>
239+
<!-- Test 11: Formulas with polarity symbols -->
240+
<test>
241+
<param name="input_file" value="markers_no_rt_polarity.tsv"/>
242+
<param name="formatting|out_format" value="tabular"/>
243+
<conditional name="rel_to">
244+
<param name="value" value="1"/>
245+
<param name="threshold" value="1.0"/>
246+
</conditional>
247+
<output name="isotope_library">
248+
<assert_contents>
249+
<has_n_columns n="9"/>
250+
<has_n_lines n="20" delta="2"/>
251+
</assert_contents>
252+
</output>
253+
</test>
239254
</tests>
240255
<help><![CDATA[
241256
This tool computes isotopic patterns for given compounds and adduct forms.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
formula name
2+
C8H6Cl2O3+ 2,4-Dichlorophenoxyacetic acid ou 2,4-D
3+
C9H15N3O1- 2-diethylamino-6-methyl pyrimidin-4-ol/one
4+
C5H2Cl3N1O1+ 3,5,6-Trichloro-2-pyridinol
5+
C13H10O3- 3-phenoxybenzoic acid
6+
C13H9FO3+ 4-Fluoro-3-phenoxybenzoic acid

0 commit comments

Comments
 (0)