Sample Types help you organize samples in your lab and allow you to add fields that help you describe attributes of those samples for easy tracking of data. For example, "Blood" samples might have some different properties than "Serum" samples, so could be defined as two different types with different sets of fields.
This topic covers the details of creating and configuring sample types. For a tutorial to help you learn this process, see
Tutorial: Add Samples.
Create a New Sample Type
Create a new Sample Type by clicking
Sample Types on the main header menu, then selecting
Create > Sample Type.
Before any Sample Types have been created, you can also use two quicker pathways: clicking the linked word
here in the empty Dashboard Insights panel, or selecting
Create a sample type from the main menu under Sample Types.
Note that you can only create Sample Types in the home (top-level) project. If the creation button is missing, navigate first to the
home project.
Define Sample Type Properties
- The Name of the Sample Type is required and must be unique.
- You can edit the Name later if needed, unless an admin has disabled this option.
- Entering a Description is optional. A description can help others understand the usage.
- Naming Pattern: Every sample must have a unique name or identifier, known as a "Sample Id". Unless you will always provide these sample IDs yourself you should provide a pattern to generate them for you.
- Hover over the to see an example name using the current pattern.
- Details about customizing naming patterns are below.
- Aliquot Naming Pattern: For aliquots created from samples of this type, you can leave this blank to accept the default naming pattern, or customize it if desired.
- To declare a field that will identify a parent sample, click Add Parent Alias. Enter the field name and select the Sample Type where the parent information will be found. It can be the current type or a different one.
- If there are Sources defined in the system, you will have a similar option to Add Source Alias here.
- Set Storage Settings
- Define a Barcodes field if desired.
- Before you click Finish Creating Sample Type, determine whether you need to add Fields.
Naming Pattern
Every sample must have a unique name or identifier, known as a "Sample Id". For each Sample Type, determine whether you will provide these sample IDs or whether you want the system to generate them for you. This decision determines what, if anything, you will enter in the
Naming Pattern field. Learn more in this topic:
Sample ID Naming.
- If you will provide the sample IDs, and they are in your data in a column named "SampleID", you can delete the default naming pattern (and ignore the grayed out placeholder text).
- If you will provide the sample IDs, but they are in a column named something other than "SampleID", you provide a naming pattern like this pattern ${COLUMN_NAME}. See below.
- If you want sample identifiers generated for you by the system, provide a naming pattern using the guidance in this topic: Sample ID Naming. A few examples are at the bottom of this page.
- The default naming pattern is "S-${genId}", meaning the letter S followed by a dash and an incrementing counter.
Naming patterns will be validated before you can save your sample type. You will see a message if there are any syntax errors so that you can correct them. Learn more in this topic:
Sample ID Naming
Aliquot Naming Pattern
By default, the name of the aliquot will use the name of its parent followed by a dash and a counter for that parent's aliquots.
${${AliquotedFrom}-:withCounter}
For example, if the original sample is S1, aliquots of that sample will be named S1-1, S1-2, etc.
If instead you wanted to use a dot between the sample name and aliquot number (S1.1, S1.2, etc.) you'd use the pattern:
${${AliquotedFrom}.:withCounter}
Learn about more options for aliquot naming patterns in the
core LabKey Server documentation. Aliquot naming patterns will be
validated during sample type creation.
Storage Settings
- Label Color: You can assign a color to this type of sample to help make quick visual identification easier in various application views.
- Display stored amount in (Required): Select the units in which you want stored amounts of this sample to be displayed. Options:
- g (grams)
- mg (milligrams)
- kg (kilograms)
- mL (milliliters)
- uL (microliters)
- l (liters)
- unit (for cases where none of the other options are appropriate and each sample is a unit)
Label Color
To assign a
Label Color when you are creating or editing your sample type, click the selection area to open a color picker:
- Click a block of color to select it.
- Type a hex code next to the # sign or individual RGB values into the panel for more color control.
Define Sample Type Fields
Click the
Fields section to open it.
Default System Fields
Every Sample Type is created with several default fields (columns) built in. For example, like any data structure, "Created/CreatedBy/Modified/ModifiedBy" record the userID and time of creation/modification respectively. In addition, you will see the Sample Type
Default System Fields at the top of the
Fields panel.
- SampleID: The name of the sample.
- Status (SampleState): Tracks the status of the sample.
- Description: This is a description field for an individual sample, not the description of the Sample Type as a whole that is shown in the properties section.
- Expiration Date (MaterialExpDate): Tracks the date this sample expires on.
- Units
- Stored Amount
- Aliquots Created Count (AliquotCount)
- Freeze/Thaw Count (FreezeThawCount)
- Storage Location, Row, and Column
While you do not add and cannot remove or change these columns, you can choose which are enabled for this Sample Type using the checkboxes on the left, with the exception of Name and SampleState. For example, if you don't need to see and record expiration dates for a given Sample Type, you can uncheck that column.
Find a full list of reserved and internal field names in this topic:
Data Import GuidelinesCollapse the display of default system fields by clicking the
for the section. You can expand it any time by clicking the
Add Custom Sample Type Fields
Add any additional fields that you want in your Sample Type definition as follows:
- Click the Fields section to open it.
- You can collapse the Default System Fields section to hide it.
There are several methods available when adding the first custom fields.
Import or Infer Fields from File
The default is
Import or infer fields from file, shown at the bottom of the previous image:
You can select or drag a spreadsheet containing your data into the upload panel.
- This will populate the fields section based on inferrals from the data.
- Note: If your spreadsheet contains columns for built-in fields, such as "SampleID" and "Description", they will not be shown here.
- You can also import field definitions from a prepared JSON file if you have one.
After importing or inferring fields from a file, you can adjust them or add additional fields using the manual field editor described below.
Manually Define Fields
Instead of using a file, click
Manually Define Fields and continue.
- For each additional field in your sample data, click Add Field:
- Enter the Name. Names should not contain spaces or special characters; instead you can use such characters in the label for the field. Learn more in this topic.
- Select the Data Type. Learn more about types and their properties in this topic.
- Check the box if the field is required.
- Click the (expansion) icon to define more properties of your new field as needed.
- You can reorder the fields by dragging and dropping with the six-block handle.
- Add all the fields you need. If you add an extra and need to delete it, click the on the right.
Learn about attaching images and other files using a
File field in this topic:
Barcodes
If a field of type
Unique ID is included in your Sample Type, the system will generate barcode values for you.
When you are defining a new sample type, you will see in the initial setting of the
Barcodes property that no
Unique ID field exists. You will be prompted to include one after inferring or manually creating other fields.
Clicking
Yes, Add Unique ID Field will add a new field named "Barcode". Every new sample of this type will have a new barcode generated for it.
You'll be able to search for samples by these generated barcodes, as well as by any fields you specifically designate as
containing barcode values.
Learn more about creating and using barcodes in this topic:
Configure Sample/Aliquot Field Inheritance
For each field included in the Sample Type, whether inferred or manually created, you can configure whether the field is settable (and editable) for samples, aliquots, or both.
- Click the to expand each field's details.
- Under Sample/Aliquot Options, select one:
- Editable for samples only (default): Aliquots will inherit the value of the field from the sample.
- Editable for aliquots only: Samples will not display this field, but it will be included for aliquots.
- Separately editable for samples and aliquots: Both samples and aliquots can set a different value for this property.
Finish Creating Sample Type
- Click Finish Creating Sample Type when finished.
Learn more about defining fields and their properties in this topic:
After creating a new Sample Type, you will see it listed on the main header menu and be able to begin creating samples of this type.
Edit Sample Type Design
If necessary, you can return to edit
properties or
fields/columns later via
Manage > Edit Sample Type Design.
Use caution if you change the naming pattern(s) to ensure that all SampleIDs will remain unique. You can also edit the Name of the Sample Type itself. Note that changes to the Sample Type definition and naming pattern do not 'propagate' to existing samples, which will all retain their original names.
Whether fields can be set for
samples, aliquots, or both can be edited later; note that if you change an existing field from "Editable for samples only" to this "Separately editable for samples and aliquots" option, any stored values for aliquots will be dropped.
After completing edits, click
Finish Updating Sample Type in the lower right.
Resource: Sample Naming Pattern Examples
A few examples of how you might choose to name your samples and how to design a naming expression. You can use values from your data, dates, and counters to ensure that every sample name is unique. Separators like '-' and '_' are commonly used but optional.
Description | Example SampleIDs | Naming Pattern |
---|
The character 'S' followed by a counter (Default) (always unique within this type of sample) | S-1 S-2 S-3 | S-${genId} |
The word 'Blood' followed by a 2 digit counter | Blood-01 Blood-02 Blood-03 | Blood-${genId:number('00')} |
The value of the "Lab" column + '_' + a counter | LabA_1 LabB_2 LabC_3 | ${Lab}_${genId} |
Use a default value if the "Lab" column is empty (+ '_' + a counter) | LabA_1 LabB_2 LabUnknown_3 | ${Lab:defaultValue('LabUnknown')}_${genId} |
'S' plus current date followed by a counter that resets daily (always unique; tracks date of entry into system) | S-20200204-1 S-20200204-2 S-20200205-1 | S-${now:date}-${dailySampleCount} |
'S' plus values from two columns in my data: the Study and ParticipantID (only unique if one sample per participant) | S-Study101-pt231 S-Study101-pt232 S-Study101-pt233 | S-${Study}-${ParticipantId} |
Values of "ParticipantID" and "Draw Date" columns, then a counter (always unique and tracks draw date, not date of entry into system) | pt231-20191203-1 pt231-20191214-2 pt231-20191214-3 | ${ParticipantID}-${DrawDate}-${genId} |
The values already present in the "SampleID" column in my data | unique values provided | No naming pattern required |
The values already present in the "Identifier" column in my data | unique values provided | ${Identifier} |
Learn more about building naming patterns in this topic:
Related Topics