From b951bb12aa2ec1121ee83ffcd47390549fb7bd32 Mon Sep 17 00:00:00 2001 From: Dmitry Bolotin Date: Sat, 7 Sep 2024 14:07:08 +0200 Subject: [PATCH] wip --- model/src/index.ts | 44 +++-- package.json | 1 + pnpm-lock.yaml | 78 ++++++--- pnpm-workspace.yaml | 6 +- test/assets/expected_results/mixcr.sh | 6 +- test/src/wf.test.ts | 12 +- ui/src/Report.vue | 0 ui/src/ReportsPage.vue | 185 +++++++++++++++++++++ ui/src/SettingsPage.vue | 121 ++++++++++++-- ui/src/app.ts | 4 +- ui/vite.config.ts | 5 +- workflow/index.d.ts | 2 +- workflow/index.js | 1 + workflow/src/get-preset-for-back.tpl.tengo | 56 +++++++ workflow/src/main.tpl.tengo | 5 +- workflow/src/mixcr-analyze.tpl.tengo | 16 +- workflow/src/prerun.tpl.tengo | 2 +- workflow/src/process.tpl.tengo | 7 +- 18 files changed, 484 insertions(+), 67 deletions(-) delete mode 100644 ui/src/Report.vue create mode 100644 ui/src/ReportsPage.vue create mode 100644 workflow/src/get-preset-for-back.tpl.tengo diff --git a/model/src/index.ts b/model/src/index.ts index 27f0f98..184be14 100644 --- a/model/src/index.ts +++ b/model/src/index.ts @@ -31,28 +31,39 @@ export const platforma = BlockModel.create('Heavy') .output('qc', (ctx) => parseResourceMap(ctx.outputs?.resolve({ field: 'qc', assertFieldType: 'Input' }), (acc) => - acc.getRemoteFileHandle() + acc.getFileHandle() ) ) .output('reports', (ctx) => parseResourceMap(ctx.outputs?.resolve({ field: 'reports', assertFieldType: 'Input' }), (acc) => - acc.getRemoteFileHandle() + acc.getFileHandle() ) ) .output('logs', (ctx) => { - return parseResourceMap( - ctx.outputs?.resolve({ field: 'logs', assertFieldType: 'Input' }), - (acc) => acc.getLogHandle() - ); + return ctx.outputs !== undefined + ? parseResourceMap(ctx.outputs?.resolve({ field: 'logs', assertFieldType: 'Input' }), (acc) => + acc.getLogHandle() + ) + : undefined; }) .output('progress', (ctx) => { - return parseResourceMap( - ctx.outputs?.resolve({ field: 'logs', assertFieldType: 'Input' }), - (acc) => acc.getProgressLog(ProgressPrefix) - ); + return ctx.outputs !== undefined + ? parseResourceMap(ctx.outputs?.resolve({ field: 'logs', assertFieldType: 'Input' }), (acc) => + acc.getProgressLog(ProgressPrefix) + ) + : undefined; + }) + + .output('done', (ctx) => { + return ctx.outputs !== undefined + ? parseResourceMap( + ctx.outputs?.resolve({ field: 'clns', assertFieldType: 'Input' }), + (acc) => true + ).data.map((e) => e.key[0] as string) + : undefined; }) .output('clones', (ctx) => { @@ -124,11 +135,19 @@ export const platforma = BlockModel.create('Heavy') // if (sampleLabelsObj.obj.data.resourceType.name !== 'PColumn/Json') return undefined; - return sampleLabelsObj.obj.data.getDataAsJson(); + return Object.fromEntries( + Object.entries(sampleLabelsObj.obj.data.getDataAsJson>()).map((e) => [ + JSON.parse(e[0])[0], + e[1] + ]) + ) satisfies Record; }) .sections((ctx) => { - return [{ type: 'link', href: '/', label: 'Settings' }]; + return [ + { type: 'link', href: '/', label: 'Settings' }, + { type: 'link', href: '/reports', label: 'Reports' } + ]; }) .inputsValid((ctx) => BlockArgsValid.safeParse(ctx.args).success) @@ -139,4 +158,5 @@ export type BlockOutputs = InferOutputsType; export type Href = InferHrefType; export * from './args'; export * from './helpers'; +export * from './logs'; export { BlockArgs }; diff --git a/package.json b/package.json index 015763e..a4f9ed3 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,7 @@ "@milaboratory/pl-middle-layer": "file:/Volumes/Data/Projects/MiLaboratory/platforma/ts-pl-middle-layer", "@milaboratory/sdk-ui": "file:/Volumes/Data/Projects/MiLaboratory/platforma/ts-sdk-ui", "@milaboratory/sdk-test": "file:/Volumes/Data/Projects/MiLaboratory/platforma/ts-sdk-test", + "@milaboratory/sdk-vue": "file:/Volumes/Data/Projects/MiLaboratory/platforma/sdk-vue", "@milaboratory/milaboratories.samples-and-data.workflow": "file:/Volumes/Data/Projects/MiLaboratory/blocks-beta/block-samples-and-data/workflow" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e690354..6675768 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -31,8 +31,8 @@ catalogs: specifier: 1.1.1 version: 1.1.1 '@milaboratory/mixcr': - specifier: 4.7.0-68-develop - version: 4.7.0-68-develop + specifier: 4.7.0-70-develop + version: 4.7.0-70-develop '@milaboratory/pframes-conv': specifier: ^0.4.25 version: 0.4.26 @@ -40,17 +40,17 @@ catalogs: specifier: ^2.1.5 version: 2.1.5 '@milaboratory/platforma-uikit': - specifier: ^1.1.2 - version: 1.1.2 + specifier: ^1.1.4 + version: 1.1.4 '@milaboratory/sdk-test': specifier: ^1.5.5 version: 1.5.5 '@milaboratory/sdk-ui': - specifier: ^0.12.21 - version: 0.12.21 + specifier: ^0.12.22 + version: 0.12.22 '@milaboratory/sdk-vue': specifier: ^1.1.1 - version: 1.1.1 + version: 1.1.2 '@milaboratory/tengo-sdk': specifier: ^1.2.1 version: 1.2.1 @@ -103,7 +103,7 @@ importers: version: link:workflow '@milaboratory/sdk-ui': specifier: 'catalog:' - version: 0.12.21 + version: 0.12.22 devDependencies: '@changesets/cli': specifier: 'catalog:' @@ -116,7 +116,7 @@ importers: dependencies: '@milaboratory/sdk-ui': specifier: 'catalog:' - version: 0.12.21 + version: 0.12.22 zod: specifier: 'catalog:' version: 3.23.8 @@ -178,13 +178,13 @@ importers: version: link:../model '@milaboratory/platforma-uikit': specifier: 'catalog:' - version: 1.1.2(typescript@5.5.4) + version: 1.1.4(typescript@5.5.4) '@milaboratory/sdk-ui': specifier: 'catalog:' - version: 0.12.21 + version: 0.12.22 '@milaboratory/sdk-vue': specifier: 'catalog:' - version: 1.1.1(@milaboratory/helpers@1.5.3)(@milaboratory/sdk-ui@0.12.21)(typescript@5.5.4)(vue@3.4.38(typescript@5.5.4)) + version: 1.1.2(@milaboratory/helpers@1.5.3)(@milaboratory/sdk-ui@0.12.22)(typescript@5.5.4)(vue@3.4.38(typescript@5.5.4)) '@vueuse/core': specifier: 'catalog:' version: 11.0.3(vue@3.4.38(typescript@5.5.4)) @@ -215,7 +215,7 @@ importers: devDependencies: '@milaboratory/mixcr': specifier: 'catalog:' - version: 4.7.0-68-develop + version: 4.7.0-70-develop '@milaboratory/pframes-conv': specifier: 'catalog:' version: 0.4.26 @@ -862,8 +862,8 @@ packages: '@milaboratory/milaboratories.samples-and-data@1.1.6': resolution: {integrity: sha512-uDJJQwaYSS18RYWJzA111IErQdYpXJuEQiJ2rLSBePBU1dNj8SfJwQcDvehKrx9YetPYMbBsQbS9EcscJMjvzg==, tarball: https://npm.pkg.github.com/download/@milaboratory/milaboratories.samples-and-data/1.1.6/50d9dd671f9a1307cdcddb4f3bc67e6eb47e8cc8} - '@milaboratory/mixcr@4.7.0-68-develop': - resolution: {integrity: sha512-ITNLFfTr3J4u+Snc8UyDGpY8JE86k8CNVlW1Mbdo3u8PYVoy94Nr3pmDvksrR96diQG3StSq5FTX5bd4gYb1dw==, tarball: https://npm.pkg.github.com/download/@milaboratory/mixcr/4.7.0-68-develop/e6088ad420913d7008d9bbd2ddb2ee8ec18a3e9a} + '@milaboratory/mixcr@4.7.0-70-develop': + resolution: {integrity: sha512-C/GGIzrrow07uQnx7Pqr3z+kF9jDLFUOKfHjZMwWQBhe+tN+0SoVLSh+TRGXgfD7SnS8CinKs/xz7yAKWx6+Mw==, tarball: https://npm.pkg.github.com/download/@milaboratory/mixcr/4.7.0-70-develop/26e2a7be5d49630243d7e32ae44925e17e07db41} '@milaboratory/pframes-conv@0.4.26': resolution: {integrity: sha512-pPfr3tld22EcjtwLrf7dI5o7EwB3f3rkmyvDzYpE0NuQ92SmgSuEVzUUy8r/WmL2UQhHCVG+HJIFINz5nSpxBw==, tarball: https://npm.pkg.github.com/download/@milaboratory/pframes-conv/0.4.26/8e913dd0c25060f11eaa2ce185fe206289f42be7} @@ -906,6 +906,10 @@ packages: resolution: {integrity: sha512-rdL5AkKEy9O2OfC1omZLjqA3bwOfNrzZX+QEypMuRufM9T01I2362b/eDGWjhUJxHeb13W+T8Y75kMRxo8H1rw==, tarball: https://npm.pkg.github.com/download/@milaboratory/platforma-uikit/1.1.2/eff4c6bb533d52a52ff1cebc384d72f0305aa154} engines: {node: ^20.12.2, npm: ^10.5.2} + '@milaboratory/platforma-uikit@1.1.4': + resolution: {integrity: sha512-2TpatMB1gwE05DiPprXCFxHdZRt+QSjwFrm8n3Ag6UTkt58uYr9b0I8MRpn2B0FeHr622SQPUBHloXcDs/SQBg==, tarball: https://npm.pkg.github.com/download/@milaboratory/platforma-uikit/1.1.4/da44e1acca383c3cdf16aeacc4a54df0b2c83d7b} + engines: {node: ^20.12.2, npm: ^10.5.2} + '@milaboratory/sdk-model@1.3.7': resolution: {integrity: sha512-cWrAfQHw5h7W57BpURHv5v5ni5nO1EWIYiE52pbnh5i3CT87ZLvrNLRFJTeY1tcqOnSDrkk0Mcln1Hdylo3h0Q==, tarball: https://npm.pkg.github.com/download/@milaboratory/sdk-model/1.3.7/2cae8c7bcc431adebc4337bd2402359666b55ff1} @@ -918,8 +922,11 @@ packages: '@milaboratory/sdk-ui@0.12.21': resolution: {integrity: sha512-wQnaHRIUcV3IWnMDUiRVRBPIFDzoyZvIQLBMD6hYZdMK0uj4+Q1rPyq+E+8ZEgNv84uvI8F18pEpNt6EXpZihA==, tarball: https://npm.pkg.github.com/download/@milaboratory/sdk-ui/0.12.21/e3a89013847aa6039ddee63d8d0656f8acf601ae} - '@milaboratory/sdk-vue@1.1.1': - resolution: {integrity: sha512-vkxFeKtheYrmLXfF28Ps/2obUrRZ48u/tjk1E5wmnfIMCvct/kOnrnRWMEpvmwfEuX82UrtPk1+vAVpLmD7mcg==, tarball: https://npm.pkg.github.com/download/@milaboratory/sdk-vue/1.1.1/ffa2e4580441053880b44c6b6b8afd2561eeb6bc} + '@milaboratory/sdk-ui@0.12.22': + resolution: {integrity: sha512-VHNodNe7do0h7+lZbsCmpULcvta66dtjT3vggHPgfKucYWI1GjqaX43kEXTGe52IZ5VOi++RjXcHNwScwes0wQ==, tarball: https://npm.pkg.github.com/download/@milaboratory/sdk-ui/0.12.22/158075e40b60bdb72832ceadd9ab64b88727b0cc} + + '@milaboratory/sdk-vue@1.1.2': + resolution: {integrity: sha512-Sha1IcsTihS3AIoCWJfXTd559x7sEgJmvc++4W4qYmsyx2T6G6PyZBV/+S4eQ7OqfnWh9/UNFDs/8bcU/UBbkA==, tarball: https://npm.pkg.github.com/download/@milaboratory/sdk-vue/1.1.2/e7cf6fa2317dcbd25fdec1439feda6e517a145b6} peerDependencies: '@milaboratory/helpers': ^1.5.3 '@milaboratory/sdk-ui': ^0.12.10 @@ -3898,7 +3905,7 @@ snapshots: '@milaboratory/milaboratories.samples-and-data.model': 1.1.1 '@milaboratory/platforma-uikit': 1.1.2(typescript@5.5.4) '@milaboratory/sdk-ui': 0.12.21 - '@milaboratory/sdk-vue': 1.1.1(@milaboratory/helpers@1.5.3)(@milaboratory/sdk-ui@0.12.21)(typescript@5.5.4)(vue@3.4.38(typescript@5.5.4)) + '@milaboratory/sdk-vue': 1.1.2(@milaboratory/helpers@1.5.3)(@milaboratory/sdk-ui@0.12.21)(typescript@5.5.4)(vue@3.4.38(typescript@5.5.4)) utility-types: 3.11.0 vue: 3.4.38(typescript@5.5.4) zod: 3.23.8 @@ -3916,7 +3923,7 @@ snapshots: transitivePeerDependencies: - typescript - '@milaboratory/mixcr@4.7.0-68-develop': {} + '@milaboratory/mixcr@4.7.0-70-develop': {} '@milaboratory/pframes-conv@0.4.26': {} @@ -4052,6 +4059,18 @@ snapshots: transitivePeerDependencies: - typescript + '@milaboratory/platforma-uikit@1.1.4(typescript@5.5.4)': + dependencies: + '@milaboratory/helpers': 1.5.3 + '@milaboratory/platforma-core': 0.1.5 + js-yaml: 4.1.0 + vue: 3.4.38(typescript@5.5.4) + vue-router: 4.4.0(vue@3.4.38(typescript@5.5.4)) + optionalDependencies: + '@rollup/rollup-linux-x64-gnu': 4.9.5 + transitivePeerDependencies: + - typescript + '@milaboratory/sdk-model@1.3.7': {} '@milaboratory/sdk-model@1.3.9': @@ -4092,10 +4111,16 @@ snapshots: utility-types: 3.11.0 zod: 3.23.8 - '@milaboratory/sdk-vue@1.1.1(@milaboratory/helpers@1.5.3)(@milaboratory/sdk-ui@0.12.21)(typescript@5.5.4)(vue@3.4.38(typescript@5.5.4))': + '@milaboratory/sdk-ui@0.12.22': + dependencies: + '@milaboratory/sdk-model': 1.3.9 + utility-types: 3.11.0 + zod: 3.23.8 + + '@milaboratory/sdk-vue@1.1.2(@milaboratory/helpers@1.5.3)(@milaboratory/sdk-ui@0.12.21)(typescript@5.5.4)(vue@3.4.38(typescript@5.5.4))': dependencies: '@milaboratory/helpers': 1.5.3 - '@milaboratory/platforma-uikit': 1.1.2(typescript@5.5.4) + '@milaboratory/platforma-uikit': 1.1.4(typescript@5.5.4) '@milaboratory/sdk-ui': 0.12.21 vue: 3.4.38(typescript@5.5.4) optionalDependencies: @@ -4103,6 +4128,17 @@ snapshots: transitivePeerDependencies: - typescript + '@milaboratory/sdk-vue@1.1.2(@milaboratory/helpers@1.5.3)(@milaboratory/sdk-ui@0.12.22)(typescript@5.5.4)(vue@3.4.38(typescript@5.5.4))': + dependencies: + '@milaboratory/helpers': 1.5.3 + '@milaboratory/platforma-uikit': 1.1.4(typescript@5.5.4) + '@milaboratory/sdk-ui': 0.12.22 + vue: 3.4.38(typescript@5.5.4) + optionalDependencies: + '@rollup/rollup-linux-x64-gnu': 4.9.5 + transitivePeerDependencies: + - typescript + '@milaboratory/tengo-sdk@1.2.1': {} '@milaboratory/tengo-template-builder@1.13.0': diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index e9129d4..b0d87e5 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -10,15 +10,15 @@ catalog: '@milaboratory/pl-block-tools': ^2.1.5 '@milaboratory/block-builder': ^1.2.3 - '@milaboratory/sdk-ui': ^0.12.21 + '@milaboratory/sdk-ui': ^0.12.22 '@milaboratory/sdk-test': ^1.5.5 '@milaboratory/tengo-sdk': ^1.2.1 '@milaboratory/pframes-conv': ^0.4.25 - '@milaboratory/mixcr': 4.7.0-68-develop + '@milaboratory/mixcr': 4.7.0-70-develop - '@milaboratory/platforma-uikit': ^1.1.2 + '@milaboratory/platforma-uikit': ^1.1.4 '@milaboratory/sdk-vue': ^1.1.1 '@milaboratory/helpers': ^1.5.3 diff --git a/test/assets/expected_results/mixcr.sh b/test/assets/expected_results/mixcr.sh index 71ec406..cf3eff5 100755 --- a/test/assets/expected_results/mixcr.sh +++ b/test/assets/expected_results/mixcr.sh @@ -2,5 +2,7 @@ set -e -mixcr exportPreset --preset-name milab-human-dna-xcr-7genes-multiplex preset.json -mixcr analyze milab-human-dna-xcr-7genes-multiplex ../small_data_R1.fastq.gz ../small_data_R2.fastq.gz result +mixcr exportPreset --preset-name milab-human-dna-xcr-7genes-multiplex -f preset.json + +# --add-step assembleContigs +mixcr analyze milab-human-dna-xcr-7genes-multiplex -f ../small_data_R1.fastq.gz ../small_data_R2.fastq.gz result diff --git a/test/src/wf.test.ts b/test/src/wf.test.ts index 29b7074..fe48085 100644 --- a/test/src/wf.test.ts +++ b/test/src/wf.test.ts @@ -87,7 +87,7 @@ blockTest( ] } satisfies SamplesAndDataBlockArgs); await project.runBlock(sndBlockId); - await helpers.awaitBlockDone(sndBlockId); + await helpers.awaitBlockDone(sndBlockId, 4000); const sndBlockState = project.getBlockState(sndBlockId); const clonotypingBlockState = project.getBlockState(clonotypingBlockId); @@ -128,9 +128,9 @@ blockTest( )) as InferBlockState; const outputs2 = wrapOutputs(clonotypingStableState2.outputs); - console.dir(outputs2.sampleLabels, { depth: 5 }); - console.log(JSON.stringify([sample1Id])); - expect(outputs2.sampleLabels[JSON.stringify([sample1Id])]).toBeDefined(); + // console.dir(outputs2.sampleLabels, { depth: 5 }); + // console.log(JSON.stringify([sample1Id])); + expect(outputs2.sampleLabels[sample1Id]).toBeDefined(); await project.runBlock(clonotypingBlockId); const clonotypingStableState3 = (await helpers.awaitBlockDoneAndGetStableBlockState( @@ -155,7 +155,7 @@ blockTest( ).toString('utf8') ); - console.dir(alignJsonReport, { depth: 5 }); + // console.dir(alignJsonReport, { depth: 5 }); expect(alignJsonReport.aligned).toBeDefined(); expect(alignJsonReport.aligned).greaterThan(2); @@ -165,7 +165,7 @@ blockTest( const clonesPfColumnList = await ml.driverKit.pFrameDriver.listColumns(clonesPfHandle); - console.log(clonesPfColumnList); + // console.log(clonesPfColumnList); expect(clonesPfColumnList).length.to.greaterThanOrEqual(1); // console.dir(clonotypingStableState3, { depth: 8 }); diff --git a/ui/src/Report.vue b/ui/src/Report.vue deleted file mode 100644 index e69de29..0000000 diff --git a/ui/src/ReportsPage.vue b/ui/src/ReportsPage.vue new file mode 100644 index 0000000..ad1ce84 --- /dev/null +++ b/ui/src/ReportsPage.vue @@ -0,0 +1,185 @@ + + + + + diff --git a/ui/src/SettingsPage.vue b/ui/src/SettingsPage.vue index 136ba56..4e092df 100644 --- a/ui/src/SettingsPage.vue +++ b/ui/src/SettingsPage.vue @@ -1,12 +1,10 @@