Linear Regression Calculation

Clarity LIMS NGS Extensions Package v5.17 and later includes computeLinearRegression script. This script calculates values for slope, intercept, and r-squared, and uses these values to populate corresponding fields. The field names are configurable via script parameters, and will differ depending on the LIMS integration.

In addition, the script requires values for y-axis and x-axis. These values are both related to control samples:

  • y-axis: This is configured as an analyte UDF / derived sample custom field on the control sample. The field name is configurable and is passed in as a script parameter.

  • x-axis: This is the control type's concentration (entered in the Conc. field). This is not configurable.

Script Parameters

The following table defines the parameters used by the computeLinearRegression script.

Parameter

Description

-u {username} -username {username}

(Required) LIMS login username

-p {password} -password {password}

(Required) LIMS login password

-i {stepURI:v2} -stepURI {stepURI:v2}

(Required) LIMS step URI

-log {logFileLIMSID} -logFileName {logFileLIMSID}

(Required) LIMS ID of the log file placeholder

-y <FieldName> -yAxisUDF <UDFName>

(Required) Analyte / Derived sample field name for Y axis.

-slope <FieldName> -slopeUDF <FieldName>

(Required) Slope process / step field name

-ic <FieldName> -interceptUDF <FieldName>

(Required) Intercept process / step field name

-rsq <FieldName> -rSquaredUDF <FieldName>

(Required) R-squared process / step field name

-x <FieldName> -xAxisField <FieldName>

(Deprecated parameter, not supported) Control type concentration field name for x axis. This value specifies the API name that will be used to read the concentration from the control type. Not configurable. Note: This field appears as concentration in the API, but displays as Conc. in the user interface. You cannot customize this naming in the API. In addition, the script does not attempt to read the concentration from the control sample instead of the control type. For example, if you add a UDF / custom field to the control sample, you cannot use that field as the X axis value.

-logX <true/false> -logXMode <true/false>

(Optional) If set to 'true', reads the concentration value from the control type, calculates the log10 of that value, and uses the result for the x-axis.

  • Default = false

-minData <#> -minDataPts <#>

(Optional) Minimum number of data points needed to run linear regression.

  • Default = 4

-select <(ControlName1)|(ControlName2)> -selectControl <(ControlName1)|(ControlName2)>

(Optional) Regular expression that selects the control names to be used in the calculation.

  • Default = All controls

Command Line Example

Example
bash -c "/opt/gls/clarity/bin/java -jar /opt/gls/clarity/extensions/ngs-common/v5/EPP/ngs-extensions.jar \
-i {stepURI:v2} \
-u {username} \
-p {password} \
-log {compoundOutputFileLuid0} \
script:computeLinearRegression \
-y 'Raw CP' \
-slope 'Slope' \
-ic 'Intercept' \
-rsq 'R-Squared' \
-logX 'true' \
-minData '4' \
-select '(Control Name 1)|(Control Name 2)'"

Configuration

This section describes the configuration required for the linear regression calculation.

Step UDFs /Custom Fields

Three step UDFs / custom fields must be configured on the master step / process type, to capture the linear regression slope, intercept, and r-squared values. These fields should display on the Record Details screen at run time.

The following table provides example field configuration details. The field names used correspond to those used in the command line example shown above.

Field Name

Field Type

Field Constraints / Options

Intercept The field specified for the -ic parameter

Numeric

  • Required: No

  • Read Only: No

  • Custom Entries: Yes

R-Squared The field specified for the -rsq parameter

Numeric

  • Required: No

  • Read Only: No

  • Custom Entries: Yes

Slope The field specified for the -slope parameter

Numeric

  • Required: No

  • Read Only: No

  • Custom Entries: No

Global Custom Fields / UDFs

The control samples in the step must have values for a specific derived sample custom field / analyte UDF.

The following table provides example configuration details for this field. The field name used corresponds to the name used in the command line example above.

The field is configured on Analyte in LIMS v4.2.x and Derived Sample in LIMS v5.x and later.

Field Name

Field Type

Field Constraints / Options

Raw CP The field specified for the -y parameter

Numeric

  • Required: No

  • Read Only: No

  • Custom Entries: Yes

ℹ️ Typically it is the step outputs that need to have this field available to fill in. However, the field could also be made available on the step inputs to support the case where multi-step controls are used as inputs to the step.

Rules and Constraints

  • Control samples used in the step must have valid concentration values:

    • Concentration must be a numeric value.

    • Optionally, the numeric concentration value can have text following it to specify the units, for example - 10.02 nM. Note that units are for display purposes only and are not factored into the calculation.

    • Concentration must be a value other than 0. Controls with 0 concentration value are ignored.

  • Slope, intercept, r-squared and -y (Raw CP in the example) field values must all be numeric.

  • There must be 4 or more control samples in the step that can be used in the calculation - i.e., after passing validation.

    • Number of control samples can be configured through -minData parameter.

  • Control samples must have:

    • A name that matches the pattern provided by the -select parameter (if provided).

    • A y-axis field filled in with a numeric value.

    • A concentration value filled in for their control type, with a non-zero numeric value.

    • If any of these conditions is not met, the control samples fail validation and are excluded from the calculation. These do not count towards the minimum number of control samples.

  • If -logX parameter is specified as 'true', the calculated log10(concentration) value is used as the x-axis value (see Script Parameters).

Last updated