rformassspectrometry / Spectra

Low level infrastructure to handle MS spectra
https://rformassspectrometry.github.io/Spectra/
34 stars 24 forks source link

Add support for peak annotations #287

Closed jorainer closed 1 year ago

jorainer commented 1 year ago

Spectra supports adding/changing spectra variables but there is only limited support for peaks variables. Some backends (SQL-based backends) support extracting additional peaks variables/annotations from the database and provide these as additional columns in peaksData. Also, the MsBackendMemory supports additional peaks variables that are stored internally in a data.frame.

Since peaksData returns a list of matrix, adding character peak annotations is not possible. Thus, one suggestion would be to have an (additional) peaksDataFrame function that returns the data for requested peaks variables as a data.frame and peaksDataFrame<- would support changing/updating/adding peaks variables. Alternatively, we could have a peaksAnnotation function that returns peak annotations (everything except the m/z and intensity values).

Note: support for peak annotations/variables will also need some way to ensure data does not get corrupted when peak matrices are filtered with functions such as filterMzValues or filterMzRange that reduce the number of peaks.