Skip to content

Add default charge up to precursor charge in plotSpectraPTM#44

Merged
lgatto merged 16 commits into
rformassspectrometry:mainfrom
guideflandre:plotSpectraPTM
May 20, 2026
Merged

Add default charge up to precursor charge in plotSpectraPTM#44
lgatto merged 16 commits into
rformassspectrometry:mainfrom
guideflandre:plotSpectraPTM

Conversation

@guideflandre
Copy link
Copy Markdown
Collaborator

Following a discussion with @lgatto, we thought it would be interesting to include a charge parameter in plotSpectraPTM.

By default, the charge used to be set to 1, which missed quite a few fragments when the charge state of the precursor ion is higher than 2. Thus instead of having to manually include the charge state, a simple (big !) improvement is to set the default charge state a spectrum instance to be 1:precursorCharge(x).

It does make a huge difference and it integrates well with the variable modifications by allowing a list (or not) of charge values passed to labelFragments(). I believe this is the most straight-forward way to include the charge state in the spectra.

I bumped the version to 1.17.1 since there has been a devel update and I updated the NEWS

@guideflandre guideflandre marked this pull request as draft May 8, 2026 14:44
@guideflandre guideflandre marked this pull request as draft May 8, 2026 14:44
There was an error because I changed the USI source for charge which
should be the precursorCharge by default in a spectra object.
Comment thread R/fragments-label.R Outdated
Comment thread R/plotSpectra-PTM.R Outdated
@guideflandre
Copy link
Copy Markdown
Collaborator Author

I have made a couple changes:

  1. Both plotSpectraPTM and labelFragments now have a z and allCharges parameter.
  2. The user can input a custom numeric vector with charge states for every spectrum provided. By default, z = NULL and allCharges = TRUE. With allCharges = TRUE, the fragments are calculated with charge states of 1 to the given charge OR, if z = NULL, to the precursor charge. If allCharges = FALSE, only the provided charge state is calculated.
  3. The user cannot provide a custom charge while simultaneously asking for variable modifications in plotSpectraPTM as its length would not be the same.

Either way, the default options are most likely going to be used: all fragments with charge states 1:precursorCharge(x).

@guideflandre
Copy link
Copy Markdown
Collaborator Author

And I added the PSMatch logo to thje README for better visibility

@guideflandre guideflandre marked this pull request as ready for review May 19, 2026 13:59
@lgatto lgatto merged commit ff1b83c into rformassspectrometry:main May 20, 2026
1 of 2 checks passed
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.

2 participants