how to calculate the recovery of a spiked sample substracting the amount in the non-spiked sample

I want to calculate the recovery of a spiked sample (sample type=spike) taking into account the amount present in the non-spiked sample (Sample type=sample, sample label=non-spiked). Both samples are in the same sequence. I guess I have to do a CC file Amount “spiked-non-spiked”, but I don’t manage to do so. I am using Openlab CDS2.7.

Thank you in advanced

Oihana

  • Here is one way, it can be modified as needed.

    For the recovery I am using the formula:

    %R = ((Spiked sample result - Unspiked sample result) x 100%) / Known spike added concentration

     

    In the Project, I chose to make a Sample Custom Field to link the Sample and the Spike, type in the name of the Sample Name to link with the Spiked Sample, if the sample is not to be linked with a Spike, leave it blank.  Using a Compound Custom Field for the Spike Concentration.  If its a fixed concentration, this can be put in the formula below instead of using the customer field.

    Create a Custom Calculation File.  Used the Formula beow (change the names in the formula if needed to match the Sample and Compound Custom Parameters that were created in the Project):

    IF(CurrentSample.GetCustomField("SpikeSample")<>””, (Compound_Amount - CurrentSequence.AllInjectionsBySampleName(CurrentSample.GetCustomField("SpikeSample")).First().AllPeaksAndGroupsByName(Compound_Name).first().Compound_Amount)/ CurrentPeakOrGroup .GetCustomField(“SpikeConc”)*100, "")

     

    In the Sequence or in the Injection List fill in the Sample name in the SpikeSample column to link the Spike to the Sample it corresponds to.  Type in the Known Spike concentration in the Compounds Custom Field.

  • Thank you sgamba for your help. I have done some little modification to your equation in order to make it useful for use.

    However, there is one parameter that I do not know how to change. We “correct” the compound amount  with the smple weight and some other constants in a CC file call “p_p_SR”. I can change it in the first part of the equation, but it gives an error when I change it on the second part.

    I will be very pleased if you could help me fixing that last issue.

    I really appreciate your help.

    Best regards

    Oihana

  • Oihana,

    Try first.GetDoubleCC("p_p_SR")) at the end of that expression in place of first()."p_p_SR") assuming your p_p_SR CC is a double type. 

    Marty

  • Hello,

    Hi, thank you so much for the help, I really appreciate it.

    We always want to go further, and I have another issue.

    When I use the equation if there is no peak in the non-spiked sample, it does not calculate any value, it gives an empty value (corrected recovery). In order to “fix” that problem, I think that an option could be to create another CC file using a conditional If “corrected recovery” has a value, corrected recovery, recovery (non-corrected). That works in my mind but not in Openlab. I have tried the options of length, 0, empty, null.. I would be very pleased if you could help me with that last equation.

    Thank you very much.

    Oihana

  • Hello,

    Try something like this to get the blank averages as it should give a zero value when no peak is found in the blank.

    Marty

    If(CurrentSequence.AllPeaks.Where(function (x) x.Injection.Sample.Sample_Type = 5).Where(function (x) x.Compound_Name = CurrentPeakorGroup.Compound_Name).Where(function(x) x.Signal.Signal_Name = CurrentSignal.Signal_Name).Select(function(x) x.Peak_Area).Count > 0 ,CurrentSequence.AllPeaks.Where(function (x) x.Injection.Sample.Sample_Type = 5).Where(function (x) x.Compound_Name = CurrentPeakorGroup.Compound_Name).Where(function(x) x.Signal.Signal_Name = CurrentSignal.Signal_Name).Select(function(x) x.Peak_Area).Average,0.0)

  • Hi Marty, thank you very much for the answer. That works perfectly, but I would like to modify a little bit the equation. I would like to use the value of a CC (p_p_SR) instead of the peak area.

    I try to change the CC using: GetDoubleCC(p_p_SR) or GetCustomField (p_p_SR). In both cases, I get a value of 0,0. I guess, the equation is not written properly, and I get the false condition of the equation.

    If you could help me solving that problem It would be great. I also would like to ask for some extra help if it is doesn´t mean a lot of work. I would like to introduce a filter by sample label in the equation.  

    The scope of the  CC (p_p_SR) is Peak or Group and the type is double                                                          

    I really appreciate your help. Thanks a lot

    Oihana

Was this helpful?