5 Replies Latest reply on Apr 12, 2018 6:55 AM by berndh

    Custom Calculation: Calibration curve factors for reference compounds

    berndh

      Dear all,

       

      is it possible to access the calibration curve factors for reference compounds in custom calculation editor?

       

      Compound A is calibrated in data analysis (mode curve), Compound B is quantified using Compound A as reference.

       

      In Custom calculation, I need to divide the peak area of compound B by the value of the slope of Compound A`s calibration curve (to work around the problem that compound B needs to be quantified without sample multipliers and dilution factors which are needed to quantify other calibrated compounds in the sample. Sounds complicated, and it is).

       

      calibrationcurve.calibrationcurve_A_coefficient is the function I need - what I miss is the correct way to link the function to the correct compound.

       

      Allpeaksorgroupsbyname("CompoundA") or something similar... I cannot get it to work

       

      Any help would be appreciated :-)

       

      Thanks and best regards,

      Bernd

        • Re: Custom Calculation: Calibration curve factors for reference compounds
          ryoboyle

          I updated tags on this post to increase visibility.

          • Re: Custom Calculation: Calibration curve factors for reference compounds
            ir_nerd

            Hi Bernd,

             

            There were couple of missing fields in Custom Calculator. We worked on adding few of these in CDS v2.3. The following list of fields will be in CDS v2.3 (sorry for the formatting):

             

             

            But the field you are looking for was already provided in the Custom Calculator in previous software revision.

            If you just want to see your Calibration Curve Coefficient A for your compound. You just need to call:

             

            CalibrationCurve_A_Coefficient      on the PeakOrGroup Scope

             

             

            But I think in your case, you want to store the coefficient, and use it for other compounds. To get a specific calibration curve coefficient, you should write this as following:

             

             

            CurrentSequence.AllPeaksAndGroupsByName("CompoundA").OrderBy(function(a) a.Injection.Sample.Sample_OrderNumber).Select(function (a) a.CalibrationCurve.CalibrationCurve_A_Coefficient).Last

             

             

            CurrentSequence.AllPeaksAndGroupsByName("CompoundA")                  We look at the sequence, and more specifically on the CompoundA results

            .OrderBy(function(a) a.Injection.Sample.Sample_OrderNumber)                 We sort the information by the number of the sample in the sequence

            .Select(function (a) a.CalibrationCurve.CalibrationCurve_A_Coefficient)     Select the list of values for the Calibration Curve Coeff A. This is a list

            .Last                                                                                                              Take the last from the list

             

             

            You may wonder why did I sort the sample by their number and take the last. In the case, you have calibration samples in your sequence, to build or update the calibration curve. Then the final calibration curve is known at the last calibration standard. So We need to take the last updated cailbartion curve coefficient.

             

            I hope this helps. Let me know if I misunderstood your question.

             

            Regards,

            Pierre

              • Re: Custom Calculation: Calibration curve factors for reference compounds
                berndh

                Dear Pierre,

                 

                thanks that helped a lot:

                 

                CurrentSequence.AllPeaksAndGroupsByName("CompoundA").OrderBy(function(a) a.Injection.Sample.Sample_OrderNumber).Select(function (a) a.CalibrationCurve.CalibrationCurve_A_Coefficient).Last

                 

                is _nearly_ what I need...as the calibration is updated throughout the sequence we use bracketing (for compoundA, the standard is simply the diluted test solution (and is prepared for every batch), we have to use the current calibration value, not the last...:

                 

                Standard Compound A Batch XXX

                Sample Solution Batch XXX

                Standard Compound A Batch XXX

                 

                Standard Compound A Batch YYY

                Sample Solution Batch YYY

                Standard Compound A Batch YYY

                 

                 

                But the formula seems to work if I replace "CurrentSequence" with "CurrentInjection", so I will give that a try.

                 

                Thanks and best regards,

                Bernd

                  • Re: Custom Calculation: Calibration curve factors for reference compounds
                    ir_nerd

                    Hi Bernd,

                     

                    Correct. Current injection would work if you want to use it only in the injection scope to perform your calculation.

                    But in the case you want to use it in a sequence summary calculation, you can also use something like this :

                     

                    CurrentSequence.AllPeaksAndGroupsByName("CompoundA").Where(function(a) a.Injection.Sample.SAMPLE_ANYTHING).Select(function (a) a.CalibrationCurve.CalibrationCurve_A_Coefficient).Last

                     

                    Or

                     

                    CurrentSequence.AllPeaksAndGroupsByName("CompoundA").Where(function(a) a.Injection.INJECTION_ANYTHING).Select(function (a) a.CalibrationCurve.CalibrationCurve_A_Coefficient).Last

                     

                    This SAMPLE_ANYTHING or INJECTION_ANYTHING can be any of the injection or sample field you can use to filter or point the expression to a specific sample or injection.

                     

                    Example: Sample_Description, Sample_Name (or even a part of a sample name), Sample_CalibrationLevel, ....

                     

                     

                    I removed the OrderBy, because in that case we should not have multiple values... But in case you work with bracketing, then you will end up will different values in the list... One value for STD Cal n bracket 1, one value for STD Cal n bracket 2, .... , One value for STD Cal n bracket n.

                    You can then point to the value 1, 2 or n, doing the following:

                     

                    CurrentSequence.AllPeaksAndGroupsByName("CompoundA").OrderBy(function (a) a.Injection. Sample. Sample_OrderNumber).Where(function(a) a.Injection.Sample.Sample_CalibrationLevel = 3).Select(function (a) a.CalibrationCurve.CalibrationCurve_A_Coefficient).ElementAt(1)

                     

                    CurrentSequence.AllPeaksAndGroupsByName("CompoundA").OrderBy(function (a) a.Injection. Sample. Sample_OrderNumber).Where(function(a) a.Injection.Sample.Sample_CalibrationLevel = 3).Select(function (a) a.CalibrationCurve.CalibrationCurve_A_Coefficient).ElementAt(2)

                     

                    ...

                     

                    CurrentSequence.AllPeaksAndGroupsByName("CompoundA").OrderBy(function (a) a.Injection. Sample. Sample_OrderNumber).Where(function(a) a.Injection.Sample.Sample_CalibrationLevel = 3).Select(function (a) a.CalibrationCurve.CalibrationCurve_A_Coefficient).ElementAt(n)

                     

                     

                    In that example, I am filtering on the STD calibration level 3, and take the 1st, the 2nd , the nth from the list of Cal Curve A Coeff from the sequence.

                    Ok.. one last expression that can help:

                     

                    CurrentSequence.AllPeaksAndGroupsByName("CompoundA").OrderBy(function (a) a.Injection. Sample. Sample_OrderNumber).Where(function(a) a.Injection.Sample.Sample_CalibrationLevel = 3).Where(function(a) a.Injection.Sample.Sample_Name like "*YYY*").Select(function (a) a.CalibrationCurve.CalibrationCurve_A_Coefficient).first

                     

                    When you build such list, even if you have only one value in the list, such as here the STD level 3 containing "YYY"  in the name, do not forget to use a "first", "last" or "ElementAt(1)" at the end...

                    This is a list of double... The tool expect a double value. So you need an operator at the end.

                     

                     

                    Pierre