Skip to content

Commit

Permalink
Merge pull request #2087 from sanger/develop
Browse files Browse the repository at this point in the history
Release 10.9.3
  • Loading branch information
sabrine33 authored Dec 4, 2024
2 parents 634ccb1 + 392b2c5 commit 32d333e
Show file tree
Hide file tree
Showing 135 changed files with 7,724 additions and 21,033 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/generate_pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
Expand Down
2 changes: 1 addition & 1 deletion .release-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.9.2
10.9.3
814 changes: 532 additions & 282 deletions package-lock.json

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@
},
"dependencies": {
"@sanger/ui-styling": "^4.1.0",
"@vitejs/plugin-vue": "^5.1.4",
"@vitejs/plugin-vue": "^5.2.0",
"autoprefixer": "^10.4.20",
"axios": "^1.7.7",
"csv-parse": "^5.5.6",
"global": "^4.4.0",
"lodash-es": "^4.17.21",
"pinia": "^2.2.6",
"postcss": "^8.4.47",
"postcss": "^8.4.49",
"swrv": "^1.0.4",
"tailwindcss": "3.4.14",
"vite": "^5.4.10",
"vue": "^3.5.12",
"tailwindcss": "3.4.15",
"vite": "^5.4.11",
"vue": "^3.5.13",
"vue-router": "^4.4.5",
"vue3-selecto": "^1.12.3",
"vuex": "^4.1.0"
Expand All @@ -46,20 +46,20 @@
"@pinia/testing": "^0.1.7",
"@vue/test-utils": "^2.4.6",
"clean-jsdoc-theme": "^4.3.0",
"cypress": "^13.15.2",
"cypress": "^13.16.0",
"cypress-file-upload": "^5.0.8",
"dotenv": "^16.4.5",
"eslint": "^9.14.0",
"eslint": "^9.15.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-cypress": "^4.1.0",
"eslint-plugin-vue": "^9.30.0",
"globals": "^15.11.0",
"eslint-plugin-vue": "^9.31.0",
"globals": "^15.12.0",
"jsdoc": "^4.0.4",
"jsdom": "^25.0.1",
"npm-run-all": "^4.1.5",
"postcss-cli": "^11.0.0",
"prettier": "3.3.3",
"rollup-plugin-visualizer": "^5.12.0",
"vitest": "^2.1.4"
"vitest": "^2.1.5"
}
}
3 changes: 3 additions & 0 deletions src/api/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ const config = [
{
name: 'smrt_link_versions',
},
{
name: 'library_batches',
},
],
},
{
Expand Down
3 changes: 2 additions & 1 deletion src/components/pacbio/PacbioPoolEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ const {
selectedUsedAliquots,
createPool,
updatePool,
validatePoolAttribute,
updateUsedAliquotFromCsvRecord,
} = usePacbioPoolCreateStore()
const { showAlert } = useAlert()
Expand Down Expand Up @@ -230,7 +231,7 @@ const poolSetter = (attr) => {
},
set(newValue) {
pool[attr] = newValue
updatePool(pool, attr)
validatePoolAttribute(attr)
},
})
}
Expand Down
37 changes: 32 additions & 5 deletions src/components/reception/MultiBarcode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
Import {{ labwareData.foundBarcodes.size }} labware into {{ props.pipeline }} from
{{ reception.text }}
</p>
<p data-testid="workflow-location-text" class="text-left">
{{ workflowLocationText }}
</p>
<div class="flex flex-row space-x-8 mt-5">
<traction-button
id="reset"
Expand Down Expand Up @@ -105,6 +108,7 @@ import { createBarcodeLabels, createBasicTubeBarcodeLabel } from '@/lib/LabelPri
import { createReceptionResource, createMessages } from '@/services/traction/Reception.js'
import { getCurrentDate } from '@/lib/DateHelpers.js'
import DataFetcher from '@/components/DataFetcher.vue'
import { scanInBarcodesToLocation } from '@/services/labwhere/helpers.js'

const props = defineProps({
pipeline: {
Expand All @@ -119,6 +123,18 @@ const props = defineProps({
type: Object,
default: () => ({}),
},
workflowLocationText: {
type: String,
default: '',
},
userCode: {
type: String,
default: '',
},
locationBarcode: {
type: String,
default: '',
},
})
const emit = defineEmits(['importStarted', 'importFinished', 'reset'])

Expand Down Expand Up @@ -247,12 +263,23 @@ async function importLabware() {
labwareData.foundBarcodes,
labwareData.attributes,
)
const importedBarcodes = Array.from(labwareData.foundBarcodes)
const messages =
createMessages({
barcodes: importedBarcodes,
response,
reception: props.reception,
}) || []

const messages = createMessages({
barcodes: Array.from(labwareData.foundBarcodes),
response,
reception: props.reception,
})
if (importedBarcodes.length > 0) {
messages.push(
await scanInBarcodesToLocation(
props.userCode,
props.locationBarcode,
importedBarcodes.join('\n'),
),
)
}

// we create a different alert for each message
messages.forEach(({ type, text }) => {
Expand Down
30 changes: 28 additions & 2 deletions src/components/reception/MultiplexedLibraryBarcode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@
Import {{ labwareData.foundBarcodes.size }} labware into {{ props.pipeline }} from
{{ reception.text }}
</p>
<p data-testid="workflow-location-text" class="text-left">
{{ workflowLocationText }}
</p>
<div class="flex flex-row space-x-8 mt-5">
<traction-button
id="reset"
Expand Down Expand Up @@ -121,6 +124,7 @@ import { createBarcodeLabels, createBasicTubeBarcodeLabel } from '@/lib/LabelPri
import { createReceptionResource, createMessages } from '@/services/traction/Reception.js'
import { getCurrentDate } from '@/lib/DateHelpers.js'
import DataFetcher from '@/components/DataFetcher.vue'
import { scanInBarcodesToLocation } from '@/services/labwhere/helpers.js'

const props = defineProps({
pipeline: {
Expand All @@ -135,6 +139,18 @@ const props = defineProps({
type: Object,
default: () => ({}),
},
workflowLocationText: {
type: String,
default: '',
},
userCode: {
type: String,
default: '',
},
locationBarcode: {
type: String,
default: '',
},
})
const emit = defineEmits(['importStarted', 'importFinished', 'reset'])

Expand Down Expand Up @@ -278,13 +294,23 @@ async function importLabware() {
labwareData.foundBarcodes,
labwareData.attributes,
)

const importedBarcodes = Array.from(labwareData.foundBarcodes)
const messages = createMessages({
barcodes: Array.from(labwareData.foundBarcodes),
barcodes: importedBarcodes,
response,
reception: props.reception,
})

if (importedBarcodes.length > 0) {
messages.push(
await scanInBarcodesToLocation(
props.userCode,
props.locationBarcode,
importedBarcodes.join('\n'),
),
)
}

// we create a different alert for each message
messages.forEach(({ type, text }) => {
showAlert(text, type)
Expand Down
19 changes: 11 additions & 8 deletions src/components/saphyr/SaphyrEnzymeModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</template>

<script>
import handlePromise from '@/api/v1/PromiseHelper'
import handleResponse from '@/api/v2/ResponseHelper'
export default {
name: 'SaphyrEnzymeModal',
Expand All @@ -42,7 +42,7 @@ export default {
},
computed: {
api() {
return this.$store.getters.api.v1
return this.$store.getters.api.v2
},
enzymeRequest() {
return this.api.traction.saphyr.enzymes
Expand Down Expand Up @@ -76,17 +76,20 @@ export default {
},
async getEnzymeOptions() {
const promise = this.enzymeRequest.get()
const response = await handlePromise(promise)
const {
success,
errors,
body: { data },
} = await handleResponse(promise)
if (response.successful) {
const enzymes = response.deserialize.enzymes
const enzymeOptions = enzymes.map((enzyme) =>
Object.assign({ value: parseInt(enzyme.id), text: enzyme.name }),
if (success) {
const enzymeOptions = data.map((enzyme) =>
Object.assign({ value: parseInt(enzyme.id), text: enzyme.attributes.name }),
)
enzymeOptions.unshift({ value: null, text: 'Please select an option' })
this.enzymeOptions = enzymeOptions
} else {
this.message = response.errors.message
this.message = errors
}
},
async provider() {
Expand Down
55 changes: 47 additions & 8 deletions src/lib/csv/pacbio.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,15 @@ const filterUndefinedValues = (record) =>
Object.fromEntries(Object.entries(record).filter(([, value]) => value !== undefined))

/**
* Parses the provides CSV contents and passes each record to the callback
* Column headers are assumed to be provided in the first row
* Each record will have keys corresponding to each
* Processes each record in the CSV content using the provided callback function.
*
* @param {string} csv - The CSV content as a string.
* @param {Function} callback - The callback function to process each record.
* @param {...any} args - Additional arguments to pass to the callback function.
* @returns {Array|Object} - The processed records or an error object if an error occurs.
*/
const eachRecord = (csv, callback) => {
parse(csv, {
const eachRecord = (csv, callback, ...args) => {
const records = parse(csv, {
bom: true, // Strip any byte-order-markers
delimiter: ',',
columns: validateHeaders(normaliseHeaders),
Expand All @@ -71,8 +74,44 @@ const eachRecord = (csv, callback) => {
trim: true,
info: true,
cast,
onRecord: filterUndefinedValues,
}).forEach(callback)
}).map(filterUndefinedValues)

let retRecords = []
for (const record of records) {
const result = callback(record, ...args)
// If callback does not return anything, we just add the record to the return
if (!result) {
retRecords.push(record)
} else if (result instanceof Error) {
// If callback returns an error, we return the error and the record
return { error: result.message, record }
} else {
// If callback returns a result, we add the record and the result to the return
retRecords.push({ ...record, result })
}
}
return retRecords
}
/*
* @param {string} csv - The CSV data as a string.
* @param {number} column - The index of the column to extract values from.
* @param {boolean} [hasHeader=true] - Whether the CSV data includes a header row.
* @returns {Array<string>} An array of values from the specified column.
*
* @example
* const csv = 'header1,header2,header3\nvalue1,value2,value3\nvalue4,value5,value6';
* const values = getColumnValues(csv, 1);
* console.log(values); // Output: ['value2', 'value5']
*/
const getColumnValues = (csv, column, hasHeader = true) => {
const lines = csv.split('\n').filter((line) => line.trim() !== '')
if (lines.length === 0) return []

export { eachRecord }
const data = hasHeader ? lines.slice(1) : lines

return data.map((line) => {
const columns = line.split(',')
return column >= columns.length ? '' : columns[column]
})
}
export { eachRecord, getColumnValues }
35 changes: 34 additions & 1 deletion src/lib/receptions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,39 @@ const defaultRequestOptions = () => ({
data_type: null,
})

const WorkflowsLocations = {
Extractions: {
pipelines: ['ONT', 'PacBio'],
name: 'Extractions -80 samples',
location: 'Long Read DTOL Freezer 2/Shelf 3/Rack 3',
barcode: 'lw-drawer-2-30398',
},
ONT: {
pipelines: ['ONT'],
name: 'ONT -20 samples',
location: 'LRT020 Draw 1',
barcode: 'lw-drawer-1-37292',
},
OntFridgeSamples: {
pipelines: ['ONT'],
name: 'ONT Fridge samples',
location: 'LTR018 Shelf 1',
barcode: 'lw-shelf-1-30503',
},
Pacbio: {
pipelines: ['PacBio'],
name: 'Pacbio -20 samples',
location: 'LRT006 Draw 1',
barcode: 'lw-shelf-1-30472',
},
PacbioFridgeSamples: {
pipelines: ['PacBio'],
name: 'Pacbio Fridge samples',
location: 'LRT007 – Shelf 1',
barcode: 'lw-shelf-1-30451',
},
}

const ReceptionTypes = {
Sequencescape: {
name: 'sequencescape',
Expand Down Expand Up @@ -71,4 +104,4 @@ const Receptions = {
}

export default Receptions
export { defaultRequestOptions }
export { defaultRequestOptions, WorkflowsLocations }
2 changes: 1 addition & 1 deletion src/services/labwhere/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const scanBarcodesInLabwhereLocation = async (
startPosition,
) => {
if (!userCode || !labwareBarcodes) {
return { success: false, errors: ['Missing required parameters'] }
return { success: false, errors: ['Required parameters are missing for the Scan In operation'] }
}

const params = {
Expand Down
Loading

0 comments on commit 32d333e

Please sign in to comment.