Skip to content

Commit

Permalink
Merge pull request #46 from platforma-open/trace
Browse files Browse the repository at this point in the history
Trace
  • Loading branch information
dbolotin authored Nov 26, 2024
2 parents 565d5a6 + 4e5e9b9 commit 9fe805b
Show file tree
Hide file tree
Showing 8 changed files with 257 additions and 331 deletions.
4 changes: 3 additions & 1 deletion model/src/args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ export const BlockArgsValid = z
input: Ref,
preset: Preset,
species: z.string().optional(),
limitInput: z.number().int().optional()
limitInput: z.number().int().optional(),
title: z.string().optional(),
presetCommonName: z.string().optional()
})
.strict();
export type BlockArgsValid = z.infer<typeof BlockArgsValid>;
Expand Down
77 changes: 31 additions & 46 deletions model/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,16 @@ export const platforma = BlockModel.create('Heavy')
)

.output('qc', (ctx) =>
parseResourceMap(
ctx.outputs?.resolve('qc'),
(acc) => acc.getFileHandle(),
true
)
parseResourceMap(ctx.outputs?.resolve('qc'), (acc) => acc.getFileHandle(), true)
)

.output('reports', (ctx) =>
parseResourceMap(
ctx.outputs?.resolve('reports'),
(acc) => acc.getFileHandle(),
false
)
parseResourceMap(ctx.outputs?.resolve('reports'), (acc) => acc.getFileHandle(), false)
)

.output('logs', (ctx) => {
return ctx.outputs !== undefined
? parseResourceMap(
ctx.outputs?.resolve('logs'),
(acc) => acc.getLogHandle(),
false
)
? parseResourceMap(ctx.outputs?.resolve('logs'), (acc) => acc.getLogHandle(), false)
: undefined;
})

Expand All @@ -71,49 +59,44 @@ export const platforma = BlockModel.create('Heavy')

.output('done', (ctx) => {
return ctx.outputs !== undefined
? parseResourceMap(
ctx.outputs?.resolve('clns'),
(acc) => true,
false
).data.map((e) => e.key[0] as string)
? parseResourceMap(ctx.outputs?.resolve('clns'), (acc) => true, false).data.map(
(e) => e.key[0] as string
)
: undefined;
})

.output('clones', (ctx) => {
const collection = ctx.outputs
?.resolve('clones')
?.parsePObjectCollection();
const collection = ctx.outputs?.resolve('clones')?.parsePObjectCollection();
if (collection === undefined) return undefined;
// if (collection === undefined || !collection.isComplete) return undefined;
const pColumns = Object.values(collection).filter(isPColumn);
return ctx.createPFrame(pColumns);
})

.retentiveOutput('inputOptions', (ctx) => {
return ctx.resultPool
.getSpecs()
.entries.filter((v) => {
if (!isPColumnSpec(v.obj)) return false;
const domain = v.obj.domain;
return (
v.obj.name === 'pl7.app/sequencing/data' &&
(v.obj.valueType as string) === 'File' &&
domain !== undefined &&
(domain['pl7.app/fileExtension'] === 'fasta' ||
domain['pl7.app/fileExtension'] === 'fasta.gz' ||
domain['pl7.app/fileExtension'] === 'fastq' ||
domain['pl7.app/fileExtension'] === 'fastq.gz')
);
})
.map(
(v) =>
({
ref: v.ref,
label: `${ctx.getBlockLabel(v.ref.blockId)} / ${
v.obj.annotations?.['pl7.app/label'] ?? `unlabelled`
}`
} satisfies Option)
return ctx.resultPool.getOptions((v) => {
if (!isPColumnSpec(v)) return false;
const domain = v.domain;
return (
v.name === 'pl7.app/sequencing/data' &&
(v.valueType as string) === 'File' &&
domain !== undefined &&
(domain['pl7.app/fileExtension'] === 'fasta' ||
domain['pl7.app/fileExtension'] === 'fasta.gz' ||
domain['pl7.app/fileExtension'] === 'fastq' ||
domain['pl7.app/fileExtension'] === 'fastq.gz')
);
});

// .map(
// (v) =>
// ({
// ref: v.ref,
// label: `${ctx.getBlockLabel(v.ref.blockId)} / ${
// v.obj.annotations?.['pl7.app/label'] ?? `unlabelled`
// }`
// } satisfies Option)
// );
})

.output('sampleLabels', (ctx): Record<string, string> | undefined => {
Expand Down Expand Up @@ -172,6 +155,8 @@ export const platforma = BlockModel.create('Heavy')

.argsValid((ctx) => BlockArgsValid.safeParse(ctx.args).success)

.title((ctx) => (ctx.args.title ? `MiXCR Clonotyping - ${ctx.args.title}` : 'MiXCR Clonotyping'))

.done();

export type BlockOutputs = InferOutputsType<typeof platforma>;
Expand Down
Loading

0 comments on commit 9fe805b

Please sign in to comment.