Searching with Retention Index - Options for Polar Columns


One problem I've run into and I've noticed others have run into who have posed this question is the inability to search polar column retention index (RI) from the NIST library using Unknowns Analysis (or other MassHunter) software. It only gives the semi-standard non-polar RI values. 

I've been exploring multiple options to work around this. But I keep hitting road blocks. I am currently using MassHunter Quant version 10.2. NIST version 20. I would like to go over the various options I've considered to try and decide best way to tackle this problem. 

1- Use AMDIS package provided by NIST software. AMDIS has ability to search NIST library for the 3 column types listed above. But I cannot open MassHunter files in ADMIS version 2.73. 

2- Create a custom library in Library Editor software with polar column retention indices instead of semi-standard non-polar. There are a few ways of going about this.

I can open the NIST20.L file in Library Editor. It lists the semi-standard non-polar retention index files. 

The problem is I can't edit these entries and I can't save the file as another file that I can edit. When I try to save the NIST.L as something else I get the following error: 

I can try to copy all the entries in NIST20.L file and paste it into a new Library but then I get this error: 

It would be helpful to know what this limit is. Then we can narrow down this list. We don't necessarily need all entries in the NIST library. A few thousand compounds we are focused on would be sufficient. 

Regardless even if I could copy over hundreds or thousands of compounds and their spectra I would still have to replace the retention index value with the polar column values. Doing this manually is very time consuming so I've looked into using the Run Script option in the Library Editor software. 

I found a video in the videos provided by Agilent called "Software Development Kit19 - Import Retention Indices - Expert.mp4" that imports retention index into Library Editor from a CSV file. The script file is called: 

I can't find this script in any of the files in the D:\MassHunter\Scripts folders. Is there anywhere we can find this script? Or is there any other common script template for Library Editor we can work off?

Even if I could get the script to work I am left with a few problems. I still have to get the MS data from the NIST library (or other source) into Library Editor. Then replace retention index. I can't figure out how to export retention index from NIST into a CSV format.

Thanks for any help. 

  • Hello  ,

    First let me preface this by saying that the option to choose Retention Index Type from NIST is present in Quant 12.1, though it is currently not working as intended. Fixes to the current issues should be available in the next release of Quant, though there is no timeline for when this will be available. Until that is available, I will address your questions below.

    I can't speak to AMDIS options or possibilities. You may be able to reach out to NIST about the options available there.

    As far as copying the complete NIST to an editable library, a colleague of mine determined that it may take upwards of 2,000 copy/pastes to accomplish this. Even if you could manage to do this, the resulting .xml library would be so large that it would most likely be unusable with the library editor. 

    You will need to find a way to just export/copy over the entries of interest and then update the RIs. While you can make libraries directly from UA, it will use the component spectrum for the library entry. If this is not desirable, you could export your UA components to a quant method instead of a library. Then use quant's ability to create a reference library for the method using a Lookup Library. This way you can use the NIST spectrum for your compounds of interest. 

    I understand that even if it were possible to create the libraries directly from UA and NIST this would be less than ideal, but it is the only option I can suggest at this time.

    As for the script to import RIs, from what I can find the code was never included on the quant media. It appears the video lesson was provided as an example of writing a script, with the actual entering of the code left to the user. I have transcribed the code only (no comments) and attached it and an example CSV to this post. This is provided as-is. In limited testing it worked on my system to update the RIs of the first four compounds in the demo.mslibrary.xml file. I would suggest making backups of any libraries that you attempt to update using this code. 

    You will need to verify the installation location of your IronPython and also update the location/file name for the CSV file. In both the video and my example the file is on the current user's desktop.

    Once downloaded change the extensions to .py and .csv. I also include a screen capture from the video for reference.

    import sys
    import System
    import clr
    import _commands
    clr.AddReference("AppCommandContext"), clr.AddReference("QuantUIScriptIF")
    clr.AddReference("QuantUIScriptIFImpls"), clr.AddReference("System.Windows.forms")
    sys.path.append('C:\Program Files (x86)\IronPython 2.7')
    sys.path.append('C:\Program Files (x86)\IronPython 2.7\Lib')
    from Agilent.MassSpectrometry.DataAnalysis.LibraryEdit.Commands import CompoundProperty
    import csv
    import System.Windows.Forms as WinForms
    with open('C:\Users\cse\Desktop\RIKey2.csv') as csvfile:
        reader = csv.DictReader(csvfile)
        for row in reader:
    for i in range(countO):
        CidO = LibraryAccess.GetCompoundId(i)
        CASO = LibraryAccess.GetCompoundProperty(CidO, "CASNumber")
        CNO = LibraryAccess.GetCompoundProperty(CidO, "CompoundName")
        if CASO in CASsN:
            _commands.SetCompoundProperty(CidO, "RetentionIndex", RIvalue)
    "Number of Compounds in Library: " + str(countO) + "\n" +
    "Number of RI's updated: " + str(countMatch) + "\n" +
    "Compounds not updated: " + str(NotUpdated) , "Summary" )
    Methyl palmitate,112-39-0,4

  • Hi Howard, 

    Thank you for your detailed response.

    I did recently install Quant 12.1. I do not know where to look for the option to choose Retention Index Type from NIST? Glad to hear its something that will hopefully be updated in the future. 

    Thanks for providing the text file for the script. We will look into it and see if we can make adjustments as needed. I tested it out:

    You will need to find a way to just export/copy over the entries of interest and then update the RIs. While you can make libraries directly from UA, it will use the component spectrum for the library entry. If this is not desirable, you could export your UA components to a quant method instead of a library. Then use quant's ability to create a reference library for the method using a Lookup Library

    Do you know where I can find more information on using Quants ability to create reference library using a Lookup Library? 

  • Hello  ,

    The RI Type setting is only available in the Advanced method edit view. It is on the Library tab about halfway over.

    There are some videos available in the supplemental section that discuss reference libraries. I will attempt to summarize here. 

    First you need to have your quant method set up with all of the desired targets. In your case this can come from UA. Once in the quant Method Editor, choose Setup Reference Library. In this dialog you can specify where to create the library and where the spectrum should come from. You can either use the spectrum from the standard you brought into the Method Editor or use a Lookup Library, like NIST. It will pick the spectrum based on the CAS number and compound name of each target.

    Unfortunately you cannot append to existing libraries like you can in UA, but you can at least get the spectrum from NIST. Reference libraries have a special function in quant, but they can be used in qual and UA just like any other library. You should be able to copy compounds from one library and append to another and slowly build your NIST subset with polar RI values. 

    If you then want to use the reference library in quant to calculate a match score, specify it in your Globals Setup.

    When the batch is analyzed, each peak's extracted spectrum is compared to the corresponding reference spectrum and a match score is calculated. This is not a search, but rather a comparison to the target's expected spectrum that can be used to provide greater confidence in verifying your target. Note that in the latest versions of quant you must enter a value in the Library Match Score Minimum outlier for the Library Match Score to be calculated. If you don't care about having this flagged, then just enter zero.

  • Hi Howard, 

    Thank you for your informative response. I tested the Retention Index Type feature in Unknowns Analysis (Quant version 12.1). Its partially working!

    For example:

    If I set the column to standard - polar and search the NIST library it will return a RI value from the standard - polar column if a standard - polar value is present in the NIST library entry for that compound. If there is no standard - polar column entry but there is a semi-standard non-polar entry it will report the semi-standard non-polar entry. If there are no experimental RI values but there is a estimated or AI predicted RI it will return those values. If there is no value at all it won't show anything. 

    It would be helpful if I could see what column type the result is pulling from so I can ignore RI from a different column type or estimated / AI predictions. Usually the RI value is so far off its obvious but still it would help to know without having to manually check the NIST. I tried looking through the add/remove columns settings in Unknown Analysis method settings. If I add Retention Index Type column it will just return the value that I put into the methods Library Search parameters (e.g., Standard_Polar). 

    Is there any add/remove column option that would show this result? Can I make a User Defined option for this? If so how do I set those? 

    Thanks for explanation of Reference Libraries in Quant. I will look into this more and see how it can help us. Often I prefer a Library Match score instead of Qualifiers for the compounds I am dealing with as they are relatively low mass and tend to have similar series of fragmentation ions. 

  • Hello  ,

    There is no workaround for the current issues with RI Type method setting behavior. The current recommendation is to not utilize this feature.

    There is not a column to show which RI type was extract since it should only extract the RI Type defined in the method. This is the current issue and the one that should be resolved in the next release.

  • Still an improvement from before! Looking forward to next release. Thank you. 

Was this helpful?