Skip to content

Commit

Permalink
feat(shared-data): Support nozzle layouts in well selection (#16441)
Browse files Browse the repository at this point in the history
Works towards RSQ-161

When we want a well set relevant to a specific pipette's interaction with a specific labware, we use a helper, getWellSetForMultichannel. This works great, but it doesn't have the ability to return relevant wells given a nozzle layout. So for example, if the pipette has a nozzle layout of "column" on a 96 channel, and the well of interest is A2, all 96-wells are returned.

This PR adds support for all current nozzle layouts, which are generally utilized in the context of partial tip configs.

In nozzle configurations which do not naturally incorporate the entire row/column (this is only the 8-channel column config with <8 nozzles, currently), return thewellName and the number of relevant wells "lower" than that well name. Ex, if B1 is the wellName and the active nozzle count is 4, return B1-E1.

If less wells are available than the activeNozzleCount, return fewer wells.
  • Loading branch information
mjhuff authored Oct 9, 2024
1 parent 0567d36 commit b808a54
Show file tree
Hide file tree
Showing 8 changed files with 405 additions and 158 deletions.
2 changes: 1 addition & 1 deletion api-client/src/runs/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type {
RunCommandError,
RunTimeCommand,
RunTimeParameter,
NozzleLayoutConfig,
} from '@opentrons/shared-data'
import type { ResourceLink, ErrorDetails } from '../types'
export * from './commands/types'
Expand Down Expand Up @@ -200,4 +201,3 @@ export interface NozzleLayoutValues {
activeNozzles: string[]
config: NozzleLayoutConfig
}
export type NozzleLayoutConfig = 'column' | 'row' | 'full' | 'subrect'
22 changes: 13 additions & 9 deletions app/src/organisms/WellSelection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ export function WellSelection(props: WellSelectionProps): JSX.Element {
const primaryWells: WellGroup = reduce(
selectedWells,
(acc: WellGroup, _, wellName: string): WellGroup => {
const wellSet = getWellSetForMultichannel(
definition,
const wellSet = getWellSetForMultichannel({
labwareDef: definition,
wellName,
channels
)
channels,
})
if (!wellSet) return acc
return { ...acc, [wellSet[0]]: null }
},
Expand All @@ -74,7 +74,11 @@ export function WellSelection(props: WellSelectionProps): JSX.Element {
selectedWells,
(acc: WellGroup, _, wellName: string): WellGroup => {
const wellSetForMulti =
getWellSetForMultichannel(definition, wellName, channels) || []
getWellSetForMultichannel({
labwareDef: definition,
wellName,
channels,
}) || []
const channelWells = arrayToWellGroup(wellSetForMulti)
return {
...acc,
Expand Down Expand Up @@ -102,11 +106,11 @@ export function WellSelection(props: WellSelectionProps): JSX.Element {
? reduce<WellGroup, WellGroup>(
selectedPrimaryWells,
(acc, _, wellName): WellGroup => {
const wellSet = getWellSetForMultichannel(
definition,
const wellSet = getWellSetForMultichannel({
labwareDef: definition,
wellName,
channels
)
channels,
})
if (!wellSet) return acc
return { ...acc, ...arrayToWellGroup(wellSet) }
},
Expand Down
23 changes: 12 additions & 11 deletions protocol-designer/src/components/labware/SelectableLabware.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ export const SelectableLabware = (props: Props): JSX.Element => {
const primaryWells: WellGroup = reduce(
selectedWells,
(acc: WellGroup, _, wellName: string): WellGroup => {
const wellSet = getWellSetForMultichannel(
const wellSet = getWellSetForMultichannel({
labwareDef,
wellName,
channels
)
channels,
})
if (!wellSet) return acc
return { ...acc, [wellSet[0]]: null }
},
Expand Down Expand Up @@ -109,7 +109,8 @@ export const SelectableLabware = (props: Props): JSX.Element => {
selectedWells,
(acc: WellGroup, _, wellName: string): WellGroup => {
const wellSetForMulti =
getWellSetForMultichannel(labwareDef, wellName, channels) || []
getWellSetForMultichannel({ labwareDef, wellName, channels }) ||
[]
const channelWells = arrayToWellGroup(wellSetForMulti)
return {
...acc,
Expand Down Expand Up @@ -144,11 +145,11 @@ export const SelectableLabware = (props: Props): JSX.Element => {
const handleMouseEnterWell: (args: WellMouseEvent) => void = args => {
if (nozzleType != null) {
const channels = getChannelsFromNozleType(nozzleType)
const wellSet = getWellSetForMultichannel(
const wellSet = getWellSetForMultichannel({
labwareDef,
args.wellName,
channels
)
wellName: args.wellName,
channels,
})
const nextHighlightedWells = arrayToWellGroup(wellSet || [])
nextHighlightedWells && updateHighlightedWells(nextHighlightedWells)
} else {
Expand All @@ -163,11 +164,11 @@ export const SelectableLabware = (props: Props): JSX.Element => {
selectedPrimaryWells,
(acc, _, wellName): WellGroup => {
const channels = getChannelsFromNozleType(nozzleType)
const wellSet = getWellSetForMultichannel(
const wellSet = getWellSetForMultichannel({
labwareDef,
wellName,
channels
)
channels,
})
if (!wellSet) return acc
return { ...acc, ...arrayToWellGroup(wellSet) }
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ export function getAllWellsFromPrimaryWells(
channels: 8 | 96
): string[] {
const allWells = primaryWells.reduce((acc: string[], well: string) => {
const nextWellSet = getWellSetForMultichannel(labwareDef, well, channels)
const nextWellSet = getWellSetForMultichannel({
labwareDef,
wellName: well,
channels,
})

// filter out any nulls (but you shouldn't get any)
if (!nextWellSet) {
Expand Down
20 changes: 10 additions & 10 deletions protocol-designer/src/top-selectors/substep-highlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ function _getSelectedWellsForStep(
wells.push(commandWellName)
} else if (channels === 8 || channels === 96) {
const wellSet =
getWellSetForMultichannel(
invariantContext.labwareEntities[labwareId].def,
commandWellName,
channels
) || []
getWellSetForMultichannel({
labwareDef: invariantContext.labwareEntities[labwareId].def,
wellName: commandWellName,
channels,
}) || []
wells.push(...wellSet)
} else {
console.error(
Expand Down Expand Up @@ -241,11 +241,11 @@ function _getSelectedWellsForSubstep(
activeTips.labwareId === labwareId &&
channels !== 1
) {
const multiTipWellSet = getWellSetForMultichannel(
invariantContext.labwareEntities[labwareId].def,
activeTips.wellName,
channels
)
const multiTipWellSet = getWellSetForMultichannel({
labwareDef: invariantContext.labwareEntities[labwareId].def,
wellName: activeTips.wellName,
channels,
})
if (multiTipWellSet) tipWellSet = multiTipWellSet
}
} else {
Expand Down
Loading

0 comments on commit b808a54

Please sign in to comment.