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

Detect centroiding in <dataProcessing> tag #301

Open
skinnider opened this issue Nov 23, 2024 · 1 comment
Open

Detect centroiding in <dataProcessing> tag #301

skinnider opened this issue Nov 23, 2024 · 1 comment

Comments

@skinnider
Copy link

The attached file HILIC_CON_BASA_567795.mzXML (from MTBLS103) contains centroided MS spectra:

  <dataProcessing centroided="1">
   <software type="conversion" name="trapper" version="4.3.1 (build Sep  9 2009 12:29:13)" />
  </dataProcessing>

However, because the centroided attribute is not set for every <scan> tag individually, but instead is set just once for the entire experiment in <dataProcessing>, mzR does not detect that these are centroided spectra:

> dat = Spectra("HILIC_CON_BASA_567795.mzXML", source = MsBackendMzR())
> table(spectraData(dat)$centroided)

FALSE
  768

In comparison, C18_CON_BASA_688344.mzXML from the same accession has the centroided attribute set for every individual spectrum and mzR correctly detects that these are all centroided spectra.

Is there a workaround for this, to detect that the HILIC file does indeed contain centroided spectra?

Files (too big for upload):
C18_CON_BASA_688344.mzXML
HILIC_CON_BASA_567795.mzXML

@lgatto
Copy link
Collaborator

lgatto commented Nov 23, 2024

There's an isCentroided() method from the Spectra that will estimate the mode from the spectra. Here's the relevant extract from ?isCentroided:

        • ‘isCentroided()’: a heuristic approach assessing if the
          spectra in ‘object’ are in profile or centroided mode. The
          function takes the ‘qtl’th quantile top peaks, then
          calculates the difference between adjacent m/z value and
          returns ‘TRUE’ if the first quartile is greater than ‘k’.
          (See ‘Spectra:::.isCentroided()’ for the code.)

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

2 participants