Report builder - Final Concentration Expression Change

Hi

Is there an expression to change the 'final concentration' in my report builder to read "<50 ng/L" if the final result is less than LOQ or have been deleted in Quant?

Currently this is expressing results like 0.12 which I would like my final report to read as a less than 50ng/L.

Also when deleting false positive, this also leave these field as "blank" reported.

If this was a excel formula this would be like something like =IF(Final Conc<50,<50,Final Conc)

How do I express this within my report?

Parents
  • Hello  ,

    You can modify one of the expressions in a shipping template to achieve this. There is an example in GenResultsSummary_ISTD for replacing null or zero results with "ND". To also check against your LOQ outlier you could use an expression like the following.

    "<50 ng/L" if BoundItems["TargetPeak"] is None or BoundItems["TargetPeak"].IsFinalConcentrationNull() or not BoundItems["TargetPeak"].IsOutlierBelowLimitOfQuantitationNull() else BoundItems["TargetPeak"].FinalConcentration 

    This should all be on one line. Replace "TargetPeak" with whatever you have named the Peak binding in your template.

    Finding the LOQ outlier flag, OutlierBelowLimitOfQuantation, was a little tricky as the dataset manual is not very clear on this. Since this outlier entry either does not exist (meaning the calculated concentration is above the LOQ) or exists and is set to "Low", the easiest check is to see if it is not Null. If you just check for "Low" but the outlier flag does not exist (as would be the case for all concentrations above the LOQ), then the report will error out. Expressions expect you to handle all error checking.

    The outlier LOQ is not evaluated for sample type Blank. If you need to report blanks the same way you would have to manually compare directly to the outlier limit.

    "<50 ng/L" if BoundItems["TargetPeak"] is None or BoundItems["TargetPeak"].IsFinalConcentrationNull() or BoundItems["TargetPeak"].CalculatedConcentration < BoundItems["cmp"].LimitOfQuantitation else BoundItems["TargetPeak"].FinalConcentration

    To replicate the outlier behavior, I compared against CalculatedConcentration and reported FinalConcentration. Again, this should all be on one line. Replace "TargetPeak" with whatever you have named the Peak binding in your template and "cmp" with whatever you have named the TargetCompound binding in your template.

    These expressions will only work reliably if every compound has an entry for outlier LOQ. If this is not the case, then you would have to build in checks to see if there is an entry for the outlier and if not decide how to handle reporting those compounds. 

Reply
  • Hello  ,

    You can modify one of the expressions in a shipping template to achieve this. There is an example in GenResultsSummary_ISTD for replacing null or zero results with "ND". To also check against your LOQ outlier you could use an expression like the following.

    "<50 ng/L" if BoundItems["TargetPeak"] is None or BoundItems["TargetPeak"].IsFinalConcentrationNull() or not BoundItems["TargetPeak"].IsOutlierBelowLimitOfQuantitationNull() else BoundItems["TargetPeak"].FinalConcentration 

    This should all be on one line. Replace "TargetPeak" with whatever you have named the Peak binding in your template.

    Finding the LOQ outlier flag, OutlierBelowLimitOfQuantation, was a little tricky as the dataset manual is not very clear on this. Since this outlier entry either does not exist (meaning the calculated concentration is above the LOQ) or exists and is set to "Low", the easiest check is to see if it is not Null. If you just check for "Low" but the outlier flag does not exist (as would be the case for all concentrations above the LOQ), then the report will error out. Expressions expect you to handle all error checking.

    The outlier LOQ is not evaluated for sample type Blank. If you need to report blanks the same way you would have to manually compare directly to the outlier limit.

    "<50 ng/L" if BoundItems["TargetPeak"] is None or BoundItems["TargetPeak"].IsFinalConcentrationNull() or BoundItems["TargetPeak"].CalculatedConcentration < BoundItems["cmp"].LimitOfQuantitation else BoundItems["TargetPeak"].FinalConcentration

    To replicate the outlier behavior, I compared against CalculatedConcentration and reported FinalConcentration. Again, this should all be on one line. Replace "TargetPeak" with whatever you have named the Peak binding in your template and "cmp" with whatever you have named the TargetCompound binding in your template.

    These expressions will only work reliably if every compound has an entry for outlier LOQ. If this is not the case, then you would have to build in checks to see if there is an entry for the outlier and if not decide how to handle reporting those compounds. 

Children
  • Hi Howard

    This worked perfectly, thankyou very much!

  • Hello Howard,

    Can the following expression be modified to get the LOD Value directly from the value stored in the method?

    Is it possible to apply  multiplier like amt, Tot Amt  and dilution?

    My report contain the calculated concentration and the final concentration. Ideally the multiplier have to been applied only on the final concentration.

    Expression:

    "<50 ng/L" if BoundItems["TargetPeak"] is None or BoundItems["TargetPeak"].IsFinalConcentrationNull() or BoundItems["TargetPeak"].CalculatedConcentration < BoundItems["cmp"].LimitOfQuantitation else BoundItems["TargetPeak"].FinalConcentration

    Thank you in advance

    Ludovico

  • Hello  ,

    Yes, you could change the expression to check against the LOD instead of the LOQ. To find the name of database entries for use in expressions, you can check in the Quant Dataset manual. This is installed as part of the help and the SDK, but it can be easier to copy the pdf directly from the USB installation drive. It is in the folder \Additional\Schema. The LOD would be LimitOfDetection.

    The multiplier is applied to the calculated concentration to give the final concentration. Details on how the Amt, Tot Amt, and Dilution values work together to make the multiplier can be found in the following discussion - 

    (+) Masshunter quantification in post processing - Forum - Mass Spectrometry Software - Agilent Community

  • Hello Howard,

    below my expression.

    1) Is it possible to use the lowest point of the calibration instead of LOQ?

    I tried to call the LowestLevelConcentration parameter but didn't work.

    2) Is it possible to combine a text with a value ? If it possible I wish obtain something like:

      < 0.02 using an expression like " < " + ["TargetCompound"].LowestLevelConcentration

    3) is it possible to generate a similar equation for obtain:

    "< "+ LowestLevelConcentration if CalculatedConcentration < LowestLevelConcentration (Ex. <0.02)

    ">"+ HighestLevelConcentration if CalculatedConcentration >HighestLevelConcentration (Ex >10)

    Else CalculatedConcentration ?

    How I can chose format of the number when i merge string and numbers?

    Thank you.

    Expression:

    import System
    import clr
    clr.AddReference("System.Drawing")
    import System.Drawing


    if BoundItems["TargetPeak"] is None or BoundItems["TargetPeak"].IsFinalConcentrationNull() or BoundItems["TargetPeak"].CalculatedConcentration < BoundItems["TargetCompound"].LimitOfQuantitation :
    TemplateItems["Cell"].BackgroundColor = System.Drawing.Color.LightSkyBlue
    else:
    TemplateItems["Cell"].BackgroundColor = System.Drawing.Color.White


    tsamt = 1 if BoundItems["Sample"].IsTotalSampleAmountNull() else BoundItems["Sample"].TotalSampleAmount
    samt = 1 if BoundItems["Sample"].IsSampleAmountNull() else BoundItems["Sample"].SampleAmount
    loq = "ND" if BoundItems["TargetCompound"].IsLimitOfQuantitationNull() else BoundItems["TargetCompound"].LimitOfQuantitation
    dil =1 if BoundItems["Sample"].IsDilutionNull() else BoundItems["Sample"].Dilution
    loqtq =loq*tsamt/samt*dil

    loqtq if BoundItems["TargetPeak"] is None or BoundItems["TargetPeak"].IsFinalConcentrationNull() or BoundItems["TargetPeak"].CalculatedConcentration < BoundItems["TargetCompound"].LimitOfQuantitation else BoundItems["TargetPeak"].FinalConcentration

  • While LowestLevelConcentration is mentioned in the dataset manual, from what I can find it is not an actual part of the quant dataset. It is used in an example near the end of the manual to represent the lowest concentration level in the cal curve to show how the calibration range outliers work.
    I believe the calibration concentrations are only available in the calibration table. It can be very challenging to bring in information from the calibration table into a results section since only one sample in the batch contains the calibration table. You can check in some of the templates that report calibration to see how to access these.

    You could use the LOQ, LOD, or MDL outlier to store your lowest concentration level for retrieval if you are not utilizing those outliers. There is also the Sample Amount outlier. The outlier itself triggers on the final concentration, but you could use it to store and retrieve your lowest concentration level and highest concentration level if desired.

    For converting numbers to strings there are several Python or .NET functions or methods you could use. The simplest is str(). This will convert the number as it comes from quant to a string.

    "< "+str(BoundItems["TargetCompound"].LimitOfQuantitation)

    If you want to change the number of decimal places used, you could use the format() method

    "< "+format(BoundItems["TargetCompound"].LimitOfQuantitation,'.3f')

    This would convert to a string with 3 decimal places.

Was this helpful?