Skip to content

Commit

Permalink
Minor bug fixes for local version displaying snps, disable server db …
Browse files Browse the repository at this point in the history
…features
  • Loading branch information
mrkylesmith committed Aug 12, 2024
1 parent 0bc76c7 commit b5ab491
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 41 deletions.
6 changes: 2 additions & 4 deletions install/rivet_env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 11 additions & 9 deletions rivet-frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand All @@ -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")
Expand Down
61 changes: 34 additions & 27 deletions static/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
/*
Expand Down Expand Up @@ -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');
});
}
}
2 changes: 1 addition & 1 deletion templates/local.html
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ <h3 class="offcanvas-title" id="offcanvasScrollingLabel">Selected Node Descendan
processData: false,
success: function(response){
$('#main').text(response)
console.log("RESPONSE: ", response);
//console.log("RESPONSE: ", response);
track(response);
}
})
Expand Down

0 comments on commit b5ab491

Please sign in to comment.