Skip to content

Commit

Permalink
after merge fixes round 1
Browse files Browse the repository at this point in the history
  • Loading branch information
dbolotin committed Sep 7, 2024
1 parent 5234d1c commit 0691009
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 141 deletions.
2 changes: 1 addition & 1 deletion workflow/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare type TemplateFromFile = { readonly type: "from-file"; readonly path: string; };
declare type TplName = "calculate-pfconv-params" | "export-clones" | "get-preset-spec" | "get-preset" | "list-presets" | "mixcr-analyze" | "prerun" | "process" | "test.columns.test" | "main";
declare type TplName = "calculate-pfconv-params" | "export-clones" | "get-preset" | "list-presets" | "mixcr-analyze" | "prerun" | "process" | "test.columns.test" | "main";
declare const Templates: Record<TplName, TemplateFromFile>;
export { Templates };
2 changes: 0 additions & 2 deletions workflow/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module.exports = { Templates: {
'calculate-pfconv-params': { type: 'from-file', path: require.resolve('./dist/tengo/tpl/calculate-pfconv-params.plj.gz') },
'export-clones': { type: 'from-file', path: require.resolve('./dist/tengo/tpl/export-clones.plj.gz') },
'get-preset-spec': { type: 'from-file', path: require.resolve('./dist/tengo/tpl/get-preset-spec.plj.gz') },
'get-preset-for-back': { type: 'from-file', path: require.resolve('./dist/tengo/tpl/get-preset-for-back.plj.gz') },
'get-preset': { type: 'from-file', path: require.resolve('./dist/tengo/tpl/get-preset.plj.gz') },
'list-presets': { type: 'from-file', path: require.resolve('./dist/tengo/tpl/list-presets.plj.gz') },
'mixcr-analyze': { type: 'from-file', path: require.resolve('./dist/tengo/tpl/mixcr-analyze.plj.gz') },
Expand Down
56 changes: 0 additions & 56 deletions workflow/src/get-preset-for-back.tpl.tengo

This file was deleted.

44 changes: 0 additions & 44 deletions workflow/src/get-preset-spec.tpl.tengo

This file was deleted.

26 changes: 20 additions & 6 deletions workflow/src/get-preset.tpl.tengo
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ self.validateInputs({

mixcrSw := assets.importSoftware("@milaboratory/mixcr:main")

self.defineOutputs("preset")
self.defineOutputs("preset", "presetSpecForBack")

self.body(func(inputs) {
presetName := inputs.request.presetName
species := inputs.request.species

mixcrCmdBuilder := exec.builder().
mixcrExportPresetCmdBuilder := exec.builder().
software(mixcrSw).
printErrStreamToStdout().
arg("exportPreset").
Expand All @@ -38,16 +38,30 @@ self.body(func(inputs) {
arg("-cHit")

if !is_undefined(species) {
mixcrCmdBuilder.arg("--species").arg(species)
mixcrExportPresetCmdBuilder.arg("--species").arg(species)
}

mixcrCmd := mixcrCmdBuilder.arg("preset.json").
mixcrExportPresetCmd := mixcrExportPresetCmdBuilder.arg("preset.json").
saveFileContent("preset.json").
saveFile("preset.json").
run()

presetContent := mixcrCmd.getFileContent("preset.json")
presetContent := mixcrExportPresetCmd.getFileContent("preset.json")

mixcrForBackCmd := exec.builder().
software(mixcrSw).
printErrStreamToStdout().
arg("presetSpecificationsForBack").
addFile("preset.yaml", mixcrExportPresetCmd.getFile("preset.json")).
arg("preset.yaml").
arg("presetForBack.json").
saveFileContent("presetForBack.json").
run()

presetSpecForBackContent := mixcrForBackCmd.getFileContent("presetForBack.json")

return {
preset: presetContent
preset: presetContent,
presetSpecForBack: presetSpecForBackContent
}
})
8 changes: 1 addition & 7 deletions workflow/src/main.tpl.tengo
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ exec := import("@milaboratory/tengo-sdk:exec")
json := import("json")

getPresetTpl := assets.importTemplate(":get-preset")
getPresetSpecTpl := assets.importTemplate(":get-preset-spec")
getPresetTpl := assets.importTemplate(":get-preset-for-back")
calculatePfconvParamsTpl := assets.importTemplate(":calculate-pfconv-params")
processTpl := assets.importTemplate(":process")

Expand All @@ -36,12 +34,8 @@ wf.body(func(args) {
}
})

getSpecs := render.create(getPresetSpecTpl, {
preset: args.preset
})

presetContent := getPreset.output("preset", 24 * 60 * 60 * 1000)
specsContent := getSpecs.output("specs", 24 * 60 * 60 * 1000)
specsContent := getPreset.output("presetSpecForBack", 24 * 60 * 60 * 1000)

calculatePfconvParams := render.create(calculatePfconvParamsTpl, {
preset: presetContent,
Expand Down
28 changes: 14 additions & 14 deletions workflow/src/pfconv_params.lib.tengo
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export {
},
"annotations": {
"type": "sequence",
"pl7.app/label": "FR1 Nt"
"pl7.app/label": "FR1 nt"
}
}
}, {
Expand Down Expand Up @@ -207,7 +207,7 @@ export {
},
"annotations": {
"type": "sequence",
"pl7.app/label": "FR2 Nt"
"pl7.app/label": "FR2 nt"
}
}
}, {
Expand Down Expand Up @@ -236,7 +236,7 @@ export {
},
"annotations": {
"type": "sequence",
"pl7.app/label": "FR3 Nt"
"pl7.app/label": "FR3 nt"
}
}
}, {
Expand Down Expand Up @@ -265,7 +265,7 @@ export {
},
"annotations": {
"type": "sequence",
"pl7.app/label": "FR4 Nt"
"pl7.app/label": "FR4 nt"
}
}
}, {
Expand Down Expand Up @@ -294,7 +294,7 @@ export {
},
"annotations": {
"type": "sequence",
"pl7.app/label": "CDR1 Nt"
"pl7.app/label": "CDR1 nt"
}
}
}, {
Expand Down Expand Up @@ -323,7 +323,7 @@ export {
},
"annotations": {
"type": "sequence",
"pl7.app/label": "CDR2 Nt"
"pl7.app/label": "CDR2 nt"
}
}
}, {
Expand Down Expand Up @@ -352,7 +352,7 @@ export {
},
"annotations": {
"type": "sequence",
"pl7.app/label": "CDR3 Nt"
"pl7.app/label": "CDR3 nt"
}
}
}, {
Expand Down Expand Up @@ -381,7 +381,7 @@ export {
},
"annotations": {
"type": "sequence",
"pl7.app/label": "FR1 AA"
"pl7.app/label": "FR1 aa"
}
}
}, {
Expand All @@ -396,7 +396,7 @@ export {
},
"annotations": {
"type": "sequence",
"pl7.app/label": "FR2 AA"
"pl7.app/label": "FR2 aa"
}
}
}, {
Expand All @@ -411,7 +411,7 @@ export {
},
"annotations": {
"type": "sequence",
"pl7.app/label": "FR3 AA"
"pl7.app/label": "FR3 aa"
}
}
}, {
Expand All @@ -426,7 +426,7 @@ export {
},
"annotations": {
"type": "sequence",
"pl7.app/label": "FR4 AA"
"pl7.app/label": "FR4 aa"
}
}
}, {
Expand All @@ -441,7 +441,7 @@ export {
},
"annotations": {
"type": "sequence",
"pl7.app/label": "CDR1 AA"
"pl7.app/label": "CDR1 aa"
}
}
}, {
Expand All @@ -456,7 +456,7 @@ export {
},
"annotations": {
"type": "sequence",
"pl7.app/label": "CDR2 AA"
"pl7.app/label": "CDR2 aa"
}
}
}, {
Expand All @@ -471,7 +471,7 @@ export {
},
"annotations": {
"type": "sequence",
"pl7.app/label": "CDR3 AA"
"pl7.app/label": "CDR3 aa"
}
}
}, {
Expand Down
4 changes: 2 additions & 2 deletions workflow/src/prerun.tpl.tengo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ll := import("@milaboratory/tengo-sdk:ll")
assets := import("@milaboratory/tengo-sdk:assets")

listPresetsTpl := assets.importTemplate(":list-presets")
getPresetTpl := assets.importTemplate(":get-preset-for-back")
getPresetTpl := assets.importTemplate(":get-preset")

wf.body(func(args) {

Expand All @@ -22,7 +22,7 @@ wf.body(func(args) {
species: args.species
}
})
outputs.preset = getPreset.output("preset", 24 * 60 * 60 * 1000)
outputs.preset = getPreset.output("presetSpecForBack", 24 * 60 * 60 * 1000)
}

return {
Expand Down
13 changes: 4 additions & 9 deletions workflow/src/test/columns.test.tpl.tengo
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,20 @@ assets := import("@milaboratory/tengo-sdk:assets")
render := import("@milaboratory/tengo-sdk:render")

getPresetTpl := assets.importTemplate(":get-preset")
getPresetSpecTpl := assets.importTemplate(":get-preset-spec")
calculateColumnsParamsTpl := assets.importTemplate(":calculate-pfconv-params")

self.defineOutputs("conf")

self.body(func(inputs) {
request := inputs.request

preset := render.create(getPresetTpl, {
getPreset := render.create(getPresetTpl, {
request: request
}).output("preset")

specs := render.create(getPresetSpecTpl, {
preset: presetName
}).output("specs")
})

pfconvConfig := render.create(calculateColumnsParamsTpl, {
preset: preset,
specs: specs
preset: getPreset.output("preset"),
specs: getPreset.output("presetSpecForBack")
}).output("params")

return {
Expand Down
2 changes: 2 additions & 0 deletions workflow/src/test/columns.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const testCases: TestCase[] = [
},
{
presetName: '10x-sc-xcr-vdj',
species: 'human',
check: (expect, config) => {
console.dir(config, { depth: 5 });
expect(config.axes).to.have.lengthOf(2);
Expand Down Expand Up @@ -89,6 +90,7 @@ const testCases: TestCase[] = [
},
{
presetName: 'rna-seq',
species: 'human',
check: (expect, config) => {
console.dir(config, { depth: 5 });
expect(config.axes).to.have.lengthOf(1);
Expand Down

0 comments on commit 0691009

Please sign in to comment.