Skip to content

Add mass spectra centroidisation#2704

Merged
eselmeister merged 4 commits intoeclipse-chemclipse:developfrom
Mailaender:centroiding
Feb 12, 2026
Merged

Add mass spectra centroidisation#2704
eselmeister merged 4 commits intoeclipse-chemclipse:developfrom
Mailaender:centroiding

Conversation

@Mailaender
Copy link
Contributor

This converts profile to centroided spectra based on detected peaks. Oftentimes this process means peak picking and then converting the spectra in one go, but I want to separate the two as we may want to try multiple peak picking algorithms. I also want people to preview the picked peaks on the profile spectrum to judge the result. Centroidization will then also be an additional, destructive, shared step. We already have process methods to orchestrate everything into one again.

if(processingInfo.hasErrorMessages()) {
return processingInfo;
}
if(scanMSD instanceof IStandaloneMassSpectrum massSpectrum) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't you use XPassFilter.nominalize(...); here?

Copy link
Contributor Author

@Mailaender Mailaender Feb 12, 2026

Choose a reason for hiding this comment

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

Because this is designed for MALDI-ToF MS. Nominalizing would remove all the precision. Also, if you want to nominalize beforehand, you could just run that filter separately. It does not make sense to combine the two.

}
massSpectrum.removeAllIons();
for(IMassSpectrumPeak massSpectrumPeak : massSpectrum.getPeaks()) {
IIon ion = new Ion(massSpectrumPeak.getIon(), (float)massSpectrumPeak.getAbundance());
Copy link
Contributor

Choose a reason for hiding this comment

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

The above XPassFilter does the trick already. If not used, getIon() could return a double with decimals here, that needs to be casted to Integer e.g. via AbstractIon.getIon(mz). But then it needs to be checked, that the intensities of e.g. 56.12 and 56.16 are summed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't want to round ions here. Just convert profile to centroid. The centroided one can then be used for identification next step.

@eselmeister
Copy link
Contributor

OK, I got it.

@eselmeister eselmeister merged commit fb919bf into eclipse-chemclipse:develop Feb 12, 2026
3 checks passed
@Mailaender Mailaender deleted the centroiding branch February 12, 2026 10:32
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