@morscherlab/mint-sdk 1.0.0-rc.1 → 1.0.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -1
- package/dist/__tests__/components/LcmsSequenceTable.test.d.ts +1 -0
- package/dist/__tests__/components/ProgressBar.test.d.ts +1 -0
- package/dist/__tests__/components/RackEditor.test.d.ts +1 -0
- package/dist/__tests__/components/SequenceProgressBar.test.d.ts +1 -0
- package/dist/__tests__/composables/useExperimentSamples.test.d.ts +1 -0
- package/dist/__tests__/utils/instrument.test.d.ts +1 -0
- package/dist/__tests__/utils/lcms.test.d.ts +1 -0
- package/dist/__tests__/utils/permissions.test.d.ts +1 -0
- package/dist/__tests__/utils/rack.test.d.ts +1 -0
- package/dist/{auth-CBG3bWEc.js → auth-B7g4J4ZF.js} +99 -5
- package/dist/auth-B7g4J4ZF.js.map +1 -0
- package/dist/components/AppSidebar.vue.d.ts +3 -3
- package/dist/components/AutoGroupModal.vue.d.ts +1 -1
- package/dist/components/BaseCheckbox.vue.d.ts +1 -1
- package/dist/components/BaseToggle.vue.d.ts +2 -2
- package/dist/components/BioTemplateExperimentWorkspaceView.vue.d.ts +1 -1
- package/dist/components/BioTemplatePackWorkspaceView.vue.d.ts +1 -1
- package/dist/components/BioTemplatePresetWorkspaceView.vue.d.ts +1 -1
- package/dist/components/ControlWorkspaceView.vue.d.ts +3 -3
- package/dist/components/DoseDesignWorkspaceView.vue.d.ts +2 -2
- package/dist/components/FormulaInput.vue.d.ts +1 -1
- package/dist/components/InstrumentAlertLog.vue.d.ts +22 -0
- package/dist/components/InstrumentStateBadge.vue.d.ts +11 -0
- package/dist/components/InstrumentStatusCard.vue.d.ts +13 -0
- package/dist/components/LcmsSequenceTable.vue.d.ts +26 -0
- package/dist/components/PluginWorkspaceView.vue.d.ts +3 -3
- package/dist/components/ProgressBar.vue.d.ts +1 -0
- package/dist/components/RackEditor.vue.d.ts +41 -3
- package/dist/components/ReagentList.vue.d.ts +1 -1
- package/dist/components/SampleSelector.vue.d.ts +5 -2
- package/dist/components/SegmentedControl.vue.d.ts +2 -0
- package/dist/components/SequenceInput.vue.d.ts +1 -1
- package/dist/components/SequenceProgressBar.vue.d.ts +15 -0
- package/dist/components/SettingsModal.vue.d.ts +3 -1
- package/dist/components/TagsInput.vue.d.ts +1 -1
- package/dist/components/WellPlate.vue.d.ts +42 -3
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.js +3 -3
- package/dist/{components-5KSfsVqf.js → components-DafPc4rM.js} +2091 -1051
- package/dist/components-DafPc4rM.js.map +1 -0
- package/dist/composables/controlComponentBindings.d.ts +7 -0
- package/dist/composables/controlSchemaAdapters.d.ts +20 -0
- package/dist/composables/controlSchemaFormFields.d.ts +3 -0
- package/dist/composables/controlSchemaLayout.d.ts +7 -0
- package/dist/composables/controlSchemaNormalize.d.ts +15 -0
- package/dist/composables/controlSchemaUtils.d.ts +9 -0
- package/dist/composables/controlWorkspaceOptions.d.ts +2 -0
- package/dist/composables/experimentDesignData.d.ts +17 -0
- package/dist/composables/index.d.ts +2 -0
- package/dist/composables/index.js +4 -4
- package/dist/composables/useControlSchema.d.ts +15 -30
- package/dist/composables/useControlWorkspace.d.ts +5 -0
- package/dist/composables/useExperimentData.d.ts +11 -3
- package/dist/composables/useExperimentSamples.d.ts +42 -0
- package/dist/composables/usePlatformContext.d.ts +54 -0
- package/dist/{composables-D4Myb30a.js → composables-BMkPQhVK.js} +5 -3
- package/dist/composables-BMkPQhVK.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +168 -6
- package/dist/index.js.map +1 -0
- package/dist/install.js +2 -2
- package/dist/instrument.d.ts +7 -0
- package/dist/lcms.d.ts +27 -0
- package/dist/permissions.d.ts +46 -0
- package/dist/stores/auth.d.ts +74 -2
- package/dist/stores/index.js +1 -1
- package/dist/styles.css +3316 -1216
- package/dist/templates/adapters.d.ts +14 -47
- package/dist/templates/assayLookups.d.ts +3 -0
- package/dist/templates/assayMatrixAdapters.d.ts +6 -0
- package/dist/templates/assayMatrixBuilder.d.ts +2 -0
- package/dist/templates/assayNormalizers.d.ts +4 -0
- package/dist/templates/builderDefaults.d.ts +1 -0
- package/dist/templates/builderIdUtils.d.ts +4 -0
- package/dist/templates/builderPresetControls.d.ts +10 -0
- package/dist/templates/builderReadUtils.d.ts +8 -0
- package/dist/templates/builders.d.ts +26 -63
- package/dist/templates/calibrationCurveAdapters.d.ts +4 -0
- package/dist/templates/calibrationCurveBuilder.d.ts +2 -0
- package/dist/templates/calibrationNormalizers.d.ts +5 -0
- package/dist/templates/componentBindingCatalog.d.ts +25 -0
- package/dist/templates/componentBindingHelpers.d.ts +17 -0
- package/dist/templates/componentDoseResponseProps.d.ts +3 -0
- package/dist/templates/componentGenericProps.d.ts +8 -0
- package/dist/templates/componentPlateHelpers.d.ts +5 -0
- package/dist/templates/componentPlateMapProps.d.ts +3 -0
- package/dist/templates/componentPropsFactory.d.ts +3 -0
- package/dist/templates/componentQpcrPlateProps.d.ts +3 -0
- package/dist/templates/componentTargetResolvers.d.ts +5 -0
- package/dist/templates/componentTemplateProps.d.ts +3 -0
- package/dist/templates/controlSchemaClone.d.ts +4 -0
- package/dist/templates/controlSchemaConstants.d.ts +10 -0
- package/dist/templates/controlSchemaMerge.d.ts +3 -0
- package/dist/templates/controlSchemaTargets.d.ts +17 -0
- package/dist/templates/controlSchemaTypes.d.ts +4 -0
- package/dist/templates/controlSchemas.d.ts +4 -4
- package/dist/templates/defaultBioTemplateBuilder.d.ts +2 -0
- package/dist/templates/doseResponseAdapters.d.ts +4 -0
- package/dist/templates/doseResponseBuilder.d.ts +2 -0
- package/dist/templates/elisaAssayCollectionBuilder.d.ts +2 -0
- package/dist/templates/flowCytometryAssayCollectionBuilder.d.ts +2 -0
- package/dist/templates/flowCytometryPanelBuilder.d.ts +2 -0
- package/dist/templates/flowNormalizers.d.ts +8 -0
- package/dist/templates/flowPanelAdapters.d.ts +4 -0
- package/dist/templates/index.d.ts +2 -2
- package/dist/templates/index.js +2 -2
- package/dist/templates/instrumentRunAdapterHelpers.d.ts +8 -0
- package/dist/templates/instrumentRunAdapters.d.ts +8 -0
- package/dist/templates/instrumentRunBuilder.d.ts +2 -0
- package/dist/templates/lcmsBatchCollectionBuilder.d.ts +2 -0
- package/dist/templates/plateGeometry.d.ts +4 -0
- package/dist/templates/plateMapAdapters.d.ts +3 -0
- package/dist/templates/plateMapBuilder.d.ts +2 -0
- package/dist/templates/presetControlSchemas.d.ts +534 -0
- package/dist/templates/presets.d.ts +12 -0
- package/dist/templates/protocolAdapters.d.ts +5 -0
- package/dist/templates/protocolNormalizers.d.ts +6 -0
- package/dist/templates/protocolStepsBuilder.d.ts +2 -0
- package/dist/templates/qpcrAdapters.d.ts +5 -0
- package/dist/templates/qpcrExpressionCollectionBuilder.d.ts +2 -0
- package/dist/templates/qpcrPlateBuilder.d.ts +2 -0
- package/dist/templates/reagentAdapters.d.ts +5 -0
- package/dist/templates/reagentListBuilder.d.ts +2 -0
- package/dist/templates/runNormalizers.d.ts +10 -0
- package/dist/templates/sampleNormalizers.d.ts +4 -0
- package/dist/templates/samplePrepAdapters.d.ts +4 -0
- package/dist/templates/samplePrepBuilder.d.ts +2 -0
- package/dist/templates/sampleSheetAdapters.d.ts +5 -0
- package/dist/templates/sampleSheetBuilder.d.ts +2 -0
- package/dist/templates/targetedMetabolomicsCollectionBuilder.d.ts +2 -0
- package/dist/templates/targetedMetabolomicsHelpers.d.ts +5 -0
- package/dist/templates/templateControlSchemas.d.ts +400 -0
- package/dist/templates/templateEnvelopes.d.ts +9 -0
- package/dist/templates/templatePackCollectionBuilder.d.ts +2 -0
- package/dist/templates/templatePresetCollectionBuilder.d.ts +18 -0
- package/dist/templates/templateValidators.d.ts +13 -0
- package/dist/templates/timeCourseAdapters.d.ts +5 -0
- package/dist/templates/timeCourseBuilder.d.ts +2 -0
- package/dist/templates/types.d.ts +16 -1
- package/dist/templates/wellPlateScreenCollectionBuilder.d.ts +2 -0
- package/dist/templates/westernBlotAssayCollectionBuilder.d.ts +2 -0
- package/dist/{templates-BSlxwV2c.js → templates-bUAWMn5L.js} +3610 -3154
- package/dist/templates-bUAWMn5L.js.map +1 -0
- package/dist/types/auth.d.ts +2 -0
- package/dist/types/components.d.ts +32 -3
- package/dist/types/form-builder.d.ts +2 -1
- package/dist/types/index.d.ts +4 -1
- package/dist/types/instrument.d.ts +56 -0
- package/dist/types/platform.d.ts +3 -0
- package/dist/{useExperimentData-BbbdI5xT.js → useProtocolTemplates-QZtHFFH2.js} +534 -359
- package/dist/useProtocolTemplates-QZtHFFH2.js.map +1 -0
- package/dist/utils/rack.d.ts +47 -0
- package/package.json +1 -1
- package/src/__tests__/components/AppTopBar.test.ts +15 -0
- package/src/__tests__/components/BaseTabs.test.ts +15 -0
- package/src/__tests__/components/LcmsSequenceTable.test.ts +57 -0
- package/src/__tests__/components/ProgressBar.test.ts +18 -0
- package/src/__tests__/components/RackEditor.test.ts +125 -0
- package/src/__tests__/components/SampleSelector.test.ts +25 -0
- package/src/__tests__/components/SegmentedControl.test.ts +45 -0
- package/src/__tests__/components/SequenceProgressBar.test.ts +39 -0
- package/src/__tests__/components/SettingsModal.test.ts +83 -2
- package/src/__tests__/composables/useControlSchema.test.ts +4 -0
- package/src/__tests__/composables/useExperimentData.test.ts +23 -0
- package/src/__tests__/composables/useExperimentSamples.test.ts +91 -0
- package/src/__tests__/templates/templates.test.ts +86 -0
- package/src/__tests__/utils/instrument.test.ts +47 -0
- package/src/__tests__/utils/lcms.test.ts +73 -0
- package/src/__tests__/utils/permissions.test.ts +50 -0
- package/src/__tests__/utils/rack.test.ts +120 -0
- package/src/components/AppTopBar.vue +1 -0
- package/src/components/BaseTabs.vue +22 -1
- package/src/components/InstrumentAlertLog.vue +191 -0
- package/src/components/InstrumentStateBadge.vue +50 -0
- package/src/components/InstrumentStatusCard.vue +188 -0
- package/src/components/LcmsSequenceTable.vue +191 -0
- package/src/components/ProgressBar.vue +3 -0
- package/src/components/RackEditor.vue +73 -2
- package/src/components/SampleSelector.vue +28 -9
- package/src/components/SegmentedControl.story.vue +17 -0
- package/src/components/SegmentedControl.vue +14 -3
- package/src/components/SequenceProgressBar.vue +71 -0
- package/src/components/SettingsModal.vue +42 -2
- package/src/components/WellPlate.vue +142 -21
- package/src/components/index.ts +5 -0
- package/src/components/internal/WellEditPopupInternal.vue +1 -0
- package/src/composables/controlComponentBindings.ts +80 -0
- package/src/composables/controlSchemaAdapters.ts +196 -0
- package/src/composables/controlSchemaFormFields.ts +61 -0
- package/src/composables/controlSchemaLayout.ts +59 -0
- package/src/composables/controlSchemaNormalize.ts +101 -0
- package/src/composables/controlSchemaUtils.ts +36 -0
- package/src/composables/controlWorkspaceOptions.ts +21 -0
- package/src/composables/experimentDesignData.ts +182 -0
- package/src/composables/index.ts +14 -0
- package/src/composables/useAuth.ts +4 -0
- package/src/composables/useAutoGroup.ts +5 -1
- package/src/composables/useControlSchema.ts +62 -618
- package/src/composables/useControlWorkspace.ts +207 -0
- package/src/composables/useExperimentData.ts +57 -16
- package/src/composables/useExperimentSamples.ts +142 -0
- package/src/index.ts +27 -0
- package/src/instrument.ts +90 -0
- package/src/lcms.ts +108 -0
- package/src/permissions.ts +143 -0
- package/src/stores/auth.ts +31 -3
- package/src/styles/components/instrument-monitor.css +478 -0
- package/src/styles/components/lcms-sequence-table.css +189 -0
- package/src/styles/components/sequence-progress-bar.css +63 -0
- package/src/styles/components/tabs.css +9 -0
- package/src/styles/components/well-edit-popup.css +7 -1
- package/src/styles/components/well-plate.css +5 -0
- package/src/styles/index.css +3 -0
- package/src/templates/adapters.ts +89 -930
- package/src/templates/assayLookups.ts +33 -0
- package/src/templates/assayMatrixAdapters.ts +78 -0
- package/src/templates/assayMatrixBuilder.ts +59 -0
- package/src/templates/assayNormalizers.ts +34 -0
- package/src/templates/builderDefaults.ts +11 -0
- package/src/templates/builderIdUtils.ts +20 -0
- package/src/templates/builderPresetControls.ts +165 -0
- package/src/templates/builderReadUtils.ts +57 -0
- package/src/templates/builders.ts +122 -2149
- package/src/templates/calibrationCurveAdapters.ts +59 -0
- package/src/templates/calibrationCurveBuilder.ts +99 -0
- package/src/templates/calibrationNormalizers.ts +60 -0
- package/src/templates/componentBindingCatalog.ts +90 -0
- package/src/templates/componentBindingHelpers.ts +93 -0
- package/src/templates/componentBindings.ts +12 -461
- package/src/templates/componentDoseResponseProps.ts +42 -0
- package/src/templates/componentGenericProps.ts +77 -0
- package/src/templates/componentPlateHelpers.ts +29 -0
- package/src/templates/componentPlateMapProps.ts +32 -0
- package/src/templates/componentPropsFactory.ts +21 -0
- package/src/templates/componentQpcrPlateProps.ts +28 -0
- package/src/templates/componentTargetResolvers.ts +69 -0
- package/src/templates/componentTemplateProps.ts +78 -0
- package/src/templates/controlSchemaClone.ts +32 -0
- package/src/templates/controlSchemaConstants.ts +11 -0
- package/src/templates/controlSchemaMerge.ts +40 -0
- package/src/templates/controlSchemaTargets.ts +87 -0
- package/src/templates/controlSchemaTypes.ts +20 -0
- package/src/templates/controlSchemas.ts +22 -636
- package/src/templates/defaultBioTemplateBuilder.ts +124 -0
- package/src/templates/doseResponseAdapters.ts +45 -0
- package/src/templates/doseResponseBuilder.ts +44 -0
- package/src/templates/elisaAssayCollectionBuilder.ts +62 -0
- package/src/templates/flowCytometryAssayCollectionBuilder.ts +41 -0
- package/src/templates/flowCytometryPanelBuilder.ts +53 -0
- package/src/templates/flowNormalizers.ts +58 -0
- package/src/templates/flowPanelAdapters.ts +58 -0
- package/src/templates/index.ts +2 -0
- package/src/templates/instrumentRunAdapterHelpers.ts +94 -0
- package/src/templates/instrumentRunAdapters.ts +163 -0
- package/src/templates/instrumentRunBuilder.ts +97 -0
- package/src/templates/lcmsBatchCollectionBuilder.ts +38 -0
- package/src/templates/plateGeometry.ts +62 -0
- package/src/templates/plateMapAdapters.ts +36 -0
- package/src/templates/plateMapBuilder.ts +43 -0
- package/src/templates/presetControlSchemas.ts +258 -0
- package/src/templates/presets.ts +23 -0
- package/src/templates/protocolAdapters.ts +69 -0
- package/src/templates/protocolNormalizers.ts +37 -0
- package/src/templates/protocolStepsBuilder.ts +36 -0
- package/src/templates/qpcrAdapters.ts +104 -0
- package/src/templates/qpcrExpressionCollectionBuilder.ts +33 -0
- package/src/templates/qpcrPlateBuilder.ts +96 -0
- package/src/templates/reagentAdapters.ts +77 -0
- package/src/templates/reagentListBuilder.ts +30 -0
- package/src/templates/runNormalizers.ts +63 -0
- package/src/templates/sampleNormalizers.ts +58 -0
- package/src/templates/samplePrepAdapters.ts +63 -0
- package/src/templates/samplePrepBuilder.ts +51 -0
- package/src/templates/sampleSheetAdapters.ts +75 -0
- package/src/templates/sampleSheetBuilder.ts +23 -0
- package/src/templates/targetedMetabolomicsCollectionBuilder.ts +79 -0
- package/src/templates/targetedMetabolomicsHelpers.ts +102 -0
- package/src/templates/templateControlSchemas.ts +320 -0
- package/src/templates/templateEnvelopes.ts +137 -0
- package/src/templates/templatePackCollectionBuilder.ts +23 -0
- package/src/templates/templatePresetCollectionBuilder.ts +139 -0
- package/src/templates/templateValidators.ts +414 -0
- package/src/templates/timeCourseAdapters.ts +73 -0
- package/src/templates/timeCourseBuilder.ts +64 -0
- package/src/templates/types.ts +17 -0
- package/src/templates/wellPlateScreenCollectionBuilder.ts +36 -0
- package/src/templates/westernBlotAssayCollectionBuilder.ts +68 -0
- package/src/types/auth.ts +3 -0
- package/src/types/components.ts +45 -3
- package/src/types/form-builder.ts +2 -1
- package/src/types/index.ts +35 -0
- package/src/types/instrument.ts +61 -0
- package/src/types/platform.ts +4 -0
- package/src/utils/rack.ts +209 -0
- package/dist/auth-CBG3bWEc.js.map +0 -1
- package/dist/components-5KSfsVqf.js.map +0 -1
- package/dist/composables-D4Myb30a.js.map +0 -1
- package/dist/templates-BSlxwV2c.js.map +0 -1
- package/dist/useExperimentData-BbbdI5xT.js.map +0 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { getTemplateData } from './templateEnvelopes'
|
|
2
|
+
import { validateSamplePrepData } from './templateValidators'
|
|
3
|
+
import type {
|
|
4
|
+
SamplePrepColumnsAdapterResult,
|
|
5
|
+
SamplePrepDataFrameAdapterResult,
|
|
6
|
+
SamplePrepRowsAdapterResult,
|
|
7
|
+
SamplePrepTemplate,
|
|
8
|
+
SamplePrepTemplateData,
|
|
9
|
+
} from './types'
|
|
10
|
+
|
|
11
|
+
export function toSamplePrepRows(
|
|
12
|
+
template: SamplePrepTemplate | SamplePrepTemplateData
|
|
13
|
+
): SamplePrepRowsAdapterResult {
|
|
14
|
+
const data = getTemplateData(template, 'sample-prep')
|
|
15
|
+
validateSamplePrepData(data)
|
|
16
|
+
return [...data.steps]
|
|
17
|
+
.sort((a, b) => a.order - b.order)
|
|
18
|
+
.map(step => ({
|
|
19
|
+
id: step.id,
|
|
20
|
+
order: step.order,
|
|
21
|
+
type: step.type,
|
|
22
|
+
name: step.name,
|
|
23
|
+
sourceSampleId: step.sourceSampleId,
|
|
24
|
+
sourceWellId: step.sourceWellId,
|
|
25
|
+
destinationSampleId: step.destinationSampleId,
|
|
26
|
+
destinationWellId: step.destinationWellId,
|
|
27
|
+
reagentId: step.reagentId,
|
|
28
|
+
inputVolume: step.inputVolume,
|
|
29
|
+
outputVolume: step.outputVolume,
|
|
30
|
+
volumeUnit: step.volumeUnit,
|
|
31
|
+
durationMin: step.durationMin,
|
|
32
|
+
status: step.status,
|
|
33
|
+
protocolName: data.protocolName,
|
|
34
|
+
...(step.metadata ?? {}),
|
|
35
|
+
}))
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function toSamplePrepColumns(): SamplePrepColumnsAdapterResult {
|
|
39
|
+
return [
|
|
40
|
+
{ key: 'order', label: 'Order', sortable: true, align: 'right' },
|
|
41
|
+
{ key: 'type', label: 'Type', sortable: true },
|
|
42
|
+
{ key: 'name', label: 'Step', sortable: true },
|
|
43
|
+
{ key: 'sourceSampleId', label: 'Source', sortable: true },
|
|
44
|
+
{ key: 'sourceWellId', label: 'Source well', sortable: true },
|
|
45
|
+
{ key: 'destinationSampleId', label: 'Destination', sortable: true },
|
|
46
|
+
{ key: 'destinationWellId', label: 'Destination well', sortable: true },
|
|
47
|
+
{ key: 'reagentId', label: 'Reagent', sortable: true },
|
|
48
|
+
{ key: 'inputVolume', label: 'Input', sortable: true, align: 'right' },
|
|
49
|
+
{ key: 'outputVolume', label: 'Output', sortable: true, align: 'right' },
|
|
50
|
+
{ key: 'volumeUnit', label: 'Unit', sortable: true },
|
|
51
|
+
{ key: 'status', label: 'Status', sortable: true },
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function toSamplePrepDataFrame(
|
|
56
|
+
template: SamplePrepTemplate | SamplePrepTemplateData
|
|
57
|
+
): SamplePrepDataFrameAdapterResult {
|
|
58
|
+
return {
|
|
59
|
+
data: toSamplePrepRows(template),
|
|
60
|
+
columns: toSamplePrepColumns(),
|
|
61
|
+
rowKey: 'id',
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { idFromName } from './builderIdUtils'
|
|
2
|
+
import { normalizeSamplePrepStep } from './sampleNormalizers'
|
|
3
|
+
import { createTemplateEnvelope } from './templateEnvelopes'
|
|
4
|
+
import { validateSamplePrepData } from './templateValidators'
|
|
5
|
+
import type {
|
|
6
|
+
CreateSamplePrepTemplateOptions,
|
|
7
|
+
SamplePrepStep,
|
|
8
|
+
SamplePrepTemplate,
|
|
9
|
+
SamplePrepTemplateData,
|
|
10
|
+
} from './types'
|
|
11
|
+
|
|
12
|
+
export function createSamplePrepTemplate(
|
|
13
|
+
options: CreateSamplePrepTemplateOptions
|
|
14
|
+
): SamplePrepTemplate {
|
|
15
|
+
const prepType = options.prepType ?? 'extraction'
|
|
16
|
+
const volumeUnit = options.volumeUnit ?? 'uL'
|
|
17
|
+
const steps: SamplePrepStep[] = []
|
|
18
|
+
let order = 1
|
|
19
|
+
|
|
20
|
+
for (const [index, sample] of options.samples.entries()) {
|
|
21
|
+
if (typeof sample !== 'string') {
|
|
22
|
+
const step = normalizeSamplePrepStep(sample, prepType, volumeUnit, order, index)
|
|
23
|
+
steps.push(step)
|
|
24
|
+
order = Math.max(order, step.order + 1)
|
|
25
|
+
continue
|
|
26
|
+
}
|
|
27
|
+
const sourceSampleId = idFromName(sample, `sample-${index + 1}`)
|
|
28
|
+
steps.push({
|
|
29
|
+
id: `${sourceSampleId}-prep`,
|
|
30
|
+
order,
|
|
31
|
+
type: prepType,
|
|
32
|
+
name: `Prepare ${sample}`,
|
|
33
|
+
sourceSampleId,
|
|
34
|
+
destinationSampleId: `${sourceSampleId}-prepared`,
|
|
35
|
+
inputVolume: options.inputVolume,
|
|
36
|
+
outputVolume: options.outputVolume,
|
|
37
|
+
volumeUnit,
|
|
38
|
+
status: 'planned',
|
|
39
|
+
metadata: {},
|
|
40
|
+
})
|
|
41
|
+
order += 1
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const data: SamplePrepTemplateData = {
|
|
45
|
+
protocolName: options.protocolName ?? 'Sample preparation',
|
|
46
|
+
steps,
|
|
47
|
+
metadata: options.metadata ?? {},
|
|
48
|
+
}
|
|
49
|
+
validateSamplePrepData(data)
|
|
50
|
+
return createTemplateEnvelope('sample-prep', data, options.metadata ?? {})
|
|
51
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
DataFrameColumn,
|
|
3
|
+
SelectOption,
|
|
4
|
+
} from '../types'
|
|
5
|
+
import { getTemplateData } from './templateEnvelopes'
|
|
6
|
+
import { validateSampleSheetData } from './templateValidators'
|
|
7
|
+
import type {
|
|
8
|
+
SampleColumnsAdapterResult,
|
|
9
|
+
SampleDataFrameAdapterResult,
|
|
10
|
+
SampleOptionsAdapterResult,
|
|
11
|
+
SampleRowsAdapterResult,
|
|
12
|
+
SampleSheetTemplate,
|
|
13
|
+
SampleSheetTemplateData,
|
|
14
|
+
} from './types'
|
|
15
|
+
|
|
16
|
+
export function toSampleRows(
|
|
17
|
+
template: SampleSheetTemplate | SampleSheetTemplateData
|
|
18
|
+
): SampleRowsAdapterResult {
|
|
19
|
+
const data = getTemplateData(template, 'sample-sheet')
|
|
20
|
+
validateSampleSheetData(data)
|
|
21
|
+
return data.samples.map(sample => ({
|
|
22
|
+
sampleId: sample.sampleId,
|
|
23
|
+
name: sample.name,
|
|
24
|
+
group: sample.group,
|
|
25
|
+
batch: sample.batch,
|
|
26
|
+
replicate: sample.replicate,
|
|
27
|
+
plateId: sample.plateId,
|
|
28
|
+
wellId: sample.wellId,
|
|
29
|
+
...(sample.metadata ?? {}),
|
|
30
|
+
}))
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function toSampleColumns(
|
|
34
|
+
template: SampleSheetTemplate | SampleSheetTemplateData
|
|
35
|
+
): SampleColumnsAdapterResult {
|
|
36
|
+
const data = getTemplateData(template, 'sample-sheet')
|
|
37
|
+
validateSampleSheetData(data)
|
|
38
|
+
return data.columns.map((column): DataFrameColumn<Record<string, unknown>> => ({
|
|
39
|
+
key: sampleColumnKey(column.id),
|
|
40
|
+
label: column.label,
|
|
41
|
+
sortable: true,
|
|
42
|
+
align: column.type === 'number' || column.type === 'integer' ? 'right' : 'left',
|
|
43
|
+
}))
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function toSampleDataFrame(
|
|
47
|
+
template: SampleSheetTemplate | SampleSheetTemplateData
|
|
48
|
+
): SampleDataFrameAdapterResult {
|
|
49
|
+
return {
|
|
50
|
+
data: toSampleRows(template),
|
|
51
|
+
columns: toSampleColumns(template),
|
|
52
|
+
rowKey: 'sampleId',
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function toSampleOptions(
|
|
57
|
+
template: SampleSheetTemplate | SampleSheetTemplateData
|
|
58
|
+
): SampleOptionsAdapterResult {
|
|
59
|
+
const data = getTemplateData(template, 'sample-sheet')
|
|
60
|
+
validateSampleSheetData(data)
|
|
61
|
+
return data.samples.map((sample): SelectOption<string> => ({
|
|
62
|
+
value: sample.sampleId,
|
|
63
|
+
label: sample.name ?? sample.sampleId,
|
|
64
|
+
description: [sample.group, sample.batch].filter(Boolean).join(' / ') || undefined,
|
|
65
|
+
}))
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function sampleColumnKey(columnId: string): string {
|
|
69
|
+
const aliases: Record<string, string> = {
|
|
70
|
+
sample_id: 'sampleId',
|
|
71
|
+
plate_id: 'plateId',
|
|
72
|
+
well_id: 'wellId',
|
|
73
|
+
}
|
|
74
|
+
return aliases[columnId] ?? columnId
|
|
75
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { normalizeSampleRecord } from './sampleNormalizers'
|
|
2
|
+
import { createTemplateEnvelope } from './templateEnvelopes'
|
|
3
|
+
import { validateSampleSheetData } from './templateValidators'
|
|
4
|
+
import type {
|
|
5
|
+
CreateSampleSheetTemplateOptions,
|
|
6
|
+
SampleSheetTemplate,
|
|
7
|
+
SampleSheetTemplateData,
|
|
8
|
+
} from './types'
|
|
9
|
+
|
|
10
|
+
export function createSampleSheetTemplate(
|
|
11
|
+
options: CreateSampleSheetTemplateOptions
|
|
12
|
+
): SampleSheetTemplate {
|
|
13
|
+
const data: SampleSheetTemplateData = {
|
|
14
|
+
samples: options.samples.map(normalizeSampleRecord),
|
|
15
|
+
columns: options.columns ?? [
|
|
16
|
+
{ id: 'sampleId', label: 'Sample ID', type: 'string', required: true, groupable: false },
|
|
17
|
+
{ id: 'name', label: 'Name', type: 'string', required: false, groupable: false },
|
|
18
|
+
],
|
|
19
|
+
groups: options.groups ?? [],
|
|
20
|
+
}
|
|
21
|
+
validateSampleSheetData(data)
|
|
22
|
+
return createTemplateEnvelope('sample-sheet', data, options.metadata ?? {})
|
|
23
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { createAssayMatrixTemplate } from './assayMatrixBuilder'
|
|
2
|
+
import { createCalibrationCurveTemplate } from './calibrationCurveBuilder'
|
|
3
|
+
import { createInstrumentRunTemplate } from './instrumentRunBuilder'
|
|
4
|
+
import { createReagentListTemplate } from './reagentListBuilder'
|
|
5
|
+
import { createSamplePrepTemplate } from './samplePrepBuilder'
|
|
6
|
+
import { createSampleSheetTemplate } from './sampleSheetBuilder'
|
|
7
|
+
import { presetSampleRecords } from './sampleNormalizers'
|
|
8
|
+
import {
|
|
9
|
+
firstFeatureName,
|
|
10
|
+
normalizeInternalStandardReagents,
|
|
11
|
+
normalizeMetaboliteFeatures,
|
|
12
|
+
targetedMetabolomicsRunItems,
|
|
13
|
+
} from './targetedMetabolomicsHelpers'
|
|
14
|
+
import { createTemplateCollection } from './templateEnvelopes'
|
|
15
|
+
import type {
|
|
16
|
+
CreateTargetedMetabolomicsCollectionOptions,
|
|
17
|
+
TemplateCollectionEnvelope,
|
|
18
|
+
} from './types'
|
|
19
|
+
|
|
20
|
+
export function createTargetedMetabolomicsCollection(
|
|
21
|
+
options: CreateTargetedMetabolomicsCollectionOptions = {}
|
|
22
|
+
): TemplateCollectionEnvelope {
|
|
23
|
+
const sampleRecords = presetSampleRecords(options.samples ?? ['S001', 'S002'])
|
|
24
|
+
const responseUnit = options.responseUnit ?? 'peak area ratio'
|
|
25
|
+
const concentrationUnit = options.concentrationUnit ?? 'uM'
|
|
26
|
+
const metaboliteFeatures = normalizeMetaboliteFeatures(
|
|
27
|
+
options.metabolites ?? ['Glucose', 'Lactate', 'Pyruvate'],
|
|
28
|
+
responseUnit,
|
|
29
|
+
)
|
|
30
|
+
const sampleSheet = createSampleSheetTemplate({ samples: sampleRecords })
|
|
31
|
+
const samplePrep = createSamplePrepTemplate({
|
|
32
|
+
samples: sampleRecords.map(sample => sample.sampleId),
|
|
33
|
+
prepType: options.prepType ?? 'extraction',
|
|
34
|
+
protocolName: 'Metabolomics sample preparation',
|
|
35
|
+
outputVolume: options.outputVolume ?? 50,
|
|
36
|
+
metadata: { assay: 'targeted-metabolomics' },
|
|
37
|
+
})
|
|
38
|
+
const reagents = createReagentListTemplate({
|
|
39
|
+
reagents: normalizeInternalStandardReagents(
|
|
40
|
+
options.internalStandards ?? ['Stable isotope internal standard mix'],
|
|
41
|
+
),
|
|
42
|
+
metadata: { assay: 'targeted-metabolomics' },
|
|
43
|
+
})
|
|
44
|
+
const calibrationCurve = createCalibrationCurveTemplate({
|
|
45
|
+
concentrations: options.standardConcentrations ?? [0.1, 1, 10, 100],
|
|
46
|
+
analyte: options.calibrationAnalyte ?? firstFeatureName(metaboliteFeatures, 'Metabolite panel'),
|
|
47
|
+
unit: concentrationUnit,
|
|
48
|
+
responseUnit,
|
|
49
|
+
model: 'linear-weighted-1-x',
|
|
50
|
+
includeQc: options.includeQc,
|
|
51
|
+
metadata: { assay: 'targeted-metabolomics' },
|
|
52
|
+
})
|
|
53
|
+
const instrumentRun = createInstrumentRunTemplate({
|
|
54
|
+
items: targetedMetabolomicsRunItems(
|
|
55
|
+
sampleRecords,
|
|
56
|
+
calibrationCurve.data.points,
|
|
57
|
+
options.includeQc !== false,
|
|
58
|
+
),
|
|
59
|
+
method: options.method ?? 'Targeted metabolomics',
|
|
60
|
+
instrument: options.instrument ?? 'LC-MS',
|
|
61
|
+
includeBlanks: false,
|
|
62
|
+
includeQc: false,
|
|
63
|
+
metadata: { assay: 'targeted-metabolomics' },
|
|
64
|
+
})
|
|
65
|
+
const assayMatrix = createAssayMatrixTemplate({
|
|
66
|
+
samples: sampleRecords.map(sample => ({
|
|
67
|
+
sampleId: sample.sampleId,
|
|
68
|
+
name: sample.name,
|
|
69
|
+
group: sample.group,
|
|
70
|
+
metadata: sample.metadata ?? {},
|
|
71
|
+
})),
|
|
72
|
+
features: metaboliteFeatures,
|
|
73
|
+
metadata: { assay: 'targeted-metabolomics', responseUnit },
|
|
74
|
+
})
|
|
75
|
+
return createTemplateCollection(
|
|
76
|
+
[sampleSheet, samplePrep, reagents, instrumentRun, calibrationCurve, assayMatrix],
|
|
77
|
+
{ preset: 'targeted-metabolomics', ...(options.metadata ?? {}) }
|
|
78
|
+
)
|
|
79
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AssayFeature,
|
|
3
|
+
CalibrationPoint,
|
|
4
|
+
InstrumentRunItemInput,
|
|
5
|
+
ReagentTemplateInput,
|
|
6
|
+
SampleRecord,
|
|
7
|
+
} from './types'
|
|
8
|
+
import {
|
|
9
|
+
normalizeAssayFeature,
|
|
10
|
+
normalizeReagent,
|
|
11
|
+
} from './assayNormalizers'
|
|
12
|
+
import { idFromName } from './builderIdUtils'
|
|
13
|
+
|
|
14
|
+
export function normalizeMetaboliteFeatures(
|
|
15
|
+
metabolites: Array<string | AssayFeature>,
|
|
16
|
+
responseUnit: string,
|
|
17
|
+
): AssayFeature[] {
|
|
18
|
+
return metabolites.map((metabolite, index) => {
|
|
19
|
+
if (typeof metabolite === 'string') {
|
|
20
|
+
return {
|
|
21
|
+
id: idFromName(metabolite, `metabolite-${index + 1}`),
|
|
22
|
+
name: metabolite,
|
|
23
|
+
type: 'metabolite',
|
|
24
|
+
unit: responseUnit,
|
|
25
|
+
metadata: { quantitation: 'targeted' },
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const feature = normalizeAssayFeature(metabolite)
|
|
30
|
+
return {
|
|
31
|
+
...feature,
|
|
32
|
+
type: feature.type ?? 'metabolite',
|
|
33
|
+
unit: feature.unit ?? responseUnit,
|
|
34
|
+
metadata: {
|
|
35
|
+
quantitation: 'targeted',
|
|
36
|
+
...feature.metadata,
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function normalizeInternalStandardReagents(
|
|
43
|
+
internalStandards: Array<string | ReagentTemplateInput>,
|
|
44
|
+
): ReagentTemplateInput[] {
|
|
45
|
+
return internalStandards.map((standard, index) => {
|
|
46
|
+
if (typeof standard === 'string') {
|
|
47
|
+
return {
|
|
48
|
+
id: idFromName(standard, `internal-standard-${index + 1}`),
|
|
49
|
+
name: standard,
|
|
50
|
+
kind: 'compound',
|
|
51
|
+
metadata: { role: 'internal-standard' },
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const reagent = normalizeReagent(standard)
|
|
56
|
+
return {
|
|
57
|
+
...reagent,
|
|
58
|
+
kind: standard.kind ?? 'compound',
|
|
59
|
+
metadata: {
|
|
60
|
+
role: 'internal-standard',
|
|
61
|
+
...reagent.metadata,
|
|
62
|
+
},
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function targetedMetabolomicsRunItems(
|
|
68
|
+
samples: SampleRecord[],
|
|
69
|
+
calibrationPoints: CalibrationPoint[],
|
|
70
|
+
includeQc: boolean,
|
|
71
|
+
): InstrumentRunItemInput[] {
|
|
72
|
+
const calibrationItems = calibrationPoints
|
|
73
|
+
.filter(point => point.role !== 'qc' || includeQc)
|
|
74
|
+
.filter(point => point.role === 'blank' || point.role === 'standard' || point.role === 'qc')
|
|
75
|
+
.map((point): InstrumentRunItemInput => ({
|
|
76
|
+
id: `${point.id}-run`,
|
|
77
|
+
kind: calibrationRunItemKind(point.role),
|
|
78
|
+
name: point.level,
|
|
79
|
+
metadata: {
|
|
80
|
+
concentration: point.concentration,
|
|
81
|
+
unit: point.unit,
|
|
82
|
+
role: point.role,
|
|
83
|
+
},
|
|
84
|
+
}))
|
|
85
|
+
|
|
86
|
+
const sampleItems = samples.map((sample): InstrumentRunItemInput => ({
|
|
87
|
+
sampleId: sample.sampleId,
|
|
88
|
+
name: sample.name ?? sample.sampleId,
|
|
89
|
+
kind: 'sample',
|
|
90
|
+
}))
|
|
91
|
+
|
|
92
|
+
return [...calibrationItems, ...sampleItems]
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function firstFeatureName(features: AssayFeature[], fallback: string): string {
|
|
96
|
+
return features.find(feature => feature.name)?.name ?? fallback
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function calibrationRunItemKind(role: CalibrationPoint['role']): 'blank' | 'standard' | 'qc' {
|
|
100
|
+
if (role === 'blank' || role === 'standard' || role === 'qc') return role
|
|
101
|
+
return 'standard'
|
|
102
|
+
}
|