diff --git a/js/deck-gl/core/calc_viewport.js b/js/deck-gl/core/calc_viewport.js index aec439956..876cba38e 100644 --- a/js/deck-gl/core/calc_viewport.js +++ b/js/deck-gl/core/calc_viewport.js @@ -132,6 +132,12 @@ export const calc_viewport = async ( viz_state.genes.top_gene_counts ); + if (viz_state.proteins && viz_state.obs_store.new_protein_bar_data) { + viz_state.obs_store.new_protein_bar_data.set( + viz_state.proteins.top_protein_counts || [] + ); + } + viz_state.obs_store.new_cell_bar_data.set(viz_state.cats.cluster_counts); viz_state.containers.bar_gene.scrollTo({ @@ -143,6 +149,13 @@ export const calc_viewport = async ( top: 0, behavior: 'smooth', }); + + if (viz_state.containers.bar_protein) { + viz_state.containers.bar_protein.scrollTo({ + top: 0, + behavior: 'smooth', + }); + } } } diff --git a/js/deck-gl/layers/cell_layer.js b/js/deck-gl/layers/cell_layer.js index 279089406..69d75bf6b 100644 --- a/js/deck-gl/layers/cell_layer.js +++ b/js/deck-gl/layers/cell_layer.js @@ -14,6 +14,7 @@ import { import { set_color_dict_gene } from '../../global_variables/color_dict_gene'; import { options } from '../../global_variables/fetch_options'; import { update_selected_genes } from '../../global_variables/selected_genes'; +import { update_selected_proteins } from '../../global_variables/selected_proteins'; import { get_arrow_table } from '../../read_parquet/get_arrow_table'; import { get_scatter_data } from '../../read_parquet/get_scatter_data'; import { scale_umap_data } from '../../umap/scale_umap_data'; @@ -43,6 +44,7 @@ const cell_layer_onclick = async (info, d, deck_ist, layers_obj, viz_state) => { }); update_selected_cats(viz_state.cats, [inst_cat], viz_state.obs_store); update_selected_genes(viz_state.genes, [], viz_state.obs_store); + update_selected_proteins(viz_state.proteins, [], viz_state.obs_store); }; // transparent to red @@ -69,7 +71,7 @@ export const get_cell_color = (cats, i, d) => { return [0, 0, 0, 50]; // Return a default color with some opacity to handle the error gracefully } } else { - // color cells based on gene expression + // color cells based on gene or protein expression try { const inst_exp = cats.cell_exp_array[d.index]; // return [255, 0, 0, inst_exp]; diff --git a/js/deck-gl/layers/path_layer.js b/js/deck-gl/layers/path_layer.js index 0463f6b34..5da5faaeb 100644 --- a/js/deck-gl/layers/path_layer.js +++ b/js/deck-gl/layers/path_layer.js @@ -2,6 +2,7 @@ import { PathLayer } from 'deck.gl'; import { update_selected_cats, update_cat } from '../../global_variables/cat'; import { update_selected_genes } from '../../global_variables/selected_genes'; +import { update_selected_proteins } from '../../global_variables/selected_proteins'; import { grab_cell_tiles_in_view } from '../../vector_tile/polygons/grab_cell_tiles_in_view'; export const get_path_color = (cats, i, d) => { @@ -61,6 +62,7 @@ const path_layer_onclick = async ( update_cat(viz_state.cats, 'cluster'); update_selected_cats(viz_state.cats, [inst_cat], viz_state.obs_store); update_selected_genes(viz_state.genes, [], viz_state.obs_store); + update_selected_proteins(viz_state.proteins, [], viz_state.obs_store); }; export const update_path_layer_data = async ( diff --git a/js/deck-gl/layers/trx_layer.js b/js/deck-gl/layers/trx_layer.js index 4c02f48e4..9d4a53faa 100644 --- a/js/deck-gl/layers/trx_layer.js +++ b/js/deck-gl/layers/trx_layer.js @@ -3,6 +3,7 @@ import { ScatterplotLayer } from 'deck.gl'; import { update_cat, update_selected_cats } from '../../global_variables/cat'; import { update_cell_exp_array } from '../../global_variables/cell_exp_array'; import { update_selected_genes } from '../../global_variables/selected_genes'; +import { update_selected_proteins } from '../../global_variables/selected_proteins'; import { grab_trx_tiles_in_view } from '../../vector_tile/transcripts/grab_trx_tiles_in_view'; const trx_layer_callback = async ( @@ -44,6 +45,8 @@ const trx_layer_callback = async ( viz_state.vector_name_integer, viz_state.aws ); + + update_selected_proteins(viz_state.proteins, [], viz_state.obs_store); }; export const ini_trx_layer = (genes) => { diff --git a/js/global_variables/cell_exp_array.js b/js/global_variables/cell_exp_array.js index 9d1e65b29..d30e77fa1 100644 --- a/js/global_variables/cell_exp_array.js +++ b/js/global_variables/cell_exp_array.js @@ -9,23 +9,31 @@ function processExpression(exp_value, max_exp) { export const update_cell_exp_array = async ( cats, - genes, + feature_store, base_url, - inst_gene, + inst_name, version, vector_name_integer, - aws + aws, + { dataType = 'gene' } = {} ) => { + let directory; + if (dataType === 'protein') { + directory = 'cbp'; + } else { + directory = 'cbg'; + } + let file_path; if (version === 'default') { - file_path = `${base_url}/cbg/${inst_gene}.parquet`; + file_path = `${base_url}/${directory}/${inst_name}.parquet`; } else { - file_path = `${base_url}/cbg_${version}/${inst_gene}.parquet`; + file_path = `${base_url}/${directory}_${version}/${inst_name}.parquet`; } const exp_table = await get_arrow_table(file_path, options.fetch, aws); const cell_names = exp_table.getChild('__index_level_0__').toArray(); - const cell_exp = exp_table.getChild(inst_gene).toArray(); + const cell_exp = exp_table.getChild(inst_name).toArray(); const new_exp_array = new Array(cats.cell_names_array.length).fill(0); @@ -36,7 +44,12 @@ export const update_cell_exp_array = async ( cell_names.forEach((name, i) => { name = String(name); const exp_value = Number(cell_exp[i]); - const max_exp = Number(genes.meta_gene[inst_gene].max); + const meta_dictionary = + dataType === 'protein' + ? feature_store.meta_protein + : feature_store.meta_gene; + + const max_exp = Number(meta_dictionary?.[inst_name]?.max ?? 1); if (!vector_name_integer) { if (cats.cell_name_to_index_map.has(name)) { diff --git a/js/global_variables/meta_protein.js b/js/global_variables/meta_protein.js new file mode 100644 index 000000000..aab417a96 --- /dev/null +++ b/js/global_variables/meta_protein.js @@ -0,0 +1,68 @@ +import { options } from '../global_variables/fetch_options'; +import { get_arrow_table } from '../read_parquet/get_arrow_table'; +import { hexToRgb } from '../utils/hexToRgb'; + +export const set_meta_protein = async ( + proteins, + base_url, + seg_version = 'default', + aws +) => { + let meta_protein_url; + + if (seg_version === 'default') { + meta_protein_url = `${base_url}/meta_protein.parquet`; + } else { + meta_protein_url = `${base_url}/meta_protein_${seg_version}.parquet`; + } + + try { + const meta_protein_table = await get_arrow_table( + meta_protein_url, + options.fetch, + aws + ); + + const proteinNamesColumn = meta_protein_table.getChild('__index_level_0__'); + const meanColumn = meta_protein_table.getChild('mean'); + const stdColumn = meta_protein_table.getChild('std'); + const maxColumn = meta_protein_table.getChild('max'); + const colorColumn = meta_protein_table.getChild('color'); + + if (!proteinNamesColumn || !meanColumn || !stdColumn || !maxColumn) { + throw new Error('Meta protein table missing required columns'); + } + + const protein_names = proteinNamesColumn.toArray(); + const protein_mean = meanColumn.toArray(); + const protein_std = stdColumn.toArray(); + const protein_max = maxColumn.toArray(); + const protein_colors = colorColumn ? colorColumn.toArray() : []; + + protein_names.forEach((name, index) => { + proteins.meta_protein[name] = { + mean: protein_mean[index], + std: protein_std[index], + max: protein_max[index], + }; + + proteins.protein_counts.push({ + name, + value: Number(protein_mean[index]), + }); + + if (protein_colors[index]) { + proteins.color_dict_protein[name] = hexToRgb(protein_colors[index]); + } + }); + + proteins.protein_counts.sort((a, b) => b.value - a.value); + proteins.top_protein_counts = proteins.protein_counts.slice(0, 100); + proteins.protein_names = protein_names; + } catch (error) { + proteins.protein_counts = []; + proteins.top_protein_counts = []; + proteins.protein_names = []; + proteins.load_error = error; + } +}; diff --git a/js/global_variables/selected_proteins.js b/js/global_variables/selected_proteins.js new file mode 100644 index 000000000..f056d217d --- /dev/null +++ b/js/global_variables/selected_proteins.js @@ -0,0 +1,19 @@ +export const update_selected_proteins = ( + proteins, + new_selected_proteins, + obs_store +) => { + const areArraysEqual = + new_selected_proteins.length === proteins.selected_proteins.length && + new_selected_proteins.every( + (value, index) => value === proteins.selected_proteins[index] + ); + + proteins.selected_proteins = areArraysEqual + ? [] + : new_selected_proteins; + + if (obs_store && obs_store.selected_proteins) { + obs_store.selected_proteins.set(proteins.selected_proteins); + } +}; diff --git a/js/obs_store/obs_store.js b/js/obs_store/obs_store.js index 1446925ac..4a823ee19 100644 --- a/js/obs_store/obs_store.js +++ b/js/obs_store/obs_store.js @@ -27,7 +27,9 @@ export const create_obs_store = () => { selected_cats: Observable([]), new_cell_bar_data: Observable([]), new_gene_bar_data: Observable([]), + new_protein_bar_data: Observable([]), selected_genes: Observable([]), + selected_proteins: Observable([]), selected_nbhds: Observable([]), viz_image_layers: Observable(true), viz_background_layer: Observable(true), diff --git a/js/ui/bar_plot.js b/js/ui/bar_plot.js index 1c5ef1dca..50035f864 100644 --- a/js/ui/bar_plot.js +++ b/js/ui/bar_plot.js @@ -5,6 +5,7 @@ import { toggle_trx_layer_visibility } from '../deck-gl/layers/trx_layer'; import { update_cat, update_selected_cats } from '../global_variables/cat'; import { update_cell_exp_array } from '../global_variables/cell_exp_array'; import { update_selected_genes } from '../global_variables/selected_genes'; +import { update_selected_proteins } from '../global_variables/selected_proteins'; import { toggle_slider } from '../ui/sliders'; import { refresh_layer } from '../utils/refresh_layer'; @@ -48,6 +49,11 @@ export const bar_callback_cat = ( update_cat(_viz_state.cats, 'cluster'); update_selected_cats(_viz_state.cats, [d.name], _viz_state.obs_store); update_selected_genes(_viz_state.genes, [], _viz_state.obs_store); + update_selected_proteins( + _viz_state.proteins, + [], + _viz_state.obs_store + ); // toggle gene bars based on reset_cat if (_viz_state.cats.reset_cat) { @@ -112,11 +118,68 @@ export const bar_callback_gene = async ( _viz_state.aws ); + update_selected_proteins( + _viz_state.proteins, + [], + _viz_state.obs_store + ); + // update selected_cats after update_cell_exp_array has been run // can clean up and move more logic to observability update_selected_cats(_viz_state.cats, [inst_gene], _viz_state.obs_store); }; +export const bar_callback_protein = async ( + _event, + d, + _deck_ist, + _layers_obj, + _viz_state +) => { + const inst_protein = d.name; + const reset_protein = inst_protein === _viz_state.cats.cat; + const new_cat = reset_protein ? 'cluster' : inst_protein; + + if (reset_protein) { + _viz_state.cats.svg_bar_cluster.selectAll('rect').style('opacity', 1.0); + } else { + _viz_state.cats.svg_bar_cluster.selectAll('rect').style('opacity', 0.2); + } + + update_cat(_viz_state.cats, new_cat); + + _viz_state.obs_store.deck_check.set({ + ..._viz_state.obs_store.deck_check.get(), + cell_layer: false, + trx_layer: false, + }); + + update_selected_proteins( + _viz_state.proteins, + [inst_protein], + _viz_state.obs_store + ); + + await update_cell_exp_array( + _viz_state.cats, + _viz_state.proteins, + _viz_state.global_base_url, + inst_protein, + _viz_state.seg.version, + _viz_state.vector_name_integer, + _viz_state.aws, + { dataType: 'protein' } + ); + + update_selected_genes(_viz_state.genes, [], _viz_state.obs_store); + + update_selected_cats( + _viz_state.cats, + [inst_protein], + _viz_state.obs_store + ); +}; + export const bar_callback_nbhd = ( _event, _d, diff --git a/js/ui/gene_search.js b/js/ui/gene_search.js index 6d558d0e7..e385677ac 100644 --- a/js/ui/gene_search.js +++ b/js/ui/gene_search.js @@ -2,6 +2,7 @@ import { update_square_scatter_layer } from '../deck-gl/layers/square_scatter_la import { update_cat, update_selected_cats } from '../global_variables/cat'; import { update_cell_exp_array } from '../global_variables/cell_exp_array'; import { update_selected_genes } from '../global_variables/selected_genes'; +import { update_selected_proteins } from '../global_variables/selected_proteins'; import { update_tile_exp_array } from '../global_variables/tile_exp_array'; import { set_gene_search_input } from './gene_search_input'; @@ -26,6 +27,7 @@ const sst_gene_search_callback = async (deck_sst, viz_state, layers_sst) => { inst_gene === '' ? [] : [inst_gene], viz_state.obs_store ); + update_selected_proteins(viz_state.proteins, [], viz_state.obs_store); update_selected_cats(viz_state.cats, [], viz_state.obs_store); if (inst_gene !== '' && gene_search_options.includes(inst_gene)) { @@ -58,6 +60,7 @@ const ist_gene_search_callback = async (deck_ist, layers_obj, viz_state) => { inst_gene === '' ? [] : [inst_gene], viz_state.obs_store ); + update_selected_proteins(viz_state.proteins, [], viz_state.obs_store); const inst_gene_in_gene_names = viz_state.genes.gene_names.includes(inst_gene); diff --git a/js/ui/ui_containers.js b/js/ui/ui_containers.js index 49e02b60e..505ec98c2 100644 --- a/js/ui/ui_containers.js +++ b/js/ui/ui_containers.js @@ -33,6 +33,7 @@ import { bar_callback_cat, make_bar_container, bar_callback_gene, + bar_callback_protein, } from './bar_plot'; import { set_gene_search } from './gene_search'; import { logo } from './logo'; @@ -356,6 +357,10 @@ export const make_ist_ui_container = ( gene_container.style.width = bar_container_width; const trx_container = flex_container('trx_container', 'row'); + const protein_container = flex_container('protein_container', 'column'); + protein_container.style.marginTop = '0px'; + protein_container.style.width = bar_container_width; + let nbhd_container; let nbhd_ctrl_container; if (viz_state.nbhd.is_nbhd) { @@ -585,6 +590,9 @@ export const make_ist_ui_container = ( viz_state.cats.svg_bar_cluster = d3.create('svg'); viz_state.genes.svg_bar_gene = d3.create('svg'); + if (!viz_state.proteins.svg_bar_protein) { + viz_state.proteins.svg_bar_protein = d3.create('svg'); + } if (viz_state.nbhd.is_nbhd) { viz_state.nbhd.svg_bar_nbhd = d3.create('svg'); @@ -603,6 +611,8 @@ export const make_ist_ui_container = ( viz_state.containers.bar_gene = make_bar_container(); + viz_state.containers.bar_protein = make_bar_container(); + // only keep the top 100 genes in gene_counts const max_num_gene_bars = 1000; viz_state.genes.gene_counts = viz_state.genes.gene_counts @@ -620,6 +630,17 @@ export const make_ist_ui_container = ( viz_state ); + make_bar_graph( + viz_state.containers.bar_protein, + bar_callback_protein, + viz_state.proteins.svg_bar_protein, + viz_state.proteins.top_protein_counts || [], + viz_state.proteins.color_dict_protein || {}, + deck_ist, + layers_obj, + viz_state + ); + const make_bar_cat_subscriber = (svg, container) => { return (selected_cats) => { // --- 1. Update the styles --- @@ -691,6 +712,16 @@ export const make_ist_ui_container = ( { immediate: false } ); + if (viz_state.obs_store.selected_proteins) { + viz_state.obs_store.selected_proteins.subscribe( + make_bar_cat_subscriber( + viz_state.proteins.svg_bar_protein, + viz_state.containers.bar_protein + ), + { immediate: false } + ); + } + const subscriber_new_bar_data = ({ svg, color_dict, selected_array, bar_callback, container }) => (bar_data) => { @@ -800,6 +831,19 @@ export const make_ist_ui_container = ( { immediate: false } ); + if (viz_state.obs_store.new_protein_bar_data) { + viz_state.obs_store.new_protein_bar_data.subscribe( + subscriber_new_bar_data({ + svg: viz_state.proteins.svg_bar_protein, + color_dict: viz_state.proteins.color_dict_protein || {}, + selected_array: viz_state.proteins.selected_proteins || [], + bar_callback: bar_callback_protein, + container: viz_state.containers.bar_protein, + }), + { immediate: false } + ); + } + cell_container.appendChild(cell_ctrl_container); cell_container.appendChild(viz_state.containers.bar_cluster); @@ -810,6 +854,19 @@ export const make_ist_ui_container = ( gene_container.appendChild(trx_container); gene_container.appendChild(viz_state.containers.bar_gene); + const protein_label = document.createElement('div'); + protein_label.textContent = 'PRT'; + protein_label.style.fontWeight = 'bold'; + protein_label.style.fontSize = '12px'; + protein_label.style.color = 'blue'; + protein_label.style.marginTop = '5px'; + protein_label.style.marginLeft = '5px'; + protein_label.style.userSelect = 'none'; + protein_label.style.fontFamily = + '-apple-system, BlinkMacSystemFont, "San Francisco", "Helvetica Neue", Helvetica, Arial, sans-serif'; + protein_container.appendChild(protein_label); + protein_container.appendChild(viz_state.containers.bar_protein); + set_gene_search('ist', deck_ist, layers_obj, viz_state); viz_state.genes.gene_search.style.marginLeft = '0px'; @@ -855,6 +912,7 @@ export const make_ist_ui_container = ( } ctrl_container.appendChild(cell_container); ctrl_container.appendChild(gene_container); + ctrl_container.appendChild(protein_container); viz_state.genes.gene_search.style.width = '160px'; viz_state.genes.gene_search.style.marginLeft = '5px'; diff --git a/js/viz/landscape_ist.js b/js/viz/landscape_ist.js index 1a439e433..89fd41429 100644 --- a/js/viz/landscape_ist.js +++ b/js/viz/landscape_ist.js @@ -60,7 +60,9 @@ import { import { set_landscape_parameters } from '../global_variables/landscape_parameters'; import { set_cluster_metadata } from '../global_variables/meta_cluster'; import { set_meta_gene } from '../global_variables/meta_gene'; +import { set_meta_protein } from '../global_variables/meta_protein'; import { update_selected_genes } from '../global_variables/selected_genes'; +import { update_selected_proteins } from '../global_variables/selected_proteins'; import { colorToRgba } from '../matrix/cat_data'; import { create_obs_store } from '../obs_store/obs_store'; import { toggle_slider, set_image_layer_sliders } from '../ui/sliders'; @@ -300,6 +302,15 @@ export const landscape_ist = async ( viz_state.genes.trx_slider = document.createElement('input'); viz_state.genes.gene_search = document.createElement('div'); + viz_state.proteins = {}; + viz_state.proteins.color_dict_protein = {}; + viz_state.proteins.protein_names = []; + viz_state.proteins.meta_protein = {}; + viz_state.proteins.protein_counts = []; + viz_state.proteins.top_protein_counts = []; + viz_state.proteins.selected_proteins = []; + viz_state.proteins.svg_bar_protein = d3.create('svg'); + viz_state.cats.cell_exp_array = []; viz_state.cats.cell_names_array = []; viz_state.cats.cell_name_to_index_map = new Map(); @@ -354,6 +365,19 @@ export const landscape_ist = async ( viz_state.aws ); + await set_meta_protein( + viz_state.proteins, + base_url, + viz_state.seg.version, + viz_state.aws + ); + + if (viz_state.obs_store.new_protein_bar_data) { + viz_state.obs_store.new_protein_bar_data.set( + viz_state.proteins.top_protein_counts || [] + ); + } + await set_cluster_metadata(viz_state); viz_state.views = set_views(tech); @@ -686,6 +710,11 @@ export const landscape_ist = async ( update_cat(viz_state.cats, new_cat); update_selected_genes(viz_state.genes, [inst_gene], viz_state.obs_store); + update_selected_proteins( + viz_state.proteins, + [], + viz_state.obs_store + ); update_selected_cats( viz_state.cats, new_cat === 'cluster' ? [] : [inst_gene], @@ -712,6 +741,7 @@ export const landscape_ist = async ( update_cat(viz_state.cats, 'cluster'); update_selected_cats(viz_state.cats, [inst_col], viz_state.obs_store); update_selected_genes(viz_state.genes, [], viz_state.obs_store); + update_selected_proteins(viz_state.proteins, [], viz_state.obs_store); viz_state.obs_store.deck_check.set({ ...viz_state.obs_store.deck_check.get(), @@ -729,6 +759,7 @@ export const landscape_ist = async ( update_selected_cats(viz_state.cats, new_cats, viz_state.obs_store); update_selected_genes(viz_state.genes, [], viz_state.obs_store); + update_selected_proteins(viz_state.proteins, [], viz_state.obs_store); viz_state.obs_store.deck_check.set({ ...viz_state.obs_store.deck_check.get(), diff --git a/js/viz/landscape_sst.js b/js/viz/landscape_sst.js index c763c6f37..14f6cf5ac 100644 --- a/js/viz/landscape_sst.js +++ b/js/viz/landscape_sst.js @@ -134,6 +134,15 @@ export const landscape_sst = async ( viz_state.genes.gene_search = document.createElement('div'); viz_state.genes.svg_bar_gene = d3.create('svg'); + viz_state.proteins = {}; + viz_state.proteins.color_dict_protein = {}; + viz_state.proteins.protein_names = []; + viz_state.proteins.meta_protein = {}; + viz_state.proteins.protein_counts = []; + viz_state.proteins.top_protein_counts = []; + viz_state.proteins.selected_proteins = []; + viz_state.proteins.svg_bar_protein = d3.create('svg'); + viz_state.cats = {}; viz_state.cats.cat = 'cluster'; viz_state.cats.reset_cat = false; diff --git a/js/widget_interactions/update_ist_landscape_from_cgm.js b/js/widget_interactions/update_ist_landscape_from_cgm.js index 0f8fafa6a..b0ec6b8f8 100644 --- a/js/widget_interactions/update_ist_landscape_from_cgm.js +++ b/js/widget_interactions/update_ist_landscape_from_cgm.js @@ -1,6 +1,7 @@ import { update_cat, update_selected_cats } from '../global_variables/cat'; import { update_cell_exp_array } from '../global_variables/cell_exp_array'; import { update_selected_genes } from '../global_variables/selected_genes'; +import { update_selected_proteins } from '../global_variables/selected_proteins'; import { handleAsyncError } from '../temp_utils/errorHandler'; import { refresh_layer } from '../utils/refresh_layer'; @@ -37,6 +38,7 @@ export const update_ist_landscape_from_cgm = async ( update_cat(viz_state.cats, new_cat); update_selected_genes(viz_state.genes, [inst_gene], viz_state.obs_store); + update_selected_proteins(viz_state.proteins, [], viz_state.obs_store); // update_selected_cats(viz_state.cats, [], viz_state.obs_store); update_selected_cats( viz_state.cats, @@ -62,6 +64,7 @@ export const update_ist_landscape_from_cgm = async ( update_cat(viz_state.cats, 'cluster'); update_selected_cats(viz_state.cats, [new_cat], viz_state.obs_store); update_selected_genes(viz_state.genes, [], viz_state.obs_store); + update_selected_proteins(viz_state.proteins, [], viz_state.obs_store); refresh_layer(viz_state, layers_obj, 'cell_layer'); } else if (click_type === 'col_dendro') { @@ -70,6 +73,7 @@ export const update_ist_landscape_from_cgm = async ( update_cat(viz_state.cats, 'cluster'); update_selected_cats(viz_state.cats, new_cats, viz_state.obs_store); update_selected_genes(viz_state.genes, [], viz_state.obs_store); + update_selected_proteins(viz_state.proteins, [], viz_state.obs_store); refresh_layer(viz_state, layers_obj, 'cell_layer'); } diff --git a/js/widget_interactions/update_tile_landscape_from_cgm.js b/js/widget_interactions/update_tile_landscape_from_cgm.js index 5682c21cf..f89fdc1f6 100644 --- a/js/widget_interactions/update_tile_landscape_from_cgm.js +++ b/js/widget_interactions/update_tile_landscape_from_cgm.js @@ -2,6 +2,7 @@ import { update_square_scatter_layer } from '../deck-gl/layers/square_scatter_layer'; import { update_cat, update_selected_cats } from '../global_variables/cat'; import { update_selected_genes } from '../global_variables/selected_genes'; +import { update_selected_proteins } from '../global_variables/selected_proteins'; import { update_tile_exp_array } from '../global_variables/tile_exp_array'; export const update_tile_landscape_from_cgm = async ( @@ -33,6 +34,7 @@ export const update_tile_landscape_from_cgm = async ( update_cat(viz_state.cats, inst_gene); await update_tile_exp_array(viz_state, inst_gene); update_selected_genes(viz_state.genes, [inst_gene], viz_state.obs_store); + update_selected_proteins(viz_state.proteins, [], viz_state.obs_store); if (viz_state.genes && viz_state.genes.gene_search_input) { viz_state.genes.gene_search_input.value = inst_gene; @@ -45,6 +47,7 @@ export const update_tile_landscape_from_cgm = async ( viz_state.obs_store ); update_selected_genes(viz_state.genes, [], viz_state.obs_store); + update_selected_proteins(viz_state.proteins, [], viz_state.obs_store); } else if (click_type === 'col_dendro') { update_cat(viz_state.cats, 'cluster'); update_selected_cats( @@ -53,9 +56,11 @@ export const update_tile_landscape_from_cgm = async ( viz_state.obs_store ); update_selected_genes(viz_state.genes, [], viz_state.obs_store); + update_selected_proteins(viz_state.proteins, [], viz_state.obs_store); } else { update_cat(viz_state.cats, 'cluster'); update_selected_genes(viz_state.genes, [], viz_state.obs_store); + update_selected_proteins(viz_state.proteins, [], viz_state.obs_store); } update_square_scatter_layer(viz_state, layers_sst);