Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Spectra::plotSpectra and PSMatch::addFragments #346

Open
4 tasks
guideflandre opened this issue Jan 21, 2025 · 2 comments
Open
4 tasks

Improve Spectra::plotSpectra and PSMatch::addFragments #346

guideflandre opened this issue Jan 21, 2025 · 2 comments

Comments

@guideflandre
Copy link

guideflandre commented Jan 21, 2025

I am currently working on PTMs and variable modifications are a key aspect I wish to include in my workflow.
As of the latest PR in PSMatch, calculateFragments now also measures a sequence's mass with variable modifications (see this PR).

However, currently, addFragments and plotSpectra as well as plotSpectraOverlay and plotSpectraMirror do not support such modifications. There is also an error to be fixed with addFragments not allowing custom parameters when multiple spectra are called (see issue here).

Taking into account the already mentioned potential for optimised plots (see this [issue]), I revisited plotSpectra and addFragments to include:

  • A Universal Spectrum Identifier
  • Fragmented sequence (with dividers) similar to the plots in this paper
  • Enable variable modifications
  • Different ion types
  • Color coded annotations
  • Allow multiple plots with/without modifications (fix addFragments issue mentioned above)
  • fix issues with par() going off when multiple plots are called
  • Remove the redundant title (now in the USI) and reduce the unused space

The results look like this:

  • A simple annotated plot: plotSpectra2(bulk[504], labels = addFragments2(bulk[504], type = c("a", "b", "y")), main = "A first example")

Image

  • One single spectrum with variable moidifications: plotSpectra2(sc[532], labels = addFragments2(sc[532], variable_modifications = c(D = 5)))

Image

  • Multiple plots with specific variable modificationplotSpectra2(sc[532:534], labels = addFragments2(sc[532:534], variable_modifications = c(D = 5)))

Image

  • Fixed modifications can still be used (in the same way modifications parameter was used before.

The plotting function I generated is fully functional, but is still only specific to plotSpectra, not adaptable to plotSpectraMirror and plotSpectraOverlay - see sub-issue #347
I am thus asking for your input: are these new plot versions interesting/useful to your average user ? If it is, are there any elements I should remove/add ? Should I do a PR to add a new plotting function that accepts modifications or should the goal be to replace the whole plotting environment ? In the case of plotSpectraOverlay, where do I put the USI/fragmented sequence ? In plotSpectraMirror : what happens if there are multiple modifications for one spectrum ? A lot of questions arise and I wonder if it's worth developing this for an average user ?

In any case, to fix the current errors mentioned above, a new version of addFragments and plotSpectra functions is needed. There is very little modification necessary to the code, but addFragments should constantly provide a list of named elements (name = peptide with or without modification) and an attribute linking the annotation to the initial spectrum it belongs to. I have the code ready and I can generate a PR for this separately as well. This would not include modifications, but it would fix the error from this issue.

@lgatto @sgibb @jorainer

@lgatto
Copy link
Member

lgatto commented Jan 22, 2025

@jorainer - this is a rather important new feature, that started in PSMatch, i.e. the computation, handling and visualisation of peptides with variable post-translational modifications. I suggest to split this issue into two parts: one dealing with the update in plotSpectra() to handle the use-cases, and a second one with the other plotSpectraMirror() and plotSpectraOverlay(). I think these can be handled independently or one after another.

@jorainer
Copy link
Member

I'm a bit lost here and would maybe need more information what type of information you need to store or what the new functionality returns. Specifically, I'm wondering if it would not be possible to add the results of the calculations as new spectra or peaks variables to the Spectra that could then be extracted and visualized by the functions passed with parameter labels in the plotSpectra() function?

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

No branches or pull requests

3 participants