diff --git a/install/rivet_env.yml b/install/rivet_env.yml index 5ca77df..0c135de 100644 --- a/install/rivet_env.yml +++ b/install/rivet_env.yml @@ -4,10 +4,8 @@ channels: dependencies: - pip - seaborn = 0.12.1 - - google-cloud-storage = 2.7.0 - - google-cloud-sdk = 412.0.0 - - flask = 2.2.2 - - flask-caching = 2.0.1 + - flask + - flask-caching - biopython - pip: - pyyaml diff --git a/rivet-frontend.py b/rivet-frontend.py index 1ad83fc..95ed009 100644 --- a/rivet-frontend.py +++ b/rivet-frontend.py @@ -623,13 +623,13 @@ def table(): app.config['recomb_desc'] = recomb_desc_dict app.config['desc_data'] = desc_position_table app.config['desc_file'] = desc_file - + # Parameters for full tree descendants information app.config['full_tree_recomb_desc'] = full_tree_desc_position_table app.config['full_tree_sample_counts'] = full_tree_sample_counts app.config['full_tree_desc_data'] = full_tree_desc_position_table app.config['full_tree_desc_file'] = full_tree_desc_file - + # App tree and config parameters app.config['environment'] = config["environment"] app.config['date'] = str(config["date"]) @@ -648,13 +648,15 @@ def table(): app.config['genome_size'] = genome_size app.config['genomic_range'] = genomic_range app.config['gene_region_data'] = gene_region_data - # Name of persistent database file - app.config['db_file'] = config['db_file'] - app.config['aa_tables'] = (config['aa_public'], config['aa_full']) - app.config['sample_table'] = config['sample_table'] - app.config['desc_col'] = config['desc_col'] - app.config['aa_col'] = config['aa_col'] - app.config['node_col'] = config['node_col'] + + if config["environment"].lower() != "local": + # Server config for persistent database file + app.config['db_file'] = config['db_file'] + app.config['aa_tables'] = (config['aa_public'], config['aa_full']) + app.config['sample_table'] = config['sample_table'] + app.config['desc_col'] = config['desc_col'] + app.config['aa_col'] = config['aa_col'] + app.config['node_col'] = config['node_col'] tock = time.perf_counter() print(f"Time elapsed: {tock-tick:.2f} seconds") diff --git a/static/app.js b/static/app.js index 0ad5557..5fced1c 100644 --- a/static/app.js +++ b/static/app.js @@ -26,8 +26,17 @@ function main() { init_coordinate_track(svg.append('svg'), init_track_width, data); })}); - // On load, show the full tree title by default - document.querySelector('#full_title').removeAttribute('hidden'); + const public_table = document.querySelector('#public_tree'); + const full_table = document.querySelector('#full_tree'); + const public_title = document.querySelector('#public_title'); + const full_title = document.querySelector('#full_title'); + const search_by_sample = document.querySelector('#search'); + const search_by_aa = document.querySelector('#search_by_aa'); + + if (full_title) { + // On load, show the full tree title by default + document.querySelector('#full_title').removeAttribute('hidden'); + } // SNV plot svg download and copy buttons setup /* @@ -115,30 +124,28 @@ reate_button('copy_svg', 'Copy SNV Plot', 1200, 280); download_taxonium(); }, false); } - const public_table = document.querySelector('#public_tree'); - const full_table = document.querySelector('#full_tree'); - const public_title = document.querySelector('#public_title'); - const full_title = document.querySelector('#full_title'); - const search_by_sample = document.querySelector('#search'); - const search_by_aa = document.querySelector('#search_by_aa'); - // Listen if public tree selected, update title to public tree title - // and remove search by EPI identifier and amino acid mutation - public_table.addEventListener('click', () => { - full_title.setAttribute('hidden', true); - search_by_sample.setAttribute('hidden', true); - search_by_aa.setAttribute('hidden', true); - desc_button.removeAttribute('hidden'); - full_tree_desc_button.setAttribute('hidden', true); - public_title.removeAttribute('hidden'); - }); - - full_table.addEventListener('click', () => { - public_title.setAttribute('hidden', true); - full_title.removeAttribute('hidden'); - search_by_sample.removeAttribute('hidden'); - search_by_aa.removeAttribute('hidden'); - desc_button.setAttribute('hidden', true); - full_tree_desc_button.removeAttribute('hidden'); - }); + if (public_table) { + // Listen if public tree selected, update title to public tree title + // and remove search by EPI identifier and amino acid mutation + public_table.addEventListener('click', () => { + full_title.setAttribute('hidden', true); + search_by_sample.setAttribute('hidden', true); + search_by_aa.setAttribute('hidden', true); + desc_button.removeAttribute('hidden'); + full_tree_desc_button.setAttribute('hidden', true); + public_title.removeAttribute('hidden'); + }); + } + + if (full_table) { + full_table.addEventListener('click', () => { + public_title.setAttribute('hidden', true); + full_title.removeAttribute('hidden'); + search_by_sample.removeAttribute('hidden'); + search_by_aa.removeAttribute('hidden'); + desc_button.setAttribute('hidden', true); + full_tree_desc_button.removeAttribute('hidden'); + }); + } } diff --git a/templates/local.html b/templates/local.html index 54a3fba..f8eadca 100644 --- a/templates/local.html +++ b/templates/local.html @@ -191,7 +191,7 @@

Selected Node Descendan processData: false, success: function(response){ $('#main').text(response) - console.log("RESPONSE: ", response); + //console.log("RESPONSE: ", response); track(response); } })