MassBank / MassBank-web

The web server application and directly connected components for a MassBank web server
13 stars 22 forks source link

Add SQL view for precursor m/z #300

Open meowcat opened 3 years ago

meowcat commented 3 years ago

In the current database scheme, the msms_spectrum view contains precursor_mz_text. However, the view can't be cached because of subselects, and the precursor is in text format. To rapidly select viable candidates via SQL (see https://github.com/rformassspectrometry/MsBackendMassbank/issues/28) I am proposing this one:

CREATE VIEW msms_precursor 
AS 
SELECT RECORD AS spectrum_id, CAST(MS_FOCUSED_ION.VALUE AS DOUBLE) AS precursor_mz 
from MS_FOCUSED_ION 
WHERE 
    MS_FOCUSED_ION.SUBTAG = 'PRECURSOR_M/Z' AND 
    MS_FOCUSED_ION.VALUE NOT LIKE "% %" AND 
    MS_FOCUSED_ION.VALUE NOT LIKE "%/%"

The exclusion criteria are what is currently needed to get rid of records that don't cast properly, like MS3 cases and two very strange ones that list many values

https://massbank.eu/MassBank/RecordDisplay?id=PT100763 https://massbank.eu/MassBank/RecordDisplay?id=PT102460 MS$FOCUSED_ION: PRECURSOR_M/Z 590.4495 1.315 590.0900 7.802 589.9528 1.134 444.0505 2.504

sneumann commented 3 years ago

Those precursors look like a combination of all possible precursors falling into the isolation window. Just imagine what that would look like in the case of SWATH ... So mzML has specified in http://www.peptideatlas.org/tmp/mzML1.1.0.html#precursorList that there is either one isolation window, or selectedIonList of multiple ions (i.e. as above). We could request (and most submitters interpretetd it that way) that the MassBank record knows which ion resulted in the spectrum. Especially for known compounds. In that case the numeric precursor information makes sense. Yours, Steffen