66 InferOutputsType ,
77 PlDataTableState ,
88 isPColumn ,
9- isPColumnSpec
9+ isPColumnSpec ,
10+ FutureRef
1011} from '@platforma-sdk/model' ;
1112import { GraphMakerSettings } from '@milaboratories/graph-maker/dist/GraphMaker/types' ;
1213import { parseResourceMap } from './helpers' ;
@@ -39,7 +40,7 @@ export type UiState = {
3940export type ColumnOption = {
4041 ref : Ref ;
4142 label : string ;
42- spec : PColumnSpec ;
43+ assemblingFeature ?: string ;
4344} ;
4445
4546export const platforma = BlockModel . create < BlockArgs , UiState > ( 'Heavy' )
@@ -59,7 +60,7 @@ export const platforma = BlockModel.create<BlockArgs, UiState>('Heavy')
5960 // select metadata columns
6061 . output ( 'donorColumnOptions' , ( ctx ) =>
6162 ctx . resultPool
62- . getSpecsFromResultPool ( )
63+ . getSpecs ( )
6364 . entries . filter ( ( v ) => isPColumnSpec ( v . obj ) )
6465 . filter ( ( v ) => {
6566 const spec = v . obj as PColumnSpec ;
@@ -74,6 +75,10 @@ export const platforma = BlockModel.create<BlockArgs, UiState>('Heavy')
7475 } `
7576 } satisfies Option )
7677 )
78+ . map ( ( v ) => ( {
79+ text : v . label ,
80+ value : v . ref ,
81+ } ) )
7782 )
7883
7984 // selected all dataset options that have the same axis as selected metadata column
@@ -83,7 +88,7 @@ export const platforma = BlockModel.create<BlockArgs, UiState>('Heavy')
8388 }
8489 const donorColumn = ctx . args . donorColumn ;
8590 const donorColumnSpec = ctx . resultPool
86- . getSpecsFromResultPool ( )
91+ . getSpecs ( )
8792 . entries . find (
8893 ( v ) => v . ref . blockId === donorColumn . blockId && v . ref . name === donorColumn . name
8994 ) ?. obj ;
@@ -93,7 +98,7 @@ export const platforma = BlockModel.create<BlockArgs, UiState>('Heavy')
9398 const toCompare = donorColumnSpec . axesSpec [ 0 ] ;
9499
95100 return ctx . resultPool
96- . getSpecsFromResultPool ( )
101+ . getSpecs ( )
97102 . entries . filter ( ( v ) => isPColumnSpec ( v . obj ) )
98103 . filter ( ( v ) => {
99104 const spec = v . obj as PColumnSpec ;
@@ -111,16 +116,20 @@ export const platforma = BlockModel.create<BlockArgs, UiState>('Heavy')
111116 return true ;
112117 } )
113118 . map (
114- ( v ) =>
115- ( {
119+ ( v ) => {
120+ const option = {
116121 ref : v . ref ,
117122 // @todo info about what was run
118123 label : `${ ctx . getBlockLabel ( v . ref . blockId ) } / ${
119124 v . obj . annotations ?. [ 'pl7.app/label' ] ?? `unlabelled`
120- } `,
121- spec : v . obj as PColumnSpec
122- } as ColumnOption )
123- ) ;
125+ } `
126+ } as ColumnOption
127+ const spec = v . obj as PColumnSpec
128+ if ( ! ( spec . annotations === undefined || spec . annotations [ "mixcr.com/assemblingFeature" ] === undefined ) ) {
129+ option . assemblingFeature = spec . annotations [ "mixcr.com/assemblingFeature" ]
130+ }
131+ return option
132+ } ) ;
124133 } )
125134
126135 . output ( 'trees' , ( ctx ) => {
@@ -143,23 +152,50 @@ export const platforma = BlockModel.create<BlockArgs, UiState>('Heavy')
143152 return ctx . createPFrame ( treeNodesColumns . concat ( treeNodesWithClonesColumns ) ) ;
144153 } )
145154
146- . output ( 'allelesReports' , ( ctx ) =>
147- parseResourceMap (
155+ . output ( 'availableDonorIds' , ( ctx ) => {
156+ const alleleReports = ctx . outputs ?. resolve ( { field : 'allelesReports' , assertFieldType : 'Input' } )
157+ if ( alleleReports === undefined ) return undefined
158+ const reports = parseResourceMap ( alleleReports , ( acc ) => acc . getFileContentAsString ( ) )
159+
160+ const result = [ ]
161+ for ( const data of reports . data ) {
162+ const donor = data . key [ 0 ] as string
163+ result . push ( {
164+ text : donor ,
165+ value : donor ,
166+ } )
167+ }
168+ return result
169+ } )
170+
171+ . output ( 'allelesReports' , ( ctx ) => {
172+ const reports = parseResourceMap (
148173 ctx . outputs ?. resolve ( { field : 'allelesReports' , assertFieldType : 'Input' } ) ,
149174 ( acc ) => acc . getFileContentAsString ( )
150175 )
151- )
152176
153- . output ( 'treesReports' , ( ctx ) =>
154- parseResourceMap (
177+ const result = { } as { [ key : string ] : FutureRef < string | undefined > }
178+ for ( const data of reports . data ) {
179+ result [ data . key [ 0 ] as string ] = data . value
180+ }
181+ return result
182+ } )
183+
184+ . output ( 'treesReports' , ( ctx ) => {
185+ const reports = parseResourceMap (
155186 ctx . outputs ?. resolve ( { field : 'treesReports' , assertFieldType : 'Input' } ) ,
156187 ( acc ) => acc . getFileContentAsString ( )
157188 )
158- )
189+
190+ const result = { } as { [ key : string ] : FutureRef < string | undefined > }
191+ for ( const data of reports . data ) {
192+ result [ data . key [ 0 ] as string ] = data . value
193+ }
194+ return result
195+ } )
159196
160197 . sections ( [
161- { type : 'link' , href : '/' , label : 'Settings' } ,
162- { type : 'link' , href : '/reports' , label : 'Reports' } ,
198+ { type : 'link' , href : '/' , label : 'Main' } ,
163199 { type : 'link' , href : '/trees' , label : 'Trees Table' } ,
164200 { type : 'link' , href : '/treeNodes' , label : 'Tree Nodes Table' }
165201 ] )
0 commit comments