Show the Relationship Between Samples and Analyte Artifacts (Derived Samples)

In the Clarity LIMS API (v2 r21 or later), the initial submitted sample is referred to as a sample (or root artifact). Any derived sample output from a process/step is referred to as an analyte, or artifact of type analyte. This example demonstrates the relationship between samples and analyte artifacts. You must have a sample in the system and one or more processes/steps done that output analyte (derived sample) artifacts.

As of Clarity LIMS v5, the term user-defined field (UDF) has been replaced with custom field in the user interface. However, the API resource is still called UDF.

There are two types of custom fields:

  • Master step fields—Configured on master steps. Master step fields only apply to the following:

    • The master step on which the fields are configured.

    • The steps derived from those master steps.

  • Global fields—Configured on entities (eg, submitted sample, derived sample, measurement, etc.). Global fields apply to the entire Clarity LIMS system.

Code example

The code example does the following when it is used:

  • Retrieves the URI of an arbitrary analyte artifact.

  • Retrieves the corresponding sample of the artifact

  • Retrieves the original root analyte artifact from the sample, as shown in the following example:

// Determine the analyte's URI and retrieve it
arbitraryAnalyteArtifactURI = "http://${hostname}/api/v2/artifacts/${artifactLIMSID}"
arbitraryArtifactNode = GLSRestApiUtils.httpGET(arbitraryAnalyteArtifactURI, username, password)
println GLSRestApiUtils.nodeToXmlString(arbitraryArtifactNode)
 
// Retrieve the analyte's sample
def rootSampleURI = arbitraryArtifactNode.'sample'[0].'@uri'
rootSampleNode = GLSRestApiUtils.httpGET(rootSampleURI, username, password)
println GLSRestApiUtils.nodeToXmlString(rootSampleNode)
 
// Retrieve the sample's root analyte
def rootAnalyteArtifactURI = rootSampleNode.'artifact'[0].'@uri'
rootAnalyteArtifactNode = GLSRestApiUtils.httpGET(rootAnalyteArtifactURI, username, password)
println GLSRestApiUtils.nodeToXmlString(rootAnalyteArtifactNode)

Expected Output and Results

You can generate XML for an arbitrary analyte artifact. The analyte artifact is downstream and has a parent-process element (as shown in line 5). The sample artifact is an original artifact. Downstream artifacts relate to at least one sample, but can also relate to more than one sample, like with pooling or shared result files. The following is an example of XML generated for an analyte artifact:

<art:artifact xmlns:art="http://genologics.com/ri/artifact" uri="http://yourIPaddress/api/v2/artifacts/EXA2241A1DN3?state=18882" limsid="EXA2241A1DN3">
  <name>Example Analyte Artifact</name>
  <type>Analyte</type>
  <output-type>Analyte</output-type>
  <parent-process uri="http://yourIPaddress/api/v2/processes/DNA-SA1-100914-24-1917" limsid="DNA-SA1-100914-24-1917"/>
  <qc-flag>UNKNOWN</qc-flag>
  <location>
    <container uri="http://yourIPaddress/api/v2/containers/27-3543" limsid="27-3543"/>
    <value>A:2</value>
  </location>
  <working-flag>false</working-flag>
  <sample uri="http://yourIPaddress0/api/v2/samples/EXA2241A1" limsid="EXA2241A1"/>
</art:artifact> 

You can also generate XML for a submitted sample. Every submitted sample has exactly one corresponding original root artifact. A sample representation does not link to downstream artifacts, but you can find them using query parameters in the artifacts list resource. The following is an example of XML generated for a submitted sample:

<smp:sample xmlns:smp="http://genologics.com/ri/sample" uri="http://yourIPaddress/api/v2/samples/EXA2241A1" limsid="EXA2241A1">
  <name>Example Sample</name>
  <project uri="http://yourIPaddress/api/v2/projects/EXA2241" limsid="EXA2241"/>
  <artifact uri="http://yourIPaddress/api/v2/artifacts/EXA2241A1SAM1?state=18879" limsid="EXA2241A1SAM1"/>
  <biosource/>
  <udf:field xmlns:udf="http://genologics.com/ri/userdefined" type="String" name="String Type UDF">Updated String UDF Value</udf:field>
  <udf:field xmlns:udf="http://genologics.com/ri/userdefined" type="Text" name="Text Type UDF">Updated Text UDF Value</udf:field>
  <udf:field xmlns:udf="http://genologics.com/ri/userdefined" unit="u" type="Numeric" name="Numeric Type UDF">3.140</udf:field>
  <udf:field xmlns:udf="http://genologics.com/ri/userdefined" type="Boolean" name="Boolean Type UDF">true</udf:field>
  <udf:field xmlns:udf="http://genologics.com/ri/userdefined" type="Date" name="Date Type UDF">2010-09-14</udf:field>
  <udf:field xmlns:udf="http://genologics.com/ri/userdefined" type="URI" name="URI Type UDF">http://www.genologics.com</udf:field>
  <udf:field xmlns:udf="http://genologics.com/ri/userdefined" type="Executable" name="Executable Type UDF">/usr/bin/yes</udf:field>
</smp:sample> 

Lastly, you can generate XML for an original sample artifact called a root artifact. The following is an example of XML generated from an original sample artifact. In this case, both the downstream artifact and the original root artifact point to the same original sample (eg, LIMS ID EXA2241A1).

<art:artifact xmlns:art="http://genologics.com/ri/artifact" uri="http://yourIPaddress/api/v2/artifacts/EXA2241A1SAM1?state=18879" limsid="EXA2241A1SAM1">
  <name>Example Analyte Artifact</name>
  <type>Analyte</type>
  <output-type>Analyte</output-type>
  <qc-flag>UNKNOWN</qc-flag>
  <location>
    <container uri="http://yourIPaddress/api/v2/containers/27-3543" limsid="27-3543"/>
    <value>A:1</value>
  </location>
  <working-flag>true</working-flag>
  <sample uri="http://yourIPaddress/api/v2/samples/EXA2241A1" limsid="EXA2241A1"/>
</art:artifact>

Attachments

SampleAndAnalyteRelations.groovy:

Last updated