-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DPL-954: colour code wells on arraying page #1580
Changes from 26 commits
138df61
9317909
ecf096a
d3a1e74
eabd1cb
2bd15f4
9ea2290
f6412dc
d0043ba
9179b19
e75f7e2
5d77c56
e8139ba
697040d
6591d9c
9023d86
c3cd4e6
fa4078a
055aafd
e174b10
4799042
176560a
9735757
593210e
391f769
d5cbfa5
5338e75
7faf96f
b4746cc
89b49b8
4ded3e7
826d23c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've had some trouble working out the data structure we're expecting for inputs and outputs of certain functions. Could we add docs, for example the following above the
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea, started addressing in b4746cc, but more to come There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. More added in 4ded3e7 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And in 826d23c There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Definitely helps with understanding what is going on in the component! |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,15 +2,14 @@ | |
<lb-page> | ||
<lb-loading-modal v-if="loading" :message="progressMessage" /> | ||
<lb-main-content> | ||
<b-card bg-variant="dark" text-variant="white"> | ||
<b-card bg-variant="dark" text-variant="white" :header="header" header-tag="h3"> | ||
<lb-plate | ||
caption="Layout of the new plate" | ||
:rows="targetRowsNumber" | ||
:columns="targetColumnsNumber" | ||
:wells="targetWells" | ||
/> | ||
</b-card> | ||
<b-card bg-variant="dark" text-variant="white"> | ||
<hr /> | ||
<lb-tube-array-summary :tubes="tubes" /> | ||
</b-card> | ||
</lb-main-content> | ||
|
@@ -28,7 +27,7 @@ | |
:includes="tubeIncludes" | ||
:fields="tubeFields" | ||
:validators="scanValidation" | ||
:colour-index="i" | ||
:colour-index="colourIndex(i - 1)" | ||
:labware-type="'tube'" | ||
:valid-message="''" | ||
@change="updateTube(i, $event)" | ||
|
@@ -60,7 +59,7 @@ import resources from 'shared/resources' | |
import { transferTubesCreator } from 'shared/transfersCreators' | ||
import { transfersForTubes } from 'shared/transfersLayouts' | ||
import { buildTubeObjs } from 'shared/tubeHelpers' | ||
import { indexToName } from 'shared/wellHelpers' | ||
import { findUniqueIndex, indexToName } from 'shared/wellHelpers' | ||
import MultiStampTubesTransfers from './MultiStampTubesTransfers' | ||
import TubeArraySummary from './TubeArraySummary' | ||
import filterProps from './filterProps' | ||
|
@@ -99,6 +98,12 @@ export default { | |
// Limber plate purpose UUID | ||
purposeUuid: { type: String, required: true }, | ||
|
||
// Limber plate purpose name | ||
purposeName: { type: String, required: true }, | ||
|
||
// Limber parent purpose name | ||
parentPurposeName: { type: String, required: true }, | ||
|
||
// Limber target Asset URL for posting the transfers | ||
targetUrl: { type: String, required: true }, | ||
|
||
|
@@ -161,6 +166,9 @@ export default { | |
} | ||
}, | ||
computed: { | ||
header() { | ||
return `Sample Arraying: ${this.parentPurposeName} → ${this.purposeName}` | ||
}, | ||
sourceTubeNumber() { | ||
return Number.parseInt(this.sourceTubes) | ||
}, | ||
|
@@ -204,13 +212,14 @@ export default { | |
// ... | ||
// } | ||
targetWells() { | ||
const wells = {} | ||
for (let i = 0; i < this.validTransfers.length; i++) { | ||
wells[this.validTransfers[i].targetWell] = { | ||
pool_index: this.validTransfers[i].tubeObj.index + 1, | ||
return this.validTransfers.reduce((acc, transfer) => { | ||
const tubeIndex = transfer.tubeObj.index | ||
acc[transfer.targetWell] = { | ||
colour_index: this.colourIndex(tubeIndex), | ||
human_barcode: this.tubes[tubeIndex].labware.labware_barcode.human_barcode, | ||
StephenHulme marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
return wells | ||
return acc | ||
}, {}) | ||
StephenHulme marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
tubeIncludes() { | ||
return filterProps.tubeIncludes | ||
|
@@ -236,6 +245,23 @@ export default { | |
wellIndexToName(index) { | ||
return indexToName(index, this.targetRowsNumber) | ||
}, | ||
colourIndex(tubeIndex) { | ||
StephenHulme marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// determine the colour of the tube | ||
let colour_index = -1 | ||
|
||
const tube = this.tubes[tubeIndex] | ||
if (tube.state !== 'valid') return colour_index | ||
|
||
const tube_machine_barcode = tube.labware.labware_barcode.machine_barcode | ||
const tube_machine_barcodes = this.tubes | ||
.filter((tube) => tube.state === 'valid') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TubeArraySummary checks against There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I must admit, I'm a little fuzzy on which states mean what. As far as I can tell, |
||
.map((tube) => tube.labware.labware_barcode.machine_barcode) | ||
|
||
const barcode_index = findUniqueIndex(tube_machine_barcodes, tube_machine_barcode) | ||
if (barcode_index !== -1) colour_index = barcode_index + 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Annoying that the css colours list doesn't start at 0. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. I'm strongly considering refactoring the colours logic at some point soon. |
||
|
||
return colour_index | ||
}, | ||
updateTube(index, data) { | ||
this.$set(this.tubes, index - 1, { ...data, index: index - 1 }) | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondered if there were tests for the individual Vue components.
Also wondered what happens when they remove the last instance of a barcode from the scan boxes, does it free up that colour index to be used for the next new unique barcode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It probably shouldn't right, if that one they delete was in the middle of the colour list you don't want complications with latter ones being re-coloured.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Vue component testing is a little shaky right now, but that aside for the moment, the colours are calculated from the order that the barcodes are entered at any one moment. Deleting the last barcode will allow that colour to be reused on the subsequent barcode. Deleting the barcode will cause all other codes to be shifted up by one. This is currently a technical limitation, but could be altered if we decide it's worth the extra effort.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added tests in 9735757 to show the behaviour of changing barcodes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleting the barcode will cause all other codes to be shifted up by one.
As in it shifts them up into new rack locations? I think that would be bad if that's what you mean, as they are probably physically placing the tubes in a rack as they scan them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you mean just shifted in colour index then that's acceptable I think. The colours are just a visual aid to see where the replicates are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry, yes that comment was unclear...
Removing a barcode will cause all assigned colours to shift up by 1, the second explanation is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that functionality too, the colours changing when you remove a barcode. I thought it was ok.