@@ -27,6 +27,7 @@ export type NotebookCellDescriptor =
2727 | WdkParamCellDescriptor ;
2828
2929export interface NotebookCellDescriptorBase < T extends string > {
30+ id : string ; // Unique identifier for this cell. Used as key in stepNumbers map.
3031 type : T ;
3132 title : string ;
3233 cells ?: NotebookCellDescriptor [ ] ;
@@ -44,7 +45,8 @@ export interface VisualizationCellDescriptor
4445 // Useful for adding interactivity between the viz and other notebook cells.
4546 getVizPluginOptions ?: (
4647 wdkState : WdkState ,
47- enqueueSnackbar : EnqueueSnackbar
48+ enqueueSnackbar : EnqueueSnackbar ,
49+ stepNumbers ?: Map < string , number >
4850 ) => Partial < BipartiteNetworkOptions > | Partial < VolcanoPlotOptions > ; // We'll define this function custom for each notebook, so can expand output types as needed.
4951}
5052
@@ -61,6 +63,7 @@ export interface ComputeCellDescriptor
6163export interface TextCellContext {
6264 analysisState : AnalysisState ;
6365 wdkState ?: WdkState ;
66+ stepNumbers ?: Map < string , number > ;
6467}
6568
6669export interface TextCellDescriptor extends NotebookCellDescriptorBase < 'text' > {
@@ -85,7 +88,12 @@ type PresetNotebook = {
8588 displayName : string ;
8689 projects : string [ ] ;
8790 cells : NotebookCellDescriptor [ ] ;
88- header ?: string | ( ( context : { submitButtonText : string } ) => string ) ; // Optional header text for the notebook, to be displayed above the cells.
91+ header ?:
92+ | string
93+ | ( ( context : {
94+ submitButtonText : string ;
95+ stepNumbers : Map < string , number > ;
96+ } ) => string ) ; // Optional header text for the notebook, to be displayed above the cells.
8997 isReady ?: ( context : ReadinessContext ) => boolean ;
9098} ;
9199
@@ -114,6 +122,7 @@ export const presetNotebooks: Record<string, PresetNotebook> = {
114122 ] ,
115123 cells : [
116124 {
125+ id : 'de_subset' ,
117126 type : 'subset' ,
118127 title : 'Select samples (optional)' ,
119128 numberedHeader : true ,
@@ -122,6 +131,7 @@ export const presetNotebooks: Record<string, PresetNotebook> = {
122131 ) ,
123132 } ,
124133 {
134+ id : 'de_pca_compute' ,
125135 type : 'compute' ,
126136 title : 'PCA' ,
127137 computationName : 'dimensionalityreduction' ,
@@ -135,6 +145,7 @@ export const presetNotebooks: Record<string, PresetNotebook> = {
135145 ) ,
136146 cells : [
137147 {
148+ id : 'de_pca_plot' ,
138149 type : 'visualization' ,
139150 title : 'PCA Plot' ,
140151 visualizationName : 'scatterplot' ,
@@ -150,6 +161,7 @@ export const presetNotebooks: Record<string, PresetNotebook> = {
150161 ] ,
151162 } ,
152163 {
164+ id : 'de_deseq2_compute' ,
153165 type : 'compute' ,
154166 title : 'Setup DESeq2 Computation' ,
155167 computationName : 'differentialexpression' ,
@@ -165,45 +177,11 @@ export const presetNotebooks: Record<string, PresetNotebook> = {
165177 ) ,
166178 cells : [
167179 {
180+ id : 'de_volcano' ,
168181 type : 'visualization' ,
169182 title : 'Examine DESeq2 Results with Volcano Plot' ,
170183 visualizationName : 'volcanoplot' ,
171184 visualizationId : 'volcano_1' ,
172- getVizPluginOptions : (
173- wdkState : WdkState ,
174- enqueueSnackbar : EnqueueSnackbar
175- ) => {
176- return {
177- // When user changes viz config, show snackbar with updated params
178- inputSnackbar : < K extends keyof VolcanoPlotConfig > (
179- enqueueSnackbar : EnqueueSnackbar ,
180- vizConfigParameter : K ,
181- newValue : VolcanoPlotConfig [ K ]
182- ) => {
183- let paramText = '' ;
184- // The only two parameters we want to alert the user about are numbers.
185- if ( typeof newValue === 'number' ) {
186- switch ( vizConfigParameter ) {
187- case 'effectSizeThreshold' :
188- paramText = 'Absolute effect size' ;
189- break ;
190- case 'significanceThreshold' :
191- paramText = 'Unadjusted P-value' ;
192- break ;
193- default :
194- paramText = 'Unknown parameter' ;
195- }
196- enqueueSnackbar (
197- < span >
198- Updated < strong > { paramText } </ strong > search parameter
199- to: < strong > { newValue } </ strong >
200- </ span > ,
201- { variant : 'info' }
202- ) ;
203- }
204- } ,
205- } ;
206- } ,
207185 numberedHeader : true ,
208186 helperText : (
209187 < span >
@@ -214,6 +192,7 @@ export const presetNotebooks: Record<string, PresetNotebook> = {
214192 ) ,
215193 } ,
216194 {
195+ id : 'de_review' ,
217196 type : 'text' ,
218197 title : 'Review and run search' ,
219198 numberedHeader : true ,
@@ -314,11 +293,14 @@ export const presetNotebooks: Record<string, PresetNotebook> = {
314293 wgcnaCorrelationNotebook : {
315294 name : 'wgcnacorrelation' ,
316295 displayName : 'WGCNA Correlation Notebook' ,
317- header : ( { submitButtonText } ) =>
318- `Use steps 1-3 to find a module of interest, then click '${ submitButtonText } ' to retrieve a list of genes.` ,
296+ header : ( { submitButtonText, stepNumbers } ) =>
297+ `Use steps 1-${
298+ stepNumbers . get ( 'wgcna_params' ) ?? '?'
299+ } to find a module of interest, then click '${ submitButtonText } ' to retrieve a list of genes.`,
319300 projects : [ 'PlasmoDB' , 'HostDB' , 'UniDB' ] ,
320301 cells : [
321302 {
303+ id : 'wgcna_correlation_compute' ,
322304 type : 'compute' ,
323305 title : 'Correlation computation' ,
324306 computationName : 'correlation' ,
@@ -346,6 +328,7 @@ export const presetNotebooks: Record<string, PresetNotebook> = {
346328 } ,
347329 cells : [
348330 {
331+ id : 'wgcna_bipartite' ,
349332 type : 'visualization' ,
350333 title : 'Network visualization of correlation results' ,
351334 visualizationName : 'bipartitenetwork' ,
@@ -359,7 +342,8 @@ export const presetNotebooks: Record<string, PresetNotebook> = {
359342 ) ,
360343 getVizPluginOptions : (
361344 wdkState : WdkState ,
362- enqueueSnackbar : EnqueueSnackbar
345+ enqueueSnackbar : EnqueueSnackbar ,
346+ stepNumbers ?: Map < string , number >
363347 ) => {
364348 return {
365349 additionalOnNodeClickAction : ( node : NodeData ) => {
@@ -411,10 +395,11 @@ export const presetNotebooks: Record<string, PresetNotebook> = {
411395 wdkState . updateParamValue ( param , moduleName ) ;
412396
413397 // Open snackbar
398+ const paramStep = stepNumbers ?. get ( 'wgcna_params' ) ?? '?' ;
414399 enqueueSnackbar (
415400 < span >
416- Updated WGNCA module search parameter in step 3 to: { ' ' }
417- < strong > { moduleName } </ strong >
401+ Updated WGCNA module search parameter in step { paramStep } { ' ' }
402+ to: < strong > { moduleName } </ strong >
418403 </ span > ,
419404 { variant : 'info' }
420405 ) ;
@@ -425,6 +410,7 @@ export const presetNotebooks: Record<string, PresetNotebook> = {
425410 ] ,
426411 } ,
427412 {
413+ id : 'wgcna_params' ,
428414 type : 'wdkparam' ,
429415 title : 'Run gene search' ,
430416 paramNames : [ 'wgcnaParam' , 'wgcna_correlation_cutoff' ] ,
@@ -453,6 +439,7 @@ export const presetNotebooks: Record<string, PresetNotebook> = {
453439 projects : [ 'MicrobiomeDB' ] ,
454440 cells : [
455441 {
442+ id : 'boxplot_viz' ,
456443 type : 'visualization' ,
457444 title : 'Boxplot Visualization' ,
458445 visualizationName : 'boxplot' ,
0 commit comments