From f107715df4aeec06ba921ddc96f3ffe04efe180c Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 19 May 2026 12:54:33 +0000 Subject: [PATCH] fix(flashdeconv): point sequence cache reads at workspace/cache The Sequence View / Internal Fragment Map components crashed with `TypeError: 'NoneType' object is not subscriptable` whenever a user submitted a proteoform sequence and opened the FLASHDeconv viewer. FLASHDeconvSequenceInput writes the sequence to `workspace/cache`, and FLASHDeconvViewer reads it from the same path (so the layout gains `sequence_view`). But `src/render/update.py:get_sequence` and `FLASHDeconvLayoutManager` were looking at `workspace/flashdeconv/cache`, so they never found the cached sequence and returned `None`. The caller then subscripted `None[0]` and crashed. Point both readers at `workspace/cache` to match the writer, and add a defensive `if sequence is None: data['sequence_data'] = {}` branch in `update_data` (matching the existing pattern used in the flashtnt branch of `filter_data`) so a missing cache renders empty instead of crashing. --- .../FLASHDeconv/FLASHDeconvLayoutManager.py | 2 +- src/render/update.py | 28 +++++++++++-------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/content/FLASHDeconv/FLASHDeconvLayoutManager.py b/content/FLASHDeconv/FLASHDeconvLayoutManager.py index a86164f5..a2094d2b 100644 --- a/content/FLASHDeconv/FLASHDeconvLayoutManager.py +++ b/content/FLASHDeconv/FLASHDeconvLayoutManager.py @@ -37,7 +37,7 @@ # Setup cache access file_manager = FileManager( st.session_state["workspace"], - Path(st.session_state['workspace'], 'flashdeconv', 'cache') + Path(st.session_state['workspace'], 'cache') ) def get_sequence(): diff --git a/src/render/update.py b/src/render/update.py index 3d940eda..879608b0 100644 --- a/src/render/update.py +++ b/src/render/update.py @@ -16,7 +16,7 @@ def get_sequence(selection_store): # Setup cache access file_manager = FileManager( st.session_state["workspace"], - Path(st.session_state['workspace'], 'flashdeconv', 'cache') + Path(st.session_state['workspace'], 'cache') ) # Check if sequence has been set @@ -85,18 +85,24 @@ def render_internal_fragment_data(sequence): def update_data(data, out_components, selection_store, additional_data, tool): component = out_components[0][0]['componentArgs']['title'] if ( - (component in ['Sequence View', 'Internal Fragment Map']) + (component in ['Sequence View', 'Internal Fragment Map']) and (tool != 'flashtnt') ): - data['sequence_data'] = { - 0: render_sequence_data(get_sequence(selection_store)[0]) - } - if (component == 'Internal Fragment Map') and (tool != 'flashtnt'): - data['internal_fragment_data'] = { - 0: render_internal_fragment_data(get_sequence(selection_store)[0]) - } - - return data + sequence = get_sequence(selection_store) + if sequence is None: + data['sequence_data'] = {} + if component == 'Internal Fragment Map': + data['internal_fragment_data'] = {} + else: + data['sequence_data'] = { + 0: render_sequence_data(sequence[0]) + } + if component == 'Internal Fragment Map': + data['internal_fragment_data'] = { + 0: render_internal_fragment_data(sequence[0]) + } + + return data def filter_data(data, out_components, selection_store, additional_data, tool):