import { getTemplateData } from './templateEnvelopes' import { validateFlowCytometryPanelData } from './templateValidators' import type { FlowCytometryPanelTemplate, FlowCytometryPanelTemplateData, FlowPanelColumnsAdapterResult, FlowPanelDataFrameAdapterResult, FlowPanelRowsAdapterResult, } from './types' /** @deprecated Scheduled for removal from the core SDK in MINT 1.4; the biology templates move to a dedicated package or the owning plugins. */ export function toFlowPanelRows( template: FlowCytometryPanelTemplate | FlowCytometryPanelTemplateData ): FlowPanelRowsAdapterResult { const data = getTemplateData(template, 'flow-cytometry-panel') validateFlowCytometryPanelData(data) return data.markers.map(marker => { const markerControls = data.controls .filter(control => control.markerId === marker.id) .map(control => control.name) .join(', ') return { id: marker.id, marker: marker.marker, fluorophore: marker.fluorophore, detector: marker.detector, clone: marker.clone, reagentId: marker.reagentId, purpose: marker.purpose, compensationRequired: marker.compensationRequired, controls: markerControls, instrument: data.instrument, ...(marker.metadata ?? {}), } }) } /** @deprecated Scheduled for removal from the core SDK in MINT 1.4; the biology templates move to a dedicated package or the owning plugins. */ export function toFlowPanelColumns(): FlowPanelColumnsAdapterResult { return [ { key: 'marker', label: 'Marker', sortable: true }, { key: 'fluorophore', label: 'Fluorophore', sortable: true }, { key: 'detector', label: 'Detector', sortable: true }, { key: 'clone', label: 'Clone', sortable: true }, { key: 'purpose', label: 'Purpose', sortable: true }, { key: 'compensationRequired', label: 'Compensation', sortable: true }, { key: 'controls', label: 'Controls' }, { key: 'instrument', label: 'Instrument', sortable: true }, ] } /** @deprecated Scheduled for removal from the core SDK in MINT 1.4; the biology templates move to a dedicated package or the owning plugins. */ export function toFlowPanelDataFrame( template: FlowCytometryPanelTemplate | FlowCytometryPanelTemplateData ): FlowPanelDataFrameAdapterResult { return { data: toFlowPanelRows(template), columns: toFlowPanelColumns(), rowKey: 'id', } }