Using Quant, how do I average properties like RT, area, and ion ratio?

Setup: I have a 1260 with auto sampler feeding a 6495 using 7.0 for acquisition and data analysis.

Goal: Average properties like RT, Area, and ion ratio for successive injections using Quantitative Analysis.

Example: From the following injection sequence, I'd like to calculate the average and standard deviation of the RT, peak area response, and ion ratio between my target and qualifier ions for the Precision and Low/Med/High Accuracy sample groups. I can do this with Excel by exporting a CSV but I'd rather set up a Quant method and PDF reporting to perform this to minimize the amount of data interpretation.

 

How do I average properties of successive injections?

 

23 JUN 2020 Edit: It looks like there is the ability to run scripts and expressions as part of the report builder using Python for .NET; Are there any examples available of expressions or scripts that I can use to write my own? Nothing comes up immediately when I searched.

I did find the Report Builder Familiarization guide available here. Is there anything else describing the types of variables that are available or any sort of debugging environment?

 

 

InjectionDescription

Nominal

Concentration

Sample

Group

1

Blank

0Blanks
2Precision 1100Precision
3Precision 2100Precision
4Precision 3100Precision
5Precision 4100Precision
6Precision 5100Precision
7Precision 6100Precision
8Precision 7100Precision
9

Precision 8

100Precision
10Precision 9100Precision
11Blank0Blanks
12Accuracy 150Accuracy Low
13Accuracy 250Accuracy Low
14Accuracy 350Accuracy Low
15Blank0Blanks
16Accuracy 4100Accuracy Med
17Accuracy 5100Accuracy Med
18Accuracy 6100Accuracy Med
19Blank0Blanks
20Accuracy 7150Accuracy High
21Accuracy 8150Accuracy High
22Accuracy 9150Accuracy High
23Blank0Blanks
24Linearity 115Linearity
25

Linearity 2

30Linearity
26Linearity 345Linearity
27Linearity 460Linearity
28Linearity 575Linearity
29Linearity 690Linearity
30Linearity 7105Linearity
31Linearity 8120Linearity
32Linearity 9135Linearity
34Linearity 10150Linearity
35Blank0Blanks
  • Hello ,

     

    The documentation you are looking for is installed with the SDK (Software Development Kit), as noted in the last post here. The Data Set manuals contain information on how data is stored within the quant database.

     

    Example expressions for Report Builder can be found in most of the shipping templates. Those are the only examples I'm aware of. Check in the result table cells as most reports have at least one expression.

     

    I have attached some example Python/SDK based reports that perform averaging using Sample Groups, though not for all of the results you mention. I will update this if I find more examples.

    RSD Python reports.zip
  • Hi,

     

    a

    If you're interested in direct PDF reporting with Python you might find this custom report I made some time ago interesting. This report calculates average, SD, RSD and variance for each component area. You could modify the template to perform calculations you require.

     

    For expressions in PDF Rerporting Tool it is best to check shipping templates or ask specific questions in this forum. There are few questions already asked and answered related to the script box in the past.

    attachments.zip
  • Ah, try our atandard 3000hanover and let me know if that does not work.

  • The *.zip file is password protected and cannot be extracted without the password. Can you share that with me?

  • Thanks , that password worked to unlock the zip file. One down...

     

    After running your script I get an error that RepositoryRevisionNumber isn't there. Digging through the XML, I found reference to it in 53-55 of BatchInfo.py. After commenting those lines out, I get the included pdf so success on that front.

     

    I'm using B.08 and the example you gave is using 10; my first guess is that DataProvider.BatchAttributes has RepositoryRevisionNumber in 10 but not in B.08. I'd inspect the variables via Visual Studio to validate this but when I start DepugPythonReporting.py with a break at line 53 of BatchInfo.py I get the following error:

     

    Error: Unknown command line parameter - QuantReportMethodRun.exe

    Per the reporting developer's guide and comments on this forum I'm using VS 2015 w/ Python tools and IronPython 2.7.5. I don't normally use VS so I may have missed something during setup of the debugger.

     

    I added the following as my script path which is where I suppose the error originates:

     

    QuantReportMethodRun.exe –BP=C:\MassHunter\Data\QuantExamples\QQQ\DrugsOfAbuse\QuantResults\ –BF=DrugsOfAbuseDemo.batch.bin -M=C:\Users\User\Documents\Test Scripts for Quant\QualityMetrics\test_method_please_ignore.m –OP=C:\Users\User\Documents\Test Scripts for Quant\Temp

    DebugPythonReporting.py looks like it's pointing correctly:

    import clr
    import sys

    import System

    # append quant path
    # modify path if necessary
    sys.path.append(
    "C:\\Program Files\\Agilent\\MassHunter\\Workstation\\Quant\\bin")

    # add debug dll path
    sys.path.append(
    System.IO.Path.GetDirectoryName(System.IO.Path.GetDirectoryName(__file__)))

    # load debug tool
    clr.AddReference("QuantDebugTools")

    import Agilent
    # run
    Agilent.MassSpectrometry.DataAnalysis.Quantitative.DebugTools.RunPython.RunReport(sys.argv[1:])

    I can also see QuantReportMethodRun.exe in C:\Program Files\Agilent\MassHunter\Workstation\Quant\bin.

     

    Any thoughts on what I'm missing for my debugger setup?

  • Hi ,

     

    I tested this with my MH Quant 10 and it is working. As you're using older software version I would just copy 'QualityMetrics.report.xml' and 'Codes\QualityMetrics.py' files to your default direct report template folder '\MassHunter\Report Templates\Quant\PDF-Reporting'. These are only files that have been modified.

     

    Regarding VS, unfortunately I can't help you at that topic as I don't have it installed and am unable to reproduce the error. In this case we may get report template to work without it as file generating the error was not modified and so older versions may be used.

     

    Hope this helps and you should be good when you get the report generated.

  • I can confirm that the report will work in B.08.x and that all you need are the report template and the corresponding code file as mentions in his post.

     

    I can also confirm that RepositoryRevisionNumber did not exist in the B.08.x data set, so it is fine to comment that out or revert back to your original BatchInfo.py file.

     

    For the issues with report debugging, the path for the -BP flag should point to the directory that contains the results folder, not the results folder itself. What is probably making it really unhappy are the spaces in the path for your output folder. You could try putting that path in quotes but probably best to choose/create a simpler path name with no spaces. 

     

    I am able to successfully run the report debugging project with the following Script Arguments.

    -BP=D:\MassHunter\Data\QuantExamples\QQQ\DrugsOfAbuse -BF=DrugsOfAbuseDemo.batch.bin -M=D:\MassHunter\Data\QuantExamples\QQQ\DrugsOfAbuse\DOA_ReportMethod.m -OP=D:\MassHunter\Data\QuantExamples\QQQ\DrugsOfAbuse\QuantReports

    Script Arguments are entered in the Debug section under the Project properties dialog

     

  •  

    Updating from hypen to forward slash in the script argument fixed the issue; spaces are also bad/weird probably because of the way most .NET programs use CommandLineToArgvW. New Script Arguments reads as:

    /BatchPath=C:\temp\ /BatchFile=DrugsOfAbuseDemo.batch.bin /Method=C:\temp\test_method_please_ignore.m /OutputPath=C:\temp\report

    New error: 

    Error: Batch file 'DrugsOfAbuseDemo.batch.bin' does not exist
    Press any key to continue . . .

    The file is clearly there. Specifying full path for /BatchFile fixes this. New script argument reads as:

    /BatchPath=C:\temp\ /BatchFile=C:\temp\DrugsOfAbuseDemo.batch.bin /Method=C:\temp\test_method_please_ignore.m /OutputPath=C:\temp\report

    And I can suddenly browse variables in debug mode!

     

    Thank you both!

  • Interestingly, I still need to supply a full path for the batch file.

  • Quant expects there to be a QuantResults folder present in the batch path. It then expects the batch.bin file to be in that folder. So if the paths mentioned above using the C:\temp folder are accurate then that is why you are having to specify the full path of the batch.bin file for it to work.

     

    I am not aware of any need to change the syntax for the switches, though I suppose if you want to access them within the code then that may be necessary. Otherwise if you specify them in the Debug dialog the syntax given in the manual and in my example should work. 

Was this helpful?