Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 12, 2025

Adds five adduct options to positive ion mode as specified in the enviPat adduct table: M+ (molecular ion), M2+ (doubly charged), M-H+ (deprotonated cation), M+Na (sodium), and M+NH4 (ammonium).

Changes

  • isolib.R: Added custom adduct definitions for M2+ and M-H+ (M+, M+Na, M+NH4 already exist in enviPat)

    • Definitions follow enviPat's 9-column format: Name, calc, Charge, Mult, Mass, Ion_mode, Formula_add, Formula_ded, Multi
    • Fixed formula modification logic that incorrectly assumed positive mode only uses Formula_add
  • isolib.xml: Added 5 adduct options to positive mode dropdown, updated version to 2.6+galaxy4

  • Tests: Added 5 test cases covering M+Na, M+NH4, M2+, M-H+, and multiple adducts

Bug Fix

The original logic caused hangs for positive mode adducts requiring formula deduction:

# Before: Positive mode always called mergeform
if (adduct$Ion_mode == "negative") {
    merged_chemforms <- enviPat::subform(...)
} else {
    merged_chemforms <- enviPat::mergeform(...)  # M-H+ failed here
}

# After: Check deduction first, independent of ion mode
if (adduct$Formula_ded != "FALSE") {
    merged_chemforms <- enviPat::subform(...)
} else if (adduct$Formula_add != "FALSE") {
    merged_chemforms <- enviPat::mergeform(...)
} else {
    merged_chemforms <- multiplied_chemforms
}

M-H+ requires deducting H in positive mode, which the original code couldn't handle.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cran.r-project.org
    • Triggering command: /usr/bin/curl curl -L -s REDACTED (dns block)
  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https /usr/lib/apt/methods/https (dns block)
  • rdrr.io
    • Triggering command: /usr/bin/curl curl -s REDACTED (dns block)
  • search.r-project.org
    • Triggering command: /usr/bin/curl curl -s REDACTED (dns block)
  • wheels.galaxyproject.org
    • Triggering command: /home/REDACTED/.planemo/gx_venv_3/bin/pip pip install -r requirements.txt --index-url REDACTED --extra-index-url REDACTED a| _artifacts/r-bascommit 64| sh amic�� config DYLIB_EXT onda/envs/isolib_test/bin/sed |g share/miniconda/-p da/feedstock_root/build_artifact-fopenmp URCE=2 -O2 -isystem /usr/share/miniconda/envs/i (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>isolib: provide more adduct options</issue_title>
<issue_description>Add more adduct options to the positive ion mode ([M]+, [M]2+, [M-H]+, [M+Na]+, [M+NH4]+) - all of these adducts have to be part of the table in https://rdrr.io/cran/enviPat/man/adducts.html

These have to be added in the Galaxy tool wrapper.

From the initial discussions, we concluded that it will be easiest to add the adducts manually for now and to have it fit the form of the enviPat adduct table, which has the following row layout:

Name                    calc                    Charge      Mult         Mass              Ion_mode     Formula_add Formula_ded Multi
2M+3H2O+2H     M+28.02312      1              2              28.02312000  positive        H8O6            FALSE           2

</issue_description>

<agent_instructions>make sure to also include a test for some of the more complex new adducts</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@acquayefrank For negative options, ask Elliot or Stepan.

Note that some options may not be supported.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add more adduct options to positive ion mode Add M+, M2+, M-H+, M+Na, M+NH4 adduct options to positive ion mode Dec 12, 2025
Copilot AI requested a review from hechth December 12, 2025 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

isolib: provide more adduct options

2 participants