From 0ca50a6934747ae74124c4703f5d390592782b6d Mon Sep 17 00:00:00 2001 From: Theo Sanderson Date: Thu, 4 Aug 2022 14:48:45 +0000 Subject: [PATCH] updates --- docs/taxoniumtools.md | 2 - .../src/components/AboutOverlay.jsx | 4 +- .../src/components/SearchPanel.jsx | 64 +++++++++---------- .../src/hooks/usePerNodeFunctions.js | 15 ++++- 4 files changed, 47 insertions(+), 38 deletions(-) diff --git a/docs/taxoniumtools.md b/docs/taxoniumtools.md index 5eb6912d..0179b85a 100644 --- a/docs/taxoniumtools.md +++ b/docs/taxoniumtools.md @@ -35,12 +35,10 @@ You can then open that `tfci-taxonium.jsonl.gz` file at [taxonium.org](http://ta Right now Taxoniumtools is limited in the types of genome annotations it can support, for SARS-CoV-2 we recommend using the exact [modified .gb file we use in the example](https://raw.githubusercontent.com/theosanderson/taxonium/master/taxoniumtools/test_data/hu1.gb), which splits ORF1ab into ORF1a and ORF1b to avoid the need to model ribosome slippage. ``` - ```{note} Some people ask what the "L" in JSONL is for. JSONL means "JSON Lines". Each line of the file is a separate JSON object. In the case of Taxonium JSONL format, the very first line contains a lot of metadata about the tree as a whole, and then each additional line contains information about a single node. It's important to use the "jsonl" extension instead of "json" as otherwise the interface may try to parse your tree as a NextStrain JSON file. ``` - ##### usher_to_taxonium ```{eval-rst} diff --git a/taxonium_web_client/src/components/AboutOverlay.jsx b/taxonium_web_client/src/components/AboutOverlay.jsx index 64f52bd8..70b81346 100644 --- a/taxonium_web_client/src/components/AboutOverlay.jsx +++ b/taxonium_web_client/src/components/AboutOverlay.jsx @@ -15,8 +15,8 @@ function AboutOverlay({ enabled, setEnabled, overlayContent }) {

Welcome to Taxonium

- Taxonium is a web application for exploring phylogenetic trees. - Find out more at our{" "} + Taxonium is a web application for exploring phylogenetic trees. Find + out more at our{" "} {config.enable_ns_download && - selectedDetails.nodeDetails[key] < 1000000 && ( - <> -

- -
+ selectedDetails.nodeDetails[key] < 1000000 && ( + <> +
+ +
- {backend.type === "server" && - selectedDetails.nodeDetails[key] < 20000 && ( - <> -
- -
- - )} - - )} + {backend.type === "server" && + selectedDetails.nodeDetails[key] < 20000 && ( + <> +
+ +
+ + )} + + )} {config.covspectrum_links && (
diff --git a/taxonium_web_client/src/hooks/usePerNodeFunctions.js b/taxonium_web_client/src/hooks/usePerNodeFunctions.js index d351b98a..915cb0da 100644 --- a/taxonium_web_client/src/hooks/usePerNodeFunctions.js +++ b/taxonium_web_client/src/hooks/usePerNodeFunctions.js @@ -3,7 +3,18 @@ import { useMemo } from "react"; function usePerNodeFunctions(data, config) { const getNodeGenotype = (node_id) => { console.log("data", data); - let cur_node = data.data.nodeLookup[node_id]; + + let data_to_use; + if (data.data.nodeLookup[node_id]) { + data_to_use = data.data; + } else if (data.base_data.nodeLookup[node_id]) { + data_to_use = data.base_data; + } else { + console.log("UNEXPECTED ERROR: node not found", node_id); + return null; + } + let cur_node = data_to_use.nodeLookup[node_id]; + const assembled_mutations = []; while (cur_node.parent_id !== cur_node.node_id) { @@ -17,7 +28,7 @@ function usePerNodeFunctions(data, config) { ) ); assembled_mutations.push(...filtered_nt_mutations); - cur_node = data.data.nodeLookup[cur_node.parent_id]; + cur_node = data_to_use.nodeLookup[cur_node.parent_id]; } return assembled_mutations; };