Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #502

Merged
merged 30 commits into from
Jan 16, 2024
Merged

Dev #502

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
ba7896c
Deliver NWK tree only on button click
nav-mohan Apr 26, 2023
d42b614
database, config-folder
nav-mohan Jun 21, 2023
0d377fb
mongodb database scripts
nav-mohan Jul 18, 2023
464fd0f
MongoDB documentation update
nav-mohan Jul 18, 2023
b0f43d4
Merge branch 'dev' into dev
GopiGugan Jul 18, 2023
1b714b3
Required changes for apply_features function #488
SandeepThokala Aug 8, 2023
f675998
Clear console logs and fix config import
GopiGugan Aug 14, 2023
ef3c81d
Specify config file to run cypress unit tests
GopiGugan Aug 14, 2023
4d84766
Generating new srting for refseq #488
SandeepThokala Aug 15, 2023
b3a9dc0
Merge pull request #487 from nav-mohan/dev
ArtPoon Sep 5, 2023
3c6cc28
Merge pull request #492 from PoonLab/iss488
ArtPoon Sep 26, 2023
89cf47d
Update gitignore to include files in data_test
GopiGugan Sep 26, 2023
4c5bf6c
modifying batch.py to separate XBB from other lineages
ArtPoon Oct 26, 2023
57ee327
write empty xbbtree file if no xbb lineages
ArtPoon Oct 27, 2023
12c7601
Handle edge case for unassigned lineages
GopiGugan Nov 20, 2023
6312684
Front-end changes for separate XBB tree #489
GopiGugan Nov 21, 2023
b73e315
Update NWK and CSV button functionality
GopiGugan Nov 27, 2023
b6610ea
Fix search by accession and lineage functionality #489
GopiGugan Dec 5, 2023
73b4efe
Fix search by country
GopiGugan Dec 8, 2023
ec006a5
Improve search by country
GopiGugan Dec 11, 2023
7ea31cb
Update front-end cypress tests
GopiGugan Dec 12, 2023
3a62f31
Transfer xbbtree.nwk, remove unused endpoint
GopiGugan Dec 17, 2023
bbb4ddf
Potential fix for #496
GopiGugan Dec 18, 2023
fd4371f
Modify default tree colouring option
GopiGugan Dec 19, 2023
53ae7da
Rename "Recombinants" to "Other Recombinants"
GopiGugan Dec 19, 2023
8f30b99
Modify MongoDB collection for the XBB tree
GopiGugan Dec 19, 2023
260a47c
Update front-end unit tests
GopiGugan Dec 21, 2023
3f1dce1
Create object for XBB tips
GopiGugan Dec 21, 2023
68c22e6
Hide NWK button for beadplots with no edges
GopiGugan Dec 21, 2023
e2cd776
Merge pull request #498 from PoonLab/xbbtree
GopiGugan Dec 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix search by accession and lineage functionality #489
  • Loading branch information
GopiGugan committed Dec 5, 2023
commit b6610ea7f04e1a23bd8e4d8c91c0b0fe398dd086
14 changes: 13 additions & 1 deletion dbmanager_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { readTree } = require('./server/phylo')
const fs = require('fs');

const { $DATA_FOLDER } = require('./config/config');

const dbstats = require(`./${$DATA_FOLDER}/dbstats.json`)
require("./globalVariables")

class TestDBManager {
Expand Down Expand Up @@ -64,6 +64,18 @@ class TestDBManager {
})
}

get_display(cindex) {
return new Promise((resolve,reject)=>{
var rawLineage = dbstats["lineages"][global.clusters[cindex].lineage]["raw_lineage"];
if (rawLineage.startsWith("XBB"))
resolve(["XBB Lineages"]);
else if (rawLineage.startsWith("X"))
resolve(["Recombinants"]);
else
resolve(["Non-Recombinants"]);
});
}

get_accession(accession) {
return new Promise((resolve,reject)=>{
resolve(global.accn_to_cid[accession]);
Expand Down
5 changes: 1 addition & 4 deletions js/covizu.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ req.done(async function() {

// Maps id to a cidx
const reverse_recombinant_tips = [...recombinant_tips].reverse()
var all_tips = [...tips, ...reverse_recombinant_tips]
var all_tips = [...tips, ...reverse_recombinant_tips, ...df_xbb]
console.log("tips = ",tips)
console.log("recombinant_tips = ",recombinant_tips)
console.log("all_tips = ",all_tips)
Expand Down Expand Up @@ -417,7 +417,6 @@ req.done(async function() {
$('#error_message').text(``);
$('#search-button').removeAttr("disabled");
$('#clear_button').removeAttr("disabled");
reset_tree();
wrap_search();
enable_buttons();

Expand Down Expand Up @@ -471,7 +470,6 @@ req.done(async function() {
$('#error_message').text(``);
$("#loading").show();
$("#loading_text").text(i18n_text.loading);
await reset_tree(partial_redraw=true);
await wrap_search();
enable_buttons();

Expand Down Expand Up @@ -548,7 +546,6 @@ req.done(async function() {
$('#error_message').text(``);
$("#loading").show();
$("#loading_text").text(i18n_text.loading);
await reset_tree(partial_redraw=true);
await wrap_search();
enable_buttons();
$("#loading").hide();
Expand Down
15 changes: 9 additions & 6 deletions js/drawtree.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,10 +549,10 @@ $("#select-tree-colours").change(function() {
});


$("#display-tree").change(async function() {
async function changeDisplay() {
var curr_date = new Date();
curr_date.setFullYear(curr_date.getFullYear() - 1);
const tree_multiplier = 100000000;
const tree_multiplier = 100000000;

var handle = $( "#tree-slider-handle" );
var cutoff_date = $( "#cutoff-date" );
Expand Down Expand Up @@ -580,14 +580,13 @@ $("#display-tree").change(async function() {
$("#tree-slider").slider("option", "min", min);
$("#tree-slider").slider("option", "max", max);
$("#tree-slider").slider("option", "value", (start_value > min && start_value < max) ? start_value : min);

$("#cutoff-date").text(xaxis_to_date($("#tree-slider").slider("option", "value")/tree_multiplier, tips_obj[0], d3.min(tips_obj, function(d) {return d.first_date}), d3.max(tips_obj, function(d) {return d.last_date})));
$("#tree-cutoff").css('left', $("#tree-slider-handle").position().left);

$("#tree-slider").slider("option", "slide", async function( event, ui ) {
$("#tree-slider").slider("option", "slide", async function( event, ui ) {
cutoff_date.text(xaxis_to_date(ui.value/tree_multiplier, tips_obj[0], d3.min(tips_obj, function(d) {return d.first_date}), d3.max(tips_obj, function(d) {return d.last_date})));
await handle.change()

cutoff_line.css('visibility', 'visible');
var cutoff_pos = handle.position().left;
cutoff_line.css('left', cutoff_pos + 29);
Expand All @@ -602,12 +601,16 @@ $("#display-tree").change(async function() {
cindex = node.__data__.cluster_idx;
d3.select('#cidx-' + cindex).attr("class", "clicked");
draw_cluster_box(d3.select(node));

await beadplot(cindex);
gentable(node.__data__);
draw_region_distribution(node.__data__.allregions);
gen_details_table(points); // update details table with all samples
gen_mut_table(mutations[cindex]);
}

$("#display-tree").change(async function() {
await changeDisplay();
});


Expand Down
20 changes: 20 additions & 0 deletions js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,16 @@ async function lineage_search(text_query) {
return;
}

// Get the lineage to determine if the tree needs to be redrawn
var display = await getdata(`/api/display/${cidx}`);

if (!($("#display-tree").val() === display[0])) {
await $("#display-tree").val(display[0])
await changeDisplay();
}

await reset_tree(partial_redraw=true);

var cluster = select_cluster("cidx-"+cidx);

// Reduces the opacity of all clusters
Expand Down Expand Up @@ -268,6 +278,16 @@ async function accession_search(text_query) {
return;
}

// Get the lineage to determine if the tree needs to be redrawn
var display = await getdata(`/api/display/${cidx}`);

if (!($("#display-tree").val() === display[0])) {
await $("#display-tree").val(display[0])
await changeDisplay();
}

await reset_tree(partial_redraw=true);

var cluster = select_cluster("cidx-"+cidx);

d3.select("#svg-timetree")
Expand Down
6 changes: 6 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ app.get('/api/xbbtips', (req, res) => {
})
});

app.get('/api/display/:cindex', (req, res) => {
dbManager.get_display(req.params.cindex).then(result=>{
res.send(result);
})
});

app.get('/api/df', (req, res) => {
dbManager.get_df().then(result=>{
res.send(result)
Expand Down
Loading