About PilotScript Data Record Properties

You can use PilotScript to manipulate data records.

This page discusses:

See Also
Calculable Properties
Changing Property Values
Deep Properties
About PilotScript Data Record Properties
Property Lists
Local Properties
PilotScript Reference

Pipeline Pilot works with data records flowing through a pipeline. It can access and change the data records and the property list associated with each data record.

Working With Property Values

To Do this
Reference a Property Value

Use the property's name. The following example assigns 5 as the value of the property a_min:

a_min :=5;
Retrieve a Property Value
a_save := a_min;
Reference a Property

To refer to the property itself, rather than its specific value, use the property's name as a text string. Some PilotScript functions work on the property and not on its value. Therefore, give these functions the name of the property as a string, as illustrated in the following example:

Keep('a_min', 'a_max', 'a_save');

Data Record Properties

Data records have properties associated with them. Data record properties have the following characteristics:

  • They are stored in a property list, which is an array of name/value pairs.
  • Each data record property includes an alphanumeric name and a value. Examples include Molecular_Weight, Compound_Name, CAS number, and AlogP.
  • It is often convenient to rename properties that contain characters other than alphanumeric and underscores using a custom manipulator component at the start of a pipeline. For example: Rename ('CAS number, 'CAS_number');.
  • The value of a property (e.g., 346.4 for Molecular_Weight) may be a single item or multiple items. If there are multiple values, it is called an array property.
  • Data record properties can originate within a data source or they can be added to the record while it is being processed. This is accomplished by assigning a value to a new property (myprop :='abc'; yourprop :=myprop;) or performing a calculation using a calculable property (cmpdAlogP :=AlogP) or arithmetic operators (-avg :=total/5).

In the example shown below, if AlogP is not defined in the original data source, it is automatically calculated when the expression is evaluated.

AlogP < 3.5 

Tip: To handle property names that include spaces or other non-standard characters, refer to the property using the Property() function, property ('var'), or the %'var' syntax.

Global and Local Properties

Protocol properties can be defined at a number of levels, reflecting the nesting of protocols, subprotocols, and components. At the broadest scope, a set of properties can be global to the entire protocol and are known as global properties. Each time an expression is executed, it works with a different data record. The list of global properties is accessible to all components in a protocol, whereas the local properties are only accessible from the component in which they reside.

Properties that are available to all components in a protocol are known as global properties and are defined in the protocol's Implementation parameter DeclareGlobal. Use the subprotocol Implementation parameter DeclareLocal for properties available to all components in the subprotocol. Globals only persist through the execution of a protocol. The value of a global property can be assigned to data record properties as illustrated in the following example:

@gcount += 1; 
			count := @gcount;
		

The global property @gcount is incremented. Each time a record passes through, the data record property count is assigned the value of the global property @gcount. Thus, all records get an index indicating the order in which they passed through the pipeline. When using a custom manipulator component in this fashion, you can initialize the global property @gcount using the Initial Expression parameter in the component.

Properties that are available to a specific component are known as local properties. As with global properties, the value of a local property can be assigned to data record properties. For example:

#lcount += 1;
			count := #lcount;
		

In the above example, the local property #lcount is incremented each time a record is passed. A data record property property is assigned the value of that local property. All records get an index indicating the order that they passed through the component. Unlike global properties, #lcount does not affect any other component that uses the same property name within the protocol.

Property Names

You can access a property's value by using it like a property in a language, such as C or Java. Property names must start with an alphabetic character or an underscore, and can only contain alphanumeric characters (A-Z, 0-9) and underscores. If the property name does not satisfy this condition, refer to the Property() function, property('var'), or the %'var' syntax.

Global properties can be engaged by using an @ character in front of the property name (@var). Similarly, local properties are engaged by using a hash character (#) in front of the property name (#var). All property names and keywords are case-insensitive.

Property Representation Validity
A
Valid
A
Valid. Same property as above (case-insensitive).
%a
Valid. Same property as the above two cases.
%'a'
Valid. Same property as the above three cases.
% 'a'
Not valid. No spaces allowed between the percent sign and the string.
property('a')
Valid. Equivalent to %'a'.
FOO_Bar9
Valid
_9Foobar
Valid
9_Foobar
Not Valid. Cannot start with a number.
%'9_Foobar'
Valid
%9_Foobar
Not Valid. Must be enclosed in quotes, as above.
%'arf bark'
Valid. Quotes enclose the spaces.
@A
Valid.
@'Sample A'
Valid. Quotes enclose the spaces.
globalproperty('Sample A')
Valid. Same as above.
#L
Valid.
#'Plate L'
Valid.

Data Property Names

Data property names should start with an alphabetic character (A-Z) or an underscore ( _ ) and can only contain alphanumeric characters (A-Z, 0-9) and underscores.

Examples:

Compound_Name
 AlogP
 _Assay_3

Data property names are case-insensitive, so the following pairs of names are equivalent:

 AlogP
 alogp
 Assay_3
 assay_3

A data property name can always be prefixed with a percent character (%) if this makes the expression clearer. The following examples are equivalent to the data property names displayed in the previous example:

 %AlogP
 %Assay_3

If a data property name does not satisfy the above conditions (for example, it contains a space or begins with a number), you can qualify it by using a percent character (%) immediately followed by the property name enclosed in single quotes. Think of % as meaning "the value of."

For example:

 %'Plate Name'
 %'Plate#'
 %'3-Form'

Another way of achieving this is to use the Property() function.

The following example:

 Property('Plate#')

Is equivalent to:

 %'Plate#'

Consider that a property name can be stored in another property, as demonstrated in the following example:

 IF New_Plate_ID IS DEFINED THEN 
    AssigneeProperty := ’New_Plate_ID’;
 ELSE
    AssigneeProperty := ’Plate_ID’;
 END IF

 …
 …
 /* Later in the Pipeline */ 
 Property(AssigneeProperty) := ’36DUS’;
 /* Note that %AssigneeProperty would do something else! */
 /* No quotes around AssigneeProperty. Refers to the value of AssigneeProperty */

Raw record data might give you data property names with spaces or other non-standard characters. It is convenient to rename a property component like this at the start of a pipeline. For example:

Rename(’compound id’, ’compound_id’);

Tip: When a property name is enclosed in single quotes, it is a text string that is the name of the property. Rename() is a function in the PilotScript syntax that expects to be passed the name of a data property, and not its value, since it works on the property itself.