What will this formula return in Empower?

Options

I have been asked to calculate the Average. Maximum and Minimum areas of my active but only across certain injections of the sample set. I know I could just filter by label and use the report method but im looking for a quicker result and I read that something like the following formula would assist:

  1. Sample, Text, Keyboard custom field called “Custom_Ref”.

Then a peak, real, calculated custom field, set to Result Set Only which takes in all labels, injections, the same channels and only the Average (or Max, Min etc) Areas of samples where “custom_ref” is populated. Here is the formula:

  1. %.%.SAME.AVE(EQ(Custom_Ref,”R1”)*Area).

So for the samples that I want to calculate Average Areas, I will populate that line in the sample set with “R1”, but the thing is im getting weird results when I process the run, figures which don’t make any sense at all and I don’t know where they are coming from, can anyone clarify what exactly the formula will return when Empower processes the run?. I have Summarize Custom Fields in the sample set, what affects this calculation, does the processing lines etc play a part? Or is this way too complicated?

I basically only want the average area of my active in sample lines where R1 is populated. So if R1 was set in Lines 3,5,6,10 and 50, I only want the average area of active for all those lines..

Best Answer

  • shaunwat
    edited June 2018 Answer ✓
    Options

    From my point of view, the example given will work only if it must return a single value. You are asking for more than that.

    In the example, out of all injections made in our sample set, find me only ones where CF_Reference = R1, which generates a 1 for all those samples. If true (1), the multuply by the area. Then tell me which one has the maximum area.

    So you have a lot of 0*Area or 1*Area and then you pick which one has the maximum area.

    You want an average. So using their example you are getting 0*Area + 1*Area + 0*Area + 0*Area + 1*Area, etc. etc / n, where n is being set equal to the number of lines in your sample set method.

    The above is not what you want. You need to cancel out that Ave(Area) if the samples don't have your label. To do that you must use:

    EQ(Custom_Ref,"R1")*1*%.%.SAME.AVE(Area).

    where an average area can not be generated for samples that don't have your reference. Again, in thier example who cares if the result returned for an injection not having the desired label is 0 because it surely won't be a maximum. This 0 value will have an impact on an average.

    Upon further throught, my logic above my also be slightly incorrect and you may also need to code the false condition, eg:

    EQ(Custom_Ref,"R1")*1*%.%.SAME(Area) + NEQ(Custom_Ref,"R1")*-1*50000

    The above will cause a blank cell to be generated for all injections that do not have your desired reference. You could then run a result custom field on the one above that determines the average. In this instance, Empower should not include blank cells in the sample number (n) used to determine the average.

Answers

  • shaunwat
    edited June 2018
    Options

    When I've needed to use a formula such as what it appears you are after, I've always structured it a little differently.

    EQ(Custom_Ref,"R1")*1*%.%.SAME.AVE(Area).

    Using the above I've always obtained what I was looking for, so maybe it's your syntax or order that is giving Empower trouble...

  • Thanks Shaunwat, I will try the syntax as you suggested. So that would return a 1 if R1 is present in Custom_Ref, which you multiply by 1 and then by the formula? Do you need that extra 1 before the %.%.SAME.AVE(Area)?. Presumably when the R1 is present the first part of the formula becomes 1, which is multiplied by the remainder of the formula? I will try it with the extra 1 in it thanks a lot for the help. 

    I originally tried it with my first formula as that's what the book on custom fields by Beyontics from 2016 suggested. 
  • shaunwat
    edited June 2018
    Options

    Technically, I don't think that the extra one is required, but I like to put it in there anyway.

    Yes, when the first part of the formula I posted above is true, then it becomes 1 and is multiplied by the rest. In this case it would be 1*1*Ave_Area for what ever injections/samples are able to be included from the summary function custom field.

    I've never seen formal examples of either your or my custom field. When a client asked for a comparision of data across two PDA channels the custom field is I posted above is similar to what I came up with.

  • Thanks for the extra information shaunwat. 

    Can I ask you, when you did set up that field, did you get  the average (for example) area of peaks only in samples where Custom_Ref had R1 or was is the average area of the active peak over ALL the samples where R1 was present? So if you had R1 in Sample Lines 4,5,8 and 12, would this formula return the average area of Active X over all of Sample Lines 4,5,8 and 12 or only return the area of each individual area per line? That's what was confusing me, I was trying to find out the Maximum area of active x over 5 different lines but I was getting weird numbers and I couldn't work out what Empower was "seeing" when it calculated this formula. 
  • shaunwat
    edited June 2018
    Options

    Technically, your custom field should only generate an average for injections where Custom_Ref = R1.

    I think I envision your Custom_Ref field to be different than what it actually is based upon your "... over ALL samples where R1 was present" comment.

    What is your Custom_Ref field exactly?

    I imagined Custom_Ref to be a sample set enumerated list where the user could select R1 for specific injections, therby allowing you to generate an average of peak areas for R1 labeled samples in the sample set. 

    IF R1 is the name of a peak and it is populating the Custom_Ref custom field (if it is found?), then you will generate the average based upon every injection where R1 is present. To exclude by sample line only, you would need to use a custom field in your sample set, as mentioned above.  

  • Custom_Ref is Sample, Text, Keyboard entered custom field in my sample set and I just type R1 in this field for the specific lines which I want to group together, maybe I should make this custom field a Bool or Enumerated and have R1 as an option in the list and Use as 'Text'?
    The objective of the main custom field is to get the average area of my active peaks over all the lines where Custom_Ref is populated so, say I have samples run on lines 3,8 and 14 and I have R1 in the Custom_Field fields of these lines and the area of my active in line 3 is 100, in line 8 its 200 and for line 14 its 300, I want the custom field to return a value of 200 for EQ(Custom_Ref,"R1")*1*%.%.SAME.AVE(Area) i.e (100+200+300)/3. But its not, its returning a very low value and I cant work out where the number is coming from. I tried seeing is it the average area of active over ALL injections but its too low for that. I have the formula % for labels to include all possible labels. 
    I will see what changing the synatax to what you suggested does to the overall result..
  • The only way the average could be returning a low value if it is not using all injections, is if more samples were being included. Possible the sum of the peaks from the injections that you want, but maybe it is dividing by all injections in the sequence?

    I would recommend rearranging the formula to what I have typed. I'm just having a hard time determining what Empower would actually do with the formula in your as written syntax.

  • Hi Shaunwat, its easier if I copy over the text from the book which suggested using this formula. Its the Beyontics book from 2016 on custom field and here is the text if it makes sense!:

    "Label-independent intersample calculations.

    A useful application of conditional intersample calculations is the use of an additional reference in the Sample Set- these calculations can also be referred to as input dependent calculations.

    The label in Empower serves not only for setting references in intersample calculations; they also serve as reference for calibration and quantification of injection rows. The references (this means the labels of the injection rows), for which a particular operation must be performed, are defined in the field 'Label Reference'. Its essential to use labels for calibration and quantification. You can face annoying restrictions in Custom Field calculations that are also defined be labels. Therefore you must consider a label structure that will satisfy both requirements.
    You can avoid this restriction with a simple trick. First you need a separate custom field, which can be created as a simple Sample/Text/Keyboard. Call this custom field CF_Reference. 

    Now create a field that will determine the maximal values of the peak areas for defined injections. For this you need a Peak/Real/Calculated field and the calculation must be done as an intersample calculation. However, because you cannot make a restriction by using the label, you can set here the wildcard % as the label. This will make all injections in the sample set to be considered first and the formula has the following structure:

    %.%.SAME.MAX[]

    It makes sense to already offer a first restriction through the label by using SAME in the formula. This way separate blocks of samples can be considered separately. 

    Set now a Boolean expression in order to implement the field CF_Reference in the formula:

    EQ(CF_Reference, "R1")*Area. 

    You can then freely choose the entry R1. In this case the expression returns an Area value only if this reference is set. You must now only plug this expression in the intersample structure already described:

    %.%.SAME.MAX(EQ(CF_Reference,"R1")*Area)."
  • It appears that this will not return the result I am looking for. A formula like %.%.SAME.AVE(EQ(Custom_Field_Ref,"R1")*Area) will look for lines where R1 is referenced and then return the average area only for that particular line. It wont add up all the lines where R1 is populated and THEN average the result based on # of injections, so that's why when I looked at lines for this custom field and I have a peak area of 10000 the result was also 10000 because the average of 10000/1is 10000. 

    To get what I want, I would have to group all the lines that I wanted an average area of active peak for and assign the same label to them all and try something like SAME.%.SAME.AVE(CCalRef1[Area]). It seems the original purpose of the first custom field was to calculate the maximum areas for particular sample rows with R1 populated so for line 2, Max area could be 450000, for Line 10 50000 etc etc. 

    When I read it again, it seems like a very complicated way to see Max areas when you could just use a report method or just write a CF like MAX(Area) or MAX(CCalRef1[Area]) and see what this is filled with for the desired samples. Thanks for all your replies on this, Shaunwat.