Skip to main content
Topic: Export alignment results to .MSP file with retention time, S/N, etc. information (Read 4216 times) previous topic - next topic

Export alignment results to .MSP file with retention time, S/N, etc. information

Dear Hiroshi and MS-DIAL developers,

Thank you very much for your great effort in developing and maintaining MS-DIAL. I am thinking if it is possible to export alignment results (representative spectra) to MSP files together with metadata, e.g. retention time, S/N, etc. MS-DIAL has a very good option to search against MS libraries though, it is a little bit tricky when searching against NIST as well as Wiley libraries because they don't have RI information suitable for MS-DIAL. After identified by MS-DIAL, I still have to check each identification using RI information. For me, it is more convenient to use the NIST MS Search. However,  the .MSP file exported from MS-DIAL does not contain metadata, retention time, S/N, etc., and it is a little bit tricky to correspond MSP entry to the peak spot. Is it possible to incorporate metadata, especially retention time, when exporting the alignment results (representative spectra) into .MSP file?

Kind regards,
Qizhi Su

Re: Export alignment results to .MSP file with retention time, S/N, etc. information

Reply #1
Hi,

I very much agree and support the request of Qizhi Su.
I like the high-res quality of the .msp spectra export from MS-DIAL. But it would be very helpful to have some metadata information, to place at least as "Name": e.g.  Unknown ID n.1, n.2 etc. Also Retention time would be great.

Thank you! 

Stefano

Re: Export alignment results to .MSP file with retention time, S/N, etc. information

Reply #2
Hi,

msdial has already exported retention time and retention index fields as well, but nist ms search program did not recognize the files.
I learned the field definition from https://www.nist.gov/system/files/documents/srd/NIST1aVer22Man.pdf, then, I modified the exporter. Here, you can see retention time and retention index in comment field, and maybe, the retention index is used for searching candidates in nist ms search program.

Hiroshi

 

Re: Export alignment results to .MSP file with retention time, S/N, etc. information

Reply #3
Ah, OK, so now you modified the exporter so from the next version RT / RI are recognized? That would be awesome
Please add also a new "ID" in front of them, which helps the comparison. Thanks!

At the moment, one can fix it in python like this:

Before the new version is out, if someone is using python, I fix it like this:
(it will create a new file with the "Align ID)

data = open('spectra_test_MS-DIAL.msp', 'r')
data_new = open('spectra_test_MS-DIAL_new.msp', 'w')

counter=0
for line in data:
    stuffinline = line.split()
   
    if stuffinline != []:
        first_element = stuffinline[0]
        second_element = stuffinline[1]
        if first_element == "NAME:":
            counter+=1
            second_element_new = "Aligned ID #" + str(counter)+ " - " + second_element + "\n"
            line = first_element + second_element_new
   
    data_new.write(line)

Re: Export alignment results to .MSP file with retention time, S/N, etc. information

Reply #4
Hi  Hiroshi,
I don't understand why I have only retention index but no retention time information in the comment field.

In addition, I still have some question about MS-DIAL
1. It seems that we can only export all alignment peaks but not filtered results except for the blank subtraction. For example, sometimes, I only want to export those "annotated" results or only those most intensive peaks but not all.
2. Can we export alignment results from the alignment table after applying for example comment filter?
3. Some entries in my library do not have RI information, but I use RI for scoring for the identification, is it possible that a candidate with a very high spectral match will get a very low score because of the lack of RI information?

Qizhi Su

Re: Export alignment results to .MSP file with retention time, S/N, etc. information

Reply #5
Thank you very much Spapaz for contributing your Python source code to deal with this problem.
But  I think Alignment ID has already been in the MSP file exported from MS-DIAL (see the attachment). My problem is that the Alignment ID in the exported text, e.g. signal to noise information, is different from that in the MSP file. Exported texts keep original Alignment ID obtained in the MS-DIAL alignment process, while MSP creates new Alignment ID when exporting MSP file. For example, when looking at the text file (attachment 2), ID 7 is missing, because it has been removed by blank subtraction; while looking at the former attachment, Alignment ID contains 7, which means it might renew the ID number in the MSP file. I guess the problem is that I used blank subtraction when exporting MSP. Hence, the re-created Alignment ID is different from the original one.

kind regards
Qizhi Su 

Re: Export alignment results to .MSP file with retention time, S/N, etc. information

Reply #6
Hi, see my answers below.:)

1. It seems that we can only export all alignment peaks but not filtered results except for the blank subtraction. For example, sometimes, I only want to export those "annotated" results or only those most intensive peaks but not all.
2. Can we export alignment results from the alignment table after applying for example comment filter?

-> For these two questions, there is no function for these yet. And I should put them on our to do list.

3. Some entries in my library do not have RI information, but I use RI for scoring for the identification, is it possible that a candidate with a very high spectral match will get a very low score because of the lack of RI information?

-> If you check "Use RT/RI for scoring" for the identification process while there is no RI information or the RI field has negative value (like -1), only EI-MS similarity score is used as the total score. On the other hand, if there is an RI information, the total score is calculated by integrating RI/RT similarity and EI-MS similarity scores like:

public static double GetTotalSimilarity(double rtSimilarity, double eiSimilarity, bool isUseRT)
{
            if (rtSimilarity < 0 || !isUseRT) // isUseRT is true when use RI/RT information for scoring is checked
            {
                return eiSimilarity;
            }
            else
            {
                return (0.6 * eiSimilarity + 0.4 * rtSimilarity);
            }
}


4. My problem is that the Alignment ID in the exported text, e.g. signal to noise information, is different from that in the MSP file. Exported texts keep original Alignment ID obtained in the MS-DIAL alignment process, while MSP creates new Alignment ID when exporting MSP file.

-> sorry, I fixed the issue in my source code. And  you can find those meta data information in the exported MSP from the next version.

Hiroshi

Re: Export alignment results to .MSP file with retention time, S/N, etc. information

Reply #7
Perfect!
Thank you very much, Hiroshi!