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

Update plotSpectra environment to allow addFragments returned list #348

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

guideflandre
Copy link

This PR is linked to this PSMatch issue and the discussed topics in #346

The motivation for this PR:

  1. addFragments used to throw an error when multiple spectra where called
  2. The new variable_modifications parameter necessitated a new addFragments function to distinguish annotations

The solution:
addFragments now returns a list of named elements (peptide sequence that includes modifications) containing a character() vector with the annotations. Each element of the list has an attribute linking the annotations to the spectrum it belonged to. In Spectra, the changes are located at the level of the presence of labels. It is assumed that most often than not, addFragments is called for labels. A quick check for variable modifications is also added (as plotSpectra doesn't support them yet). All three functions (plotSpectra, plotSpectraMirror and plotSpectraOverlay now support the version of addFragments in this PR).

This PR can only be accepted if the corresponding PR in PSMatch is accepted !! Otherwise, plotSpectra won't work.

Copy link
Member

@jorainer jorainer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I have however some questions.

@jorainer
Copy link
Member

General comment: I don't know your specific use case, but would it not be possible to add whatever information/annotation you have or calculate directly to the Spectra object (as peaks or spectra variables) before plotting and then have a labels() function that can extract that information (or that even calculates it on the fly)? that was also the initial idea of accepting a function with parameter labels.

@guideflandre
Copy link
Author

General comment: I don't know your specific use case, but would it not be possible to add whatever information/annotation you have or calculate directly to the Spectra object (as peaks or spectra variables) before plotting and then have a labels() function that can extract that information (or that even calculates it on the fly)? that was also the initial idea of accepting a function with parameter labels.

I believe we could if the number of annotations don't exceed length(x). In my use case, with variable modifications, I would have multiple annotations/spectrum which is not ideal.

@guideflandre
Copy link
Author

A discussion with Laurent led to a potential different idea: the creation of a package specifically for plotting spectra. I understand my use cases might not fit in well within the plotSpectra environment, and it might need its separate function/package. I believe this should be an option/discussed too.

@lgatto
Copy link
Member

lgatto commented Mar 6, 2025

@jorainer - we need to move on with this issue to be able to merge the new PSMatch functionality. Do we need another discussion.

@guideflandre guideflandre reopened this Mar 7, 2025
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.

3 participants