From d7792b45ad3642715f589bed41b5c4d5d40e0c98 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 24 Apr 2023 23:09:17 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- taxonium_backend/server.js | 26 ++++++------ taxonium_data_handling/exporting.js | 8 ++-- taxonium_data_handling/filtering.js | 42 +++++++++---------- taxonium_data_handling/importing.js | 12 +++--- taxonium_electron/index.html | 2 +- taxonium_electron/src/main.js | 2 +- taxonium_web_client/public/index.html | 2 +- taxonium_web_client/src/App.jsx | 6 +-- taxonium_web_client/src/Deck.jsx | 8 ++-- taxonium_web_client/src/Taxonium.jsx | 4 +- taxonium_web_client/src/components/Basic.jsx | 6 +-- .../src/components/DeckSettingsModal.jsx | 8 ++-- .../src/components/InputSupplier.jsx | 6 +-- .../src/components/JBrowseErrorBoundary.jsx | 2 +- .../src/components/JBrowsePanel.jsx | 6 +-- taxonium_web_client/src/components/Key.jsx | 2 +- .../src/components/NodeHoverTip.jsx | 4 +- .../src/components/SearchItem.jsx | 6 +-- .../src/components/SearchPanel.jsx | 14 +++---- .../src/components/SearchTopLayerItem.jsx | 2 +- .../src/components/TreenomeModal.jsx | 2 +- taxonium_web_client/src/hooks/useColor.js | 6 +-- taxonium_web_client/src/hooks/useColorBy.js | 12 +++--- .../src/hooks/useGetDynamicData.js | 12 +++--- .../src/hooks/useInputHelper.js | 16 +++---- taxonium_web_client/src/hooks/useLayers.js | 16 +++---- .../src/hooks/useLocalBackend.js | 18 ++++---- .../src/hooks/useNodeDetails.js | 2 +- .../src/hooks/usePerNodeFunctions.js | 8 ++-- .../src/hooks/useQueryAsState.js | 4 +- taxonium_web_client/src/hooks/useSearch.js | 18 ++++---- .../src/hooks/useServerBackend.js | 20 ++++----- taxonium_web_client/src/hooks/useSettings.js | 8 ++-- .../src/hooks/useTreenomeAnnotations.js | 2 +- .../src/hooks/useTreenomeLayerData.js | 6 +-- .../src/hooks/useTreenomeLayers.js | 8 ++-- .../src/hooks/useTreenomeState.js | 2 +- taxonium_web_client/src/hooks/useView.js | 8 ++-- taxonium_web_client/src/index.js | 2 +- taxonium_web_client/src/utils/jstree.js | 6 +-- .../src/utils/nexusToNewick.js | 2 +- .../src/utils/processNewick.js | 6 +-- .../src/utils/processNextstrain.js | 12 +++--- .../src/utils/reduceMaxOrMin.js | 4 +- .../src/webworkers/localBackendWorker.js | 10 ++--- .../src/webworkers/treenomeWorker.js | 2 +- 46 files changed, 190 insertions(+), 190 deletions(-) diff --git a/taxonium_backend/server.js b/taxonium_backend/server.js index 43ac3525..208777f6 100644 --- a/taxonium_backend/server.js +++ b/taxonium_backend/server.js @@ -25,7 +25,7 @@ program .option("--data_url ", "data url") .option( "--data_file ", - "local data file, as alternative to data url" + "local data file, as alternative to data url", ); program.parse(); @@ -153,7 +153,7 @@ app.get("/search", function (req, res) { result.data.length + " results in " + (Date.now() - start_time) + - "ms" + "ms", ); console.log("Result type was " + result.type); }); @@ -255,7 +255,7 @@ app.get("/nodes/", function (req, res) { max_y, min_x, max_x, - req.query.xType + req.query.xType, ); } console.log("Ready to send after " + (Date.now() - start_time) + "ms."); @@ -267,7 +267,7 @@ app.get("/nodes/", function (req, res) { (Date.now() - start_time) + "ms, and output " + result.length + - " nodes." + " nodes.", ); }); @@ -275,11 +275,11 @@ function startListening() { if (command_options.ssl) { options = { key: fs.readFileSync( - "/etc/letsencrypt/live/api.taxonium.org/privkey.pem" + "/etc/letsencrypt/live/api.taxonium.org/privkey.pem", ), ca: fs.readFileSync("/etc/letsencrypt/live/api.taxonium.org/chain.pem"), cert: fs.readFileSync( - "/etc/letsencrypt/live/api.taxonium.org/fullchain.pem" + "/etc/letsencrypt/live/api.taxonium.org/fullchain.pem", ), }; https.createServer(options, app).listen(command_options.port, "0.0.0.0"); @@ -451,7 +451,7 @@ app.get("/node_details/", async (req, res) => { } validateSIDandSend(detailed_node, req.query.sid, res); console.log( - "Request took " + (Date.now() - start_time) + "ms, and output " + node + "Request took " + (Date.now() - start_time) + "ms, and output " + node, ); }); @@ -462,7 +462,7 @@ app.get("/tip_atts", async (req, res) => { const atts = filtering.getTipAtts(processedData.nodes, node_id, att); validateSIDandSend(atts, req.query.sid, res); console.log( - "Request took " + (Date.now() - start_time) + "ms, and output " + atts + "Request took " + (Date.now() - start_time) + "ms, and output " + atts, ); }); @@ -473,11 +473,11 @@ app.get("/nextstrain_json/:root_id", async (req, res) => { root_id, processedData.nodes, config, - processedData.mutations + processedData.mutations, ); res.setHeader( "Content-Disposition", - "attachment; " + "filename=" + root_id + ".nextstrain.json" + "attachment; " + "filename=" + root_id + ".nextstrain.json", ); res.send(json); }); @@ -503,7 +503,7 @@ const loadData = async () => { processedData = await importing.processJsonl( supplied_object, - logStatusMessage + logStatusMessage, ); logStatusMessage({ @@ -515,7 +515,7 @@ const loadData = async () => { } processedData.genes = new Set( - processedData.mutations.map((mutation) => mutation.gene) + processedData.mutations.map((mutation) => mutation.gene), ); // as array processedData.genes = Array.from(processedData.genes); @@ -528,7 +528,7 @@ const loadData = async () => { processedData.overallMaxY, processedData.overallMinX, processedData.overallMaxX, - "x_dist" + "x_dist", ); cached_starting_values = result; diff --git a/taxonium_data_handling/exporting.js b/taxonium_data_handling/exporting.js index e7b43a98..a8456f87 100644 --- a/taxonium_data_handling/exporting.js +++ b/taxonium_data_handling/exporting.js @@ -3,7 +3,7 @@ const addAAmuts = (aaMuts, node) => { aaMuts.forEach((m) => { if (alreadyIn.includes(m.gene)) { node.branch_attrs.mutations[m.gene].push( - `${m.previous_residue}${m.residue_pos}${m.new_residue}` + `${m.previous_residue}${m.residue_pos}${m.new_residue}`, ); } else { node.branch_attrs.mutations[m.gene] = [ @@ -16,7 +16,7 @@ const addAAmuts = (aaMuts, node) => { const addNucMuts = (nucMuts, node) => { node.branch_attrs.mutations["nuc"] = nucMuts.map( - (m) => `${m.previous_residue}${m.residue_pos}${m.new_residue}` + (m) => `${m.previous_residue}${m.residue_pos}${m.new_residue}`, ); }; @@ -25,7 +25,7 @@ export const getNextstrainSubtreeJson = async ( subtree_root_id, nodes, config, - mutations + mutations, ) => { const subtree_root = nodes.find((node) => node.node_id === subtree_root_id); @@ -81,7 +81,7 @@ export const getNextstrainSubtreeJson = async ( const aaMuts = muts.filter((m) => m.type === "aa"); const nucMutsNoAmb = nucMuts.filter( - (m) => m.new_residue != "-" && m.previous_residue != "-" + (m) => m.new_residue != "-" && m.previous_residue != "-", ); // TODO: Above discards ambiguities from distance calculation. // Do we want to do this? In mpx e.g. there are nodes with diff --git a/taxonium_data_handling/filtering.js b/taxonium_data_handling/filtering.js index 9ffd9004..42e37943 100644 --- a/taxonium_data_handling/filtering.js +++ b/taxonium_data_handling/filtering.js @@ -39,7 +39,7 @@ const getRevertantMutationsSet = (all_data, node_to_mut, mutations) => { (m) => m.gene in gene_sequence && gene_sequence[m.gene][m.residue_pos] === m.new_residue && - m.new_residue !== m.previous_residue + m.new_residue !== m.previous_residue, ); return new Set(revertant_mutations.map((m) => m.mutation_id)); }; @@ -53,7 +53,7 @@ const reduceOverPlotting = (input, precisionX, precisionY, xType) => { "precisionX:", precisionX, "precisionY:", - precisionY + precisionY, ); const filtered = input.filter((node) => { @@ -126,7 +126,7 @@ const addParents = (data, filtered) => { } } const with_parents = data.filter((node) => - selected_node_ids_set.has(node.node_id) + selected_node_ids_set.has(node.node_id), ); const final_size = with_parents.length; console.log("Adding parents took " + (Date.now() - start_time) + "ms."); @@ -154,7 +154,7 @@ function getNodes(data, y_positions, min_y, max_y, min_x, max_x, xType) { filtered.filter((node) => node.num_tips == 1), getPrecision(min_x, max_x), getPrecision(min_y, max_y), - xType + xType, ); const time3 = Date.now(); console.log("Reducing took " + (time3 - time2) + "ms."); @@ -197,7 +197,7 @@ function searchFiltering({ if (cache_helper && cache_helper.store_in_cache) { cache_helper.store_in_cache( hash_spec, - result.map((node) => node.node_id) + result.map((node) => node.node_id), ); } return result; @@ -226,7 +226,7 @@ function searchFilteringIfUncached({ node_to_mut: node_to_mut, all_data: all_data, cache_helper: cache_helper, - }) + }), ); workingData = workingData.filter((n) => new_results.has(n)); }); @@ -280,14 +280,14 @@ function searchFilteringIfUncached({ spec.text = spec.text.toLowerCase(); filtered = data.filter( (node) => - node[spec.type] && node[spec.type].toLowerCase().includes(spec.text) + node[spec.type] && node[spec.type].toLowerCase().includes(spec.text), ); return filtered; } else if (spec.method === "text_exact") { // case insensitive spec.text = spec.text.toLowerCase(); filtered = data.filter( - (node) => node[spec.type] && node[spec.type].toLowerCase() === spec.text + (node) => node[spec.type] && node[spec.type].toLowerCase() === spec.text, ); return filtered; } else if (spec.method === "text_per_line") { @@ -299,7 +299,7 @@ function searchFilteringIfUncached({ .map((line) => { return line.trim(); }) - .filter((line) => line !== "") + .filter((line) => line !== ""), ); filtered = data.filter((node) => { @@ -333,8 +333,8 @@ function searchFilteringIfUncached({ filtered = data.filter( (node) => node_to_mut[node.node_id].some((mutation_id) => - relevant_mutations_set.has(mutation_id) - ) && node.num_tips > spec.min_tips + relevant_mutations_set.has(mutation_id), + ) && node.num_tips > spec.min_tips, ); //console.log("filtered:", filtered); return filtered; @@ -346,7 +346,7 @@ function searchFilteringIfUncached({ revertant_mutations_set = getRevertantMutationsSet( all_data, node_to_mut, - mutations + mutations, ); } @@ -354,8 +354,8 @@ function searchFilteringIfUncached({ (node) => node.num_tips > spec.min_tips && node_to_mut[node.node_id].some((mutation_id) => - revertant_mutations_set.has(mutation_id) - ) + revertant_mutations_set.has(mutation_id), + ), ); //console.log("filtered:", filtered); return filtered; @@ -374,7 +374,7 @@ function searchFilteringIfUncached({ const number_value = parseFloat(spec.number); const filterFunc = getNumericFilterFunction( spec.number_method, - number_value + number_value, ); filtered = data.filter((node) => filterFunc(node[spec.type])); @@ -430,7 +430,7 @@ function singleSearch({ // TODO if we ensured all searches maintained order we could use binary search here const filtered_cut = filtered.filter( - (node) => node.y < max_y && node.y > min_y + (node) => node.y < max_y && node.y > min_y, ); console.log("length of filtered_cut:", filtered_cut.length); @@ -442,7 +442,7 @@ function singleSearch({ filtered_cut, getPrecision(min_x, max_x), getPrecision(min_y, max_y), - xType + xType, ); result = { type: "filtered", @@ -530,7 +530,7 @@ const filterByGenotype = (data, genotype, mutations, node_to_mut, all_data) => { const positive_mutations = new Set( relevant_mutations .filter((mutation) => mutation.new_residue === new_residue) - .map((m) => m.mutation_id) + .map((m) => m.mutation_id), ); // if no positive mutations then return empty array @@ -541,7 +541,7 @@ const filterByGenotype = (data, genotype, mutations, node_to_mut, all_data) => { const negative_mutations = new Set( relevant_mutations .filter((mutation) => mutation.new_residue !== new_residue) - .map((m) => m.mutation_id) + .map((m) => m.mutation_id), ); const output = data.filter((node) => { // console.log("node:",node); @@ -556,7 +556,7 @@ const filterByGenotype = (data, genotype, mutations, node_to_mut, all_data) => { const is_positive = cache_value === true || node_to_mut[cur_node.node_id].some((mutation_id) => - positive_mutations.has(mutation_id) + positive_mutations.has(mutation_id), ); if (is_positive) { // console.log("positive"); @@ -568,7 +568,7 @@ const filterByGenotype = (data, genotype, mutations, node_to_mut, all_data) => { const is_negative = cache_value === false || node_to_mut[cur_node.node_id].some((mutation_id) => - negative_mutations.has(mutation_id) + negative_mutations.has(mutation_id), ); if (is_negative) { // console.log("negative"); diff --git a/taxonium_data_handling/importing.js b/taxonium_data_handling/importing.js index f872f0a4..d061406e 100644 --- a/taxonium_data_handling/importing.js +++ b/taxonium_data_handling/importing.js @@ -20,13 +20,13 @@ function reduceMaxOrMin(array, accessFunction, maxOrMin) { return accessFunction( array.reduce(function (max, item) { return accessFunction(item) > accessFunction(max) ? item : max; - }) + }), ); } else if (maxOrMin === "min") { return accessFunction( array.reduce(function (min, item) { return accessFunction(item) < accessFunction(min) ? item : min; - }) + }), ); } } @@ -84,7 +84,7 @@ export const setUpStream = (the_stream, data, sendStatusMessage) => { export const processJsonl = async (jsonl, sendStatusMessage) => { console.log( - "Worker processJsonl" //, jsonl + "Worker processJsonl", //, jsonl ); const data = jsonl.data; const status = jsonl.status; @@ -164,12 +164,12 @@ export const processJsonl = async (jsonl, sendStatusMessage) => { const overallMaxX = reduceMaxOrMin( new_data.nodes, (node) => node.x_dist, - "max" + "max", ); const overallMinX = reduceMaxOrMin( new_data.nodes, (node) => node.x_dist, - "min" + "min", ); const root = new_data.nodes.find((node) => node.parent_id === node.node_id); @@ -242,7 +242,7 @@ export const generateConfig = (config, processedUploadedData) => { : ["x_time"]; config.keys_to_display = Object.keys(processedUploadedData.nodes[0]).filter( - (x) => !to_remove.includes(x) + (x) => !to_remove.includes(x), ); /*config.search_types = [ diff --git a/taxonium_electron/index.html b/taxonium_electron/index.html index bcc21135..4de4d650 100644 --- a/taxonium_electron/index.html +++ b/taxonium_electron/index.html @@ -1,4 +1,4 @@ - + diff --git a/taxonium_electron/src/main.js b/taxonium_electron/src/main.js index 86337425..215367db 100644 --- a/taxonium_electron/src/main.js +++ b/taxonium_electron/src/main.js @@ -61,7 +61,7 @@ const setup = (mainWindow, args) => { binaryPath = path.join(binaryDirectory, binaryFilename); scriptPath = path.join( __dirname, - "../node_modules/taxonium_backend/server.js" + "../node_modules/taxonium_backend/server.js", ); max_old_space_arg = "--max-old-space-size=" + bytesToMb(maxMemory); diff --git a/taxonium_web_client/public/index.html b/taxonium_web_client/public/index.html index 83e4a1f1..c1ecdfb7 100644 --- a/taxonium_web_client/public/index.html +++ b/taxonium_web_client/public/index.html @@ -1,4 +1,4 @@ - + diff --git a/taxonium_web_client/src/App.jsx b/taxonium_web_client/src/App.jsx index fa2f7f7d..0ba7814d 100644 --- a/taxonium_web_client/src/App.jsx +++ b/taxonium_web_client/src/App.jsx @@ -141,7 +141,7 @@ function App() { // V1 format if (!window.redirecting) { window.alert( - "It looks like you are trying to load a Taxonium V1 proto. We will now redirect you to the V1 site. " + "It looks like you are trying to load a Taxonium V1 proto. We will now redirect you to the V1 site. ", ); } window.redirecting = 1; @@ -152,7 +152,7 @@ function App() { } else { if (!window.redirecting) { window.alert( - "It looks like you are trying to load a Taxonium V1 proto. We will now redirect you to the V1 site. " + "It looks like you are trying to load a Taxonium V1 proto. We will now redirect you to the V1 site. ", ); } window.redirecting = 1; @@ -218,7 +218,7 @@ function App() { className={classNames( "from-gray-500 to-gray-600 bg-gradient-to-bl shadow-md", "flex justify-between items-center px-4 flex-shrink-0", - isGisaid ? "h-11" : "h-16" + isGisaid ? "h-11" : "h-16", )} >

diff --git a/taxonium_web_client/src/Deck.jsx b/taxonium_web_client/src/Deck.jsx index 70528789..58221297 100644 --- a/taxonium_web_client/src/Deck.jsx +++ b/taxonium_web_client/src/Deck.jsx @@ -66,7 +66,7 @@ function Deck({ // Treenome state const setMouseXY = useCallback( (info) => view.setMouseXY([info.x, info.y]), - [view] + [view], ); const [treenomeReferenceInfo, setTreenomeReferenceInfo] = useState(null); @@ -91,7 +91,7 @@ function Deck({ mouseDownPos.current && Math.sqrt( Math.pow(mouseDownPos.current[0] - event.clientX, 2) + - Math.pow(mouseDownPos.current[1] - event.clientY, 2) + Math.pow(mouseDownPos.current[1] - event.clientY, 2), ) > pan_threshold ) { return false; @@ -148,7 +148,7 @@ function Deck({ onViewStateChange, xzoom, deckRef, - ] + ], ); const [hoverInfo, setHoverInfoRaw] = useState(null); @@ -166,7 +166,7 @@ function Deck({ hoverDetails.clearNodeDetails(); } }, - [hoverDetails] + [hoverDetails], ); const { layers, layerFilter, keyStuff } = useLayers({ diff --git a/taxonium_web_client/src/Taxonium.jsx b/taxonium_web_client/src/Taxonium.jsx index b9c4c677..c8b93736 100644 --- a/taxonium_web_client/src/Taxonium.jsx +++ b/taxonium_web_client/src/Taxonium.jsx @@ -46,7 +46,7 @@ function Taxonium({ query.sid, url_on_fail, uploadedData, - proto + proto, ); let hoverDetails = useHoverDetails(); const gisaidHoverDetails = useNodeDetails("gisaid-hovered", backend); @@ -69,7 +69,7 @@ function Taxonium({ (xType) => { updateQuery({ xType }); }, - [updateQuery] + [updateQuery], ); const { data, boundsForQueries, isCurrentlyOutsideBounds } = diff --git a/taxonium_web_client/src/components/Basic.jsx b/taxonium_web_client/src/components/Basic.jsx index b678a55c..6be40401 100644 --- a/taxonium_web_client/src/components/Basic.jsx +++ b/taxonium_web_client/src/components/Basic.jsx @@ -17,7 +17,7 @@ export const Button = ({ className={classNames( "tx-button no-underline", "border border-gray-400 shadow-sm rounded py-1 px-2 bg-gray-100 hover:bg-gray-200 text-sm text-gray-700", - className + className, )} href={href} title={title} @@ -32,7 +32,7 @@ export const Button = ({ className={classNames( "tx-button", "border border-gray-400 shadow-sm rounded py-1 px-2 bg-gray-100 hover:bg-gray-200 text-sm text-gray-700", - className + className, )} onClick={onClick} title={title} @@ -49,7 +49,7 @@ export const Select = ({ onChange, className, children, value, title }) => { className={classNames( "border bg-white text-gray-900 text-sm hover:text-gray-700 py-1 pl-2 pr-6", "focus:ring-gray-800 focus:border-gray-800", - className + className, )} onChange={onChange} value={value} diff --git a/taxonium_web_client/src/components/DeckSettingsModal.jsx b/taxonium_web_client/src/components/DeckSettingsModal.jsx index aa30281c..1aeca546 100644 --- a/taxonium_web_client/src/components/DeckSettingsModal.jsx +++ b/taxonium_web_client/src/components/DeckSettingsModal.jsx @@ -50,7 +50,7 @@ const DeckSettingsModal = ({ checked={settings.displayTextForInternalNodes} onChange={() => settings.setDisplayTextForInternalNodes( - !settings.displayTextForInternalNodes + !settings.displayTextForInternalNodes, ) } />{" "} @@ -65,7 +65,7 @@ const DeckSettingsModal = ({ checked={settings.displayPointsForInternalNodes} onChange={() => settings.setDisplayPointsForInternalNodes( - !settings.displayPointsForInternalNodes + !settings.displayPointsForInternalNodes, ) } />{" "} @@ -81,7 +81,7 @@ const DeckSettingsModal = ({ value={settings.thresholdForDisplayingText} onChange={(e) => settings.setThresholdForDisplayingText( - parseFloat(e.target.value) + parseFloat(e.target.value), ) } step="0.1" @@ -120,7 +120,7 @@ const DeckSettingsModal = ({ onChange={() => settings.setMutationTypeEnabled( key, - !settings.mutationTypesEnabled[key] + !settings.mutationTypesEnabled[key], ) } />{" "} diff --git a/taxonium_web_client/src/components/InputSupplier.jsx b/taxonium_web_client/src/components/InputSupplier.jsx index e9453552..093150ae 100644 --- a/taxonium_web_client/src/components/InputSupplier.jsx +++ b/taxonium_web_client/src/components/InputSupplier.jsx @@ -70,7 +70,7 @@ export const InputSupplier = ({ inputHelper, className }) => { input.filetype = e.target.value; } return input; - }) + }), ); }} > @@ -125,7 +125,7 @@ export const InputSupplier = ({ inputHelper, className }) => { input.ladderize = e.target.checked; } return input; - }) + }), ); }} />{" "} @@ -203,7 +203,7 @@ export const InputSupplier = ({ inputHelper, className }) => { setTempURL( e.target.value .replace("http://", "") - .replace("http://", "https://") + .replace("http://", "https://"), ); }} onKeyUp={(e) => { diff --git a/taxonium_web_client/src/components/JBrowseErrorBoundary.jsx b/taxonium_web_client/src/components/JBrowseErrorBoundary.jsx index a7f77cb5..2723ad37 100644 --- a/taxonium_web_client/src/components/JBrowseErrorBoundary.jsx +++ b/taxonium_web_client/src/components/JBrowseErrorBoundary.jsx @@ -23,7 +23,7 @@ export class JBrowseErrorBoundary extends React.Component { error.message === "Invalid array length" ) { toast.error( - "Error displaying track. Please make sure your file is well-formatted (e.g., validated with https://github.com/EBIvariation/vcf-validator)." + "Error displaying track. Please make sure your file is well-formatted (e.g., validated with https://github.com/EBIvariation/vcf-validator).", ); } } diff --git a/taxonium_web_client/src/components/JBrowsePanel.jsx b/taxonium_web_client/src/components/JBrowsePanel.jsx index 316b51f1..8a0a96d7 100644 --- a/taxonium_web_client/src/components/JBrowsePanel.jsx +++ b/taxonium_web_client/src/components/JBrowsePanel.jsx @@ -283,7 +283,7 @@ function JBrowsePanel(props) { state.session.view ) { freezeTracks.forEach((t) => - state.session.view.showTrack(t.configuration.trackId) + state.session.view.showTrack(t.configuration.trackId), ); } }, [freezeTracks, state]); @@ -308,7 +308,7 @@ function JBrowsePanel(props) { const widget = state.session.addWidget( "AddTrackWidget", "addTrackWidget", - { view: state.session.view.id } + { view: state.session.view.id }, ); // AddTrackWidget calls session.addTrackConf, which // doesn't appear to be defined in the session object @@ -332,7 +332,7 @@ function JBrowsePanel(props) { ":" + props.treenomeState.ntBoundsExt[0] + ".." + - props.treenomeState.ntBoundsExt[1] + props.treenomeState.ntBoundsExt[1], ); props.treenomeState.setNtBoundsExt(null); }, [props.settings.chromosomeName, props.treenomeState, state.session.view]); diff --git a/taxonium_web_client/src/components/Key.jsx b/taxonium_web_client/src/components/Key.jsx index cab6ec39..019f744b 100644 --- a/taxonium_web_client/src/components/Key.jsx +++ b/taxonium_web_client/src/components/Key.jsx @@ -26,7 +26,7 @@ const Key = ({

- ) + ), )} {config.mutations.length > 0 && ( @@ -160,7 +160,7 @@ const NodeHoverTip = ({
Authors:{" "} {fixAuthors( - hoverDetails.nodeDetails.acknowledgements.covv_authors + hoverDetails.nodeDetails.acknowledgements.covv_authors, )}

diff --git a/taxonium_web_client/src/components/SearchItem.jsx b/taxonium_web_client/src/components/SearchItem.jsx index 7f020c4d..458e6c67 100644 --- a/taxonium_web_client/src/components/SearchItem.jsx +++ b/taxonium_web_client/src/components/SearchItem.jsx @@ -82,7 +82,7 @@ const SearchItem = ({ singleSearchSpec, setThisSearchSpec, config }) => { } return [type.name, obj]; - }) + }), ); const setTypeTo = (type) => { @@ -326,7 +326,7 @@ const SearchItem = ({ singleSearchSpec, setThisSearchSpec, config }) => { (foundsubspec, i) => i === singleSearchSpec.subspecs.indexOf(subspec) ? new_subspec - : foundsubspec + : foundsubspec, ), }); }} @@ -340,7 +340,7 @@ const SearchItem = ({ singleSearchSpec, setThisSearchSpec, config }) => { ...singleSearchSpec, subspecs: singleSearchSpec.subspecs.filter( (compsubspec, i) => - i !== singleSearchSpec.subspecs.indexOf(subspec) + i !== singleSearchSpec.subspecs.indexOf(subspec), ), }); }} diff --git a/taxonium_web_client/src/components/SearchPanel.jsx b/taxonium_web_client/src/components/SearchPanel.jsx index 35733736..e26b4e35 100644 --- a/taxonium_web_client/src/components/SearchPanel.jsx +++ b/taxonium_web_client/src/components/SearchPanel.jsx @@ -62,7 +62,7 @@ function SearchPanel({ const covSpectrumQuery = useMemo(() => { if (selectedDetails.nodeDetails && selectedDetails.nodeDetails.node_id) { return perNodeFunctions.getCovSpectrumQuery( - selectedDetails.nodeDetails.node_id + selectedDetails.nodeDetails.node_id, ); } else { return null; @@ -154,7 +154,7 @@ function SearchPanel({ ) { // pop up a warning and ask if we want to continue alert( - "WARNING: This node has a large number of descendants. Displaying them all may take a while or crash this browser window. Are you sure you want to continue? If so press the button again." + "WARNING: This node has a large number of descendants. Displaying them all may take a while or crash this browser window. Are you sure you want to continue? If so press the button again.", ); window.warning_shown = true; return; @@ -188,7 +188,7 @@ function SearchPanel({ backend .getNextstrainJsonUrl( selectedDetails.nodeDetails.node_id, - config + config, ) .replace("https://", "") .replace("http://", "") @@ -360,7 +360,7 @@ function SearchPanel({ value={colorBy.colorByPosition} onChange={(e) => colorBy.setColorByPosition( - e.target.value !== "" ? parseInt(e.target.value) : "" + e.target.value !== "" ? parseInt(e.target.value) : "", ) } type="number" @@ -422,7 +422,7 @@ function SearchPanel({ title="Select parent" onClick={() => { selectedDetails.getNodeDetails( - selectedDetails.nodeDetails.parent_id + selectedDetails.nodeDetails.parent_id, ); }} > @@ -449,7 +449,7 @@ function SearchPanel({ @@ -460,7 +460,7 @@ function SearchPanel({ {[...config.keys_to_display, "num_tips"].map( (key) => selectedDetails.nodeDetails[key] && - formatMetadataItem(key, selectedDetails) + formatMetadataItem(key, selectedDetails), )} {config.mutations.length > 0 && selectedDetails.nodeDetails.node_id !== diff --git a/taxonium_web_client/src/components/SearchTopLayerItem.jsx b/taxonium_web_client/src/components/SearchTopLayerItem.jsx index a00c518d..db753e8d 100644 --- a/taxonium_web_client/src/components/SearchTopLayerItem.jsx +++ b/taxonium_web_client/src/components/SearchTopLayerItem.jsx @@ -34,7 +34,7 @@ function SearchTopLayerItem({ singleSearchSpec, myKey, search, config }) { // set the new searchSpec array search.setSearchSpec(newSearchSpec); }, - [search, getMyIndex] + [search, getMyIndex], ); const enabled = diff --git a/taxonium_web_client/src/components/TreenomeModal.jsx b/taxonium_web_client/src/components/TreenomeModal.jsx index 1f43f47e..ce688759 100644 --- a/taxonium_web_client/src/components/TreenomeModal.jsx +++ b/taxonium_web_client/src/components/TreenomeModal.jsx @@ -20,7 +20,7 @@ const TreenomeModal = ({ settings, }) => { const [inputChromosome, setInputChromosome] = useState( - settings.chromosomeName + settings.chromosomeName, ); return ( { } return rgb; }, - [colorMapping] + [colorMapping], ); const toRGB = useCallback( @@ -148,7 +148,7 @@ const useColor = (colorMapping) => { return result; } }, - [toRGB_uncached] + [toRGB_uncached], ); const toRGBCSS = useCallback( @@ -156,7 +156,7 @@ const useColor = (colorMapping) => { const output = toRGB(string); return `rgb(${output[0]},${output[1]},${output[2]})`; }, - [toRGB] + [toRGB], ); const output = useMemo(() => { diff --git a/taxonium_web_client/src/hooks/useColorBy.js b/taxonium_web_client/src/hooks/useColorBy.js index 7bfbd276..3d068841 100644 --- a/taxonium_web_client/src/hooks/useColorBy.js +++ b/taxonium_web_client/src/hooks/useColorBy.js @@ -32,21 +32,21 @@ function useColorBy(config, query, updateQuery) { (field) => { updateQuery({ color: JSON.stringify({ ...colorByConfig, field }) }); }, - [colorByConfig, updateQuery] + [colorByConfig, updateQuery], ); const setColorByGene = useCallback( (gene) => { updateQuery({ color: JSON.stringify({ ...colorByConfig, gene }) }); }, - [colorByConfig, updateQuery] + [colorByConfig, updateQuery], ); const setColorByPosition = useCallback( (pos) => { updateQuery({ color: JSON.stringify({ ...colorByConfig, pos }) }); }, - [colorByConfig, updateQuery] + [colorByConfig, updateQuery], ); const getNodeColorField = useCallback( @@ -71,7 +71,7 @@ function useColorBy(config, query, updateQuery) { let result; const relevantMutations = node.mutations.filter( (mut) => - mut.residue_pos === colorByPosition && mut.gene === colorByGene + mut.residue_pos === colorByPosition && mut.gene === colorByGene, ); if (relevantMutations.length > 0) { result = relevantMutations[0].new_residue; @@ -87,7 +87,7 @@ function useColorBy(config, query, updateQuery) { ) { result = getNodeColorField( dataset.nodeLookup[parent_id], - dataset + dataset, ); } else { result = "X"; @@ -100,7 +100,7 @@ function useColorBy(config, query, updateQuery) { return node[colorByField]; } }, - [colorByField, colorByGene, colorByPosition] + [colorByField, colorByGene, colorByPosition], ); return useMemo(() => { diff --git a/taxonium_web_client/src/hooks/useGetDynamicData.js b/taxonium_web_client/src/hooks/useGetDynamicData.js index a0172a83..ca49fa11 100644 --- a/taxonium_web_client/src/hooks/useGetDynamicData.js +++ b/taxonium_web_client/src/hooks/useGetDynamicData.js @@ -64,7 +64,7 @@ function useGetDynamicData(backend, colorBy, viewState, config, xType) { viewState.max_x > dynamicData.lastBounds.max_x || viewState.min_y < dynamicData.lastBounds.min_y || viewState.max_y > dynamicData.lastBounds.max_y), - [viewState, dynamicData] + [viewState, dynamicData], ); useEffect(() => { @@ -80,7 +80,7 @@ function useGetDynamicData(backend, colorBy, viewState, config, xType) { setTimeoutRef( setTimeout(() => { setTriggerRefresh({}); - }, CHECK_AGAIN_TIME) + }, CHECK_AGAIN_TIME), ); return; } @@ -96,7 +96,7 @@ function useGetDynamicData(backend, colorBy, viewState, config, xType) { console.log( "got result, bounds were", boundsForQueries, - " result is " + " result is ", ); setDynamicData((prevData) => { @@ -125,7 +125,7 @@ function useGetDynamicData(backend, colorBy, viewState, config, xType) { }); }, undefined, - config + config, ); } } @@ -133,9 +133,9 @@ function useGetDynamicData(backend, colorBy, viewState, config, xType) { }); }, setTriggerRefresh, - config + config, ); - }, DEBOUNCE_TIME) + }, DEBOUNCE_TIME), ); } // eslint-disable-next-line react-hooks/exhaustive-deps diff --git a/taxonium_web_client/src/hooks/useInputHelper.js b/taxonium_web_client/src/hooks/useInputHelper.js index 037c1825..f82afd78 100644 --- a/taxonium_web_client/src/hooks/useInputHelper.js +++ b/taxonium_web_client/src/hooks/useInputHelper.js @@ -92,7 +92,7 @@ export const useInputHelper = ({ if (file.name.includes(".pb")) { // V1 format window.alert( - "It looks like you are trying to load a Taxonium V1 proto. We will now redirect you to the V1 site. Please retry the upload from there." + "It looks like you are trying to load a Taxonium V1 proto. We will now redirect you to the V1 site. Please retry the upload from there.", ); window.location.href = "https://cov2tree-git-v1-theosanderson.vercel.app/"; @@ -130,7 +130,7 @@ export const useInputHelper = ({ // can't have more than one tree file if ( inputs.filter( - (input) => input.filetype === "nwk" || input.filetype === "nexus" + (input) => input.filetype === "nwk" || input.filetype === "nexus", ).length > 1 ) { return ["invalid", "You can only use a single tree file"]; @@ -142,7 +142,7 @@ export const useInputHelper = ({ if ( inputs.filter((input) => input.filetype === "jsonl").length === 0 && inputs.filter( - (input) => input.filetype === "nwk" || input.filetype === "nexus" + (input) => input.filetype === "nwk" || input.filetype === "nexus", ).length === 0 && inputs.filter((input) => input.filetype === "nextstrain").length === 0 ) { @@ -161,7 +161,7 @@ export const useInputHelper = ({ function addFromURL(url) { const file_obj = { name: url, supplyType: "url" }; window.alert( - "Please note: URL based loading will only work if the web server supports CORS. If the tree does not load please download the tree to your own computer and load the file into Taxonium from there." + "Please note: URL based loading will only work if the web server supports CORS. If the tree does not load please download the tree to your own computer and load the file into Taxonium from there.", ); addInput(file_obj); } @@ -174,13 +174,13 @@ export const useInputHelper = ({ updateQuery({ protoUrl: inputs[0].name }); } else { const meta_file = inputs.find((input) => - input.filetype.startsWith("meta_") + input.filetype.startsWith("meta_"), ); const tree_file = inputs.find( (input) => input.filetype === "nwk" || input.filetype === "nextstrain" || - input.filetype === "nexus" + input.filetype === "nexus", ); const newQuery = { treeUrl: tree_file.name, @@ -207,7 +207,7 @@ export const useInputHelper = ({ const upload_obj = {}; // if there is some metadata find it const meta_file = inputs.find((input) => - input.filetype.startsWith("meta_") + input.filetype.startsWith("meta_"), ); if (meta_file) { upload_obj.metadata = { @@ -223,7 +223,7 @@ export const useInputHelper = ({ (input) => input.filetype === "nwk" || input.filetype === "nextstrain" || - input.filetype === "nexus" + input.filetype === "nexus", ); upload_obj.filename = tree_file.name; diff --git a/taxonium_web_client/src/hooks/useLayers.js b/taxonium_web_client/src/hooks/useLayers.js index 71959326..f8651024 100644 --- a/taxonium_web_client/src/hooks/useLayers.js +++ b/taxonium_web_client/src/hooks/useLayers.js @@ -64,7 +64,7 @@ const useLayers = ({ treenomeReferenceInfo, setTreenomeReferenceInfo, selectedDetails, - isCurrentlyOutsideBounds + isCurrentlyOutsideBounds, ); layers.push(...treenomeLayers); @@ -90,11 +90,11 @@ const useLayers = ({ const clade_data = useMemo(() => { const initial_data = detailed_data.nodes.filter( - (n) => n.clades && n.clades[clade_accessor] + (n) => n.clades && n.clades[clade_accessor], ); const rev_sorted_by_num_tips = initial_data.sort( - (a, b) => b.num_tips - a.num_tips + (a, b) => b.num_tips - a.num_tips, ); // pick top settings.minTipsForCladeText @@ -122,7 +122,7 @@ const useLayers = ({ (node) => node.is_tip || (node.is_tip === undefined && node.num_tips === 1) || - settings.displayPointsForInternalNodes + settings.displayPointsForInternalNodes, ); }, [detailed_data, settings.displayPointsForInternalNodes]); @@ -132,7 +132,7 @@ const useLayers = ({ (node) => node.is_tip || (node.is_tip === undefined && node.num_tips === 1) || - settings.displayPointsForInternalNodes + settings.displayPointsForInternalNodes, ) : []; }, [base_data, settings.displayPointsForInternalNodes]); @@ -328,7 +328,7 @@ const useLayers = ({ fillin_scatter_layer, clade_label_layer, selectedLayer, - hoveredLayer + hoveredLayer, ); } @@ -347,7 +347,7 @@ const useLayers = ({ data: data.data.nodes.filter((node) => settings.displayTextForInternalNodes ? true - : node.is_tip || (node.is_tip === undefined && node.num_tips === 1) + : node.is_tip || (node.is_tip === undefined && node.num_tips === 1), ), getPosition: (d) => [getX(d), d.y], getText: (d) => d[config.name_accessor], @@ -519,7 +519,7 @@ const useLayers = ({ return first_bit; }, - [isCurrentlyOutsideBounds] + [isCurrentlyOutsideBounds], ); return { layers, layerFilter, keyStuff }; diff --git a/taxonium_web_client/src/hooks/useLocalBackend.js b/taxonium_web_client/src/hooks/useLocalBackend.js index 77eb23bc..34c8bc7f 100644 --- a/taxonium_web_client/src/hooks/useLocalBackend.js +++ b/taxonium_web_client/src/hooks/useLocalBackend.js @@ -3,7 +3,7 @@ import { useCallback, useMemo, useEffect, useState } from "react"; // test console.log("new worker"); const worker = new Worker( - new URL("../webworkers/localBackendWorker.js", import.meta.url) + new URL("../webworkers/localBackendWorker.js", import.meta.url), ); let onQueryReceipt = (receivedData) => {}; @@ -35,7 +35,7 @@ let searchSetters = {}; worker.onmessage = (event) => { console.log( - "got message from worker" //, event.data + "got message from worker", //, event.data ); if (event.data.type === "status") { onStatusReceipt(event.data); @@ -73,7 +73,7 @@ function useLocalBackend(uploaded_data, proto) { if (total_nodes && total_nodes > 6000000) { if (1) { window.alert( - "This is a large tree which may use too much memory to run in the web browser. If the page crashes you might want to try the Taxonium desktop app." + "This is a large tree which may use too much memory to run in the web browser. If the page crashes you might want to try the Taxonium desktop app.", ); } } @@ -98,23 +98,23 @@ function useLocalBackend(uploaded_data, proto) { onQueryReceipt = (receivedData) => { // console.log("CONFIG IS", config); console.log( - "got query result" //, receivedData + "got query result", //, receivedData ); receivedData.nodes.forEach((node) => { if (node.node_id === config.rootId) { node.mutations = config.rootMutations.map( - (x) => config.mutations[x] + (x) => config.mutations[x], ); } else { node.mutations = node.mutations.map( - (mutation) => config.mutations[mutation] + (mutation) => config.mutations[mutation], ); } }); setResult(receivedData); }; }, - [] + [], ); const singleSearch = useCallback( @@ -132,7 +132,7 @@ function useLocalBackend(uploaded_data, proto) { "got search result from ", key, // singleSearch, - "result" + "result", // receivedData ); setResult(receivedData); @@ -143,7 +143,7 @@ function useLocalBackend(uploaded_data, proto) { }, }; }, - [] + [], ); const getDetails = useCallback((node_id, setResult) => { diff --git a/taxonium_web_client/src/hooks/useNodeDetails.js b/taxonium_web_client/src/hooks/useNodeDetails.js index 9f0d3a23..6202efa6 100644 --- a/taxonium_web_client/src/hooks/useNodeDetails.js +++ b/taxonium_web_client/src/hooks/useNodeDetails.js @@ -13,7 +13,7 @@ function useNodeDetails(nickname, backend) { backend.getDetails(node_id, setNodeDetails); }, 50); }, - [backend] + [backend], ); const clearNodeDetails = useCallback(() => { setNodeDetails(null); diff --git a/taxonium_web_client/src/hooks/usePerNodeFunctions.js b/taxonium_web_client/src/hooks/usePerNodeFunctions.js index 224370c6..e9cb5e5f 100644 --- a/taxonium_web_client/src/hooks/usePerNodeFunctions.js +++ b/taxonium_web_client/src/hooks/usePerNodeFunctions.js @@ -14,7 +14,7 @@ function usePerNodeFunctions(data, config) { "UNEXPECTED ERROR: node not found", node_id, data.data, - data.base_data + data.base_data, ); return null; } @@ -24,13 +24,13 @@ function usePerNodeFunctions(data, config) { while (cur_node.parent_id !== cur_node.node_id) { const nt_mutations = cur_node.mutations.filter( - (mutation) => mutation.type === "nt" + (mutation) => mutation.type === "nt", ); const filtered_nt_mutations = nt_mutations.filter( (mutation) => !assembled_mutations.some( - (m) => m.residue_pos === mutation.residue_pos - ) + (m) => m.residue_pos === mutation.residue_pos, + ), ); assembled_mutations.push(...filtered_nt_mutations); cur_node = data_to_use.nodeLookup[cur_node.parent_id]; diff --git a/taxonium_web_client/src/hooks/useQueryAsState.js b/taxonium_web_client/src/hooks/useQueryAsState.js index 159dac29..4088c876 100644 --- a/taxonium_web_client/src/hooks/useQueryAsState.js +++ b/taxonium_web_client/src/hooks/useQueryAsState.js @@ -62,12 +62,12 @@ const useQueryAsState = (defaultValues) => { }); history[method](pathname + objectToQueryParams(encodeValues(new_vals))); }, - [history] + [history], ); const queryWithDefault = useMemo( () => Object.assign({}, defaultValues, removeUndefined(decodedSearch)), - [decodedSearch, defaultValues] + [decodedSearch, defaultValues], ); return [queryWithDefault, updateQuery]; diff --git a/taxonium_web_client/src/hooks/useSearch.js b/taxonium_web_client/src/hooks/useSearch.js index 84de8803..407ade0e 100644 --- a/taxonium_web_client/src/hooks/useSearch.js +++ b/taxonium_web_client/src/hooks/useSearch.js @@ -25,7 +25,7 @@ const useSearch = ({ }, [query.srch]); const [zoomToSearch, setZoomToSearch] = useState( - query.zoomToSearch ? { index: query.zoomToSearch } : null + query.zoomToSearch ? { index: query.zoomToSearch } : null, ); const searchesEnabled = query.enabled ? JSON.parse(query.enabled) : {}; @@ -75,10 +75,10 @@ const useSearch = ({ boundsForQueries, (x) => { setInflightSearches((prev) => - prev.filter((s) => s !== everything_string) + prev.filter((s) => s !== everything_string), ); setter(x); - } + }, ); searchControllers[key] = [ ...searchControllers[key], @@ -86,7 +86,7 @@ const useSearch = ({ ]; setSearchControllers({ ...searchControllers }); }, - [searchControllers, singleSearch, inflightSearches] + [searchControllers, singleSearch, inflightSearches], ); useEffect(() => { @@ -94,7 +94,7 @@ const useSearch = ({ const spec_keys = searchSpec.map((spec) => spec.key); const result_keys = Object.keys(searchResults); const keys_to_remove = result_keys.filter( - (key) => !spec_keys.includes(key) + (key) => !spec_keys.includes(key), ); keys_to_remove.forEach((key) => { delete searchResults[key]; @@ -108,7 +108,7 @@ const useSearch = ({ // check which json strings have changed const json_changed = Object.keys(spec_json).filter( - (key) => spec_json[key] !== jsonSearch[key] + (key) => spec_json[key] !== jsonSearch[key], ); // also add any result where the result type is not complete, and the bounding box has changed @@ -121,7 +121,7 @@ const useSearch = ({ "result_changed", key, searchResults[key].boundingBox, - boundsForQueries + boundsForQueries, ); return true; @@ -266,7 +266,7 @@ const useSearch = ({ const newZoom = 9 - Math.log2( - max_y - min_y + 50000 / (config.num_nodes ? config.num_nodes : 10000) + max_y - min_y + 50000 / (config.num_nodes ? config.num_nodes : 10000), ); const new_target = settings.treenomeEnabled ? [oldViewState.target[0], (min_y + max_y) / 2] @@ -281,7 +281,7 @@ const useSearch = ({ console.log( "zoom to search new VS", viewState.target[0], - viewState.target[1] + viewState.target[1], ); view.onViewStateChange({ diff --git a/taxonium_web_client/src/hooks/useServerBackend.js b/taxonium_web_client/src/hooks/useServerBackend.js index dcd6f8b1..1024d36a 100644 --- a/taxonium_web_client/src/hooks/useServerBackend.js +++ b/taxonium_web_client/src/hooks/useServerBackend.js @@ -36,11 +36,11 @@ function useServerBackend(backend_url, sid, url_on_fail) { response.data.nodes.forEach((node) => { if (node.node_id === config.rootId) { node.mutations = config.rootMutations.map( - (x) => config.mutations[x] + (x) => config.mutations[x], ); } else { node.mutations = node.mutations.map( - (mutation) => config.mutations[mutation] + (mutation) => config.mutations[mutation], ); } }); @@ -53,7 +53,7 @@ function useServerBackend(backend_url, sid, url_on_fail) { setTriggerRefresh({}); }); }, - [backend_url, sid] + [backend_url, sid], ); const singleSearch = useCallback( @@ -109,7 +109,7 @@ function useServerBackend(backend_url, sid, url_on_fail) { }); return { abortController }; }, - [backend_url, sid] + [backend_url, sid], ); const getDetails = useCallback( @@ -119,7 +119,7 @@ function useServerBackend(backend_url, sid, url_on_fail) { setResult(response.data); }); }, - [backend_url, sid] + [backend_url, sid], ); const getConfig = useCallback( @@ -129,14 +129,14 @@ function useServerBackend(backend_url, sid, url_on_fail) { console.log("got config", response.data); if (response.data.error) { window.alert( - response.data.error + (url_on_fail ? "\nRedirecting you." : "") + response.data.error + (url_on_fail ? "\nRedirecting you." : ""), ); window.location.href = url_on_fail; } setResult(response.data); }); }, - [backend_url, sid, url_on_fail] + [backend_url, sid, url_on_fail], ); const getTipAtts = useCallback( @@ -153,14 +153,14 @@ function useServerBackend(backend_url, sid, url_on_fail) { callback(response.err, response.data); }); }, - [backend_url, sid] + [backend_url, sid], ); const getNextstrainJsonUrl = useCallback( (nodeId, config) => { return backend_url + "/nextstrain_json/" + nodeId; }, - [backend_url] + [backend_url], ); const getNextstrainJson = useCallback( @@ -169,7 +169,7 @@ function useServerBackend(backend_url, sid, url_on_fail) { // load this window.location.href = url; }, - [getNextstrainJsonUrl] + [getNextstrainJsonUrl], ); return useMemo(() => { diff --git a/taxonium_web_client/src/hooks/useSettings.js b/taxonium_web_client/src/hooks/useSettings.js index b55975ac..73c2b9be 100644 --- a/taxonium_web_client/src/hooks/useSettings.js +++ b/taxonium_web_client/src/hooks/useSettings.js @@ -29,16 +29,16 @@ export const useSettings = ({ query, updateQuery }) => { position: "bottom-center", }); }, - [updateQuery] + [updateQuery], ); const filterMutations = useCallback( (mutations) => { return mutations.filter( - (mutation) => mutationTypesEnabled[mutation.type] + (mutation) => mutationTypesEnabled[mutation.type], ); }, - [mutationTypesEnabled] + [mutationTypesEnabled], ); const setMutationTypeEnabled = (key, enabled) => { @@ -71,7 +71,7 @@ export const useSettings = ({ query, updateQuery }) => { } for hovered and selected nodes`, { position: "bottom-center", - } + }, ); }} />{" "} diff --git a/taxonium_web_client/src/hooks/useTreenomeAnnotations.js b/taxonium_web_client/src/hooks/useTreenomeAnnotations.js index 0c3857ff..b1f518a8 100644 --- a/taxonium_web_client/src/hooks/useTreenomeAnnotations.js +++ b/taxonium_web_client/src/hooks/useTreenomeAnnotations.js @@ -56,7 +56,7 @@ const useTreenomeAnnotations = (settings) => { } return output; }, - [settings.chromosomeName] + [settings.chromosomeName], ); const json = useMemo(() => { diff --git a/taxonium_web_client/src/hooks/useTreenomeLayerData.js b/taxonium_web_client/src/hooks/useTreenomeLayerData.js index 6087509f..8f8d76da 100644 --- a/taxonium_web_client/src/hooks/useTreenomeLayerData.js +++ b/taxonium_web_client/src/hooks/useTreenomeLayerData.js @@ -4,7 +4,7 @@ const useTreenomeLayerData = ( data, treenomeState, settings, - selectedDetails + selectedDetails, ) => { const [varDataAa, setVarDataAa] = useState([]); const [varDataNt, setVarDataNt] = useState([]); @@ -19,7 +19,7 @@ const useTreenomeLayerData = ( const worker = useMemo( () => new Worker(new URL("../webworkers/treenomeWorker.js", import.meta.url)), - [] + [], ); worker.onmessage = useCallback( @@ -47,7 +47,7 @@ const useTreenomeLayerData = ( setVarDataNt, setCachedVarDataAa, setCachedVarDataNt, - ] + ], ); useEffect(() => { diff --git a/taxonium_web_client/src/hooks/useTreenomeLayers.js b/taxonium_web_client/src/hooks/useTreenomeLayers.js index 2bf3ecfb..364519d2 100644 --- a/taxonium_web_client/src/hooks/useTreenomeLayers.js +++ b/taxonium_web_client/src/hooks/useTreenomeLayers.js @@ -11,7 +11,7 @@ const useTreenomeLayers = ( settings, treenomeReferenceInfo, setTreenomeReferenceInfo, - selectedDetails + selectedDetails, ) => { const myGetPolygonOffset = ({ layerIndex }) => [0, -(layerIndex + 999) * 100]; const modelMatrixFixedX = useMemo(() => { @@ -88,7 +88,7 @@ const useTreenomeLayers = ( } return null; }, - [cov2Genes] + [cov2Genes], ); let layers = []; @@ -115,7 +115,7 @@ const useTreenomeLayers = ( 3 ); }, - [treenomeState.xBounds, treenomeState.ntBounds] + [treenomeState.xBounds, treenomeState.ntBounds], ); const getNtPos = useCallback( @@ -130,7 +130,7 @@ const useTreenomeLayers = ( return cov2Genes[mut.gene][0] + (mut.residue_pos - 1) * 3 - 1; } }, - [cov2Genes] + [cov2Genes], ); const main_variation_aa_common_props = { diff --git a/taxonium_web_client/src/hooks/useTreenomeState.js b/taxonium_web_client/src/hooks/useTreenomeState.js index 48d81a7a..325dbfc8 100644 --- a/taxonium_web_client/src/hooks/useTreenomeState.js +++ b/taxonium_web_client/src/hooks/useTreenomeState.js @@ -112,7 +112,7 @@ const useTreenomeState = (data, deckRef, view, settings) => { useEffect(() => { const observer = new MutationObserver(function ( mutations, - mutationInstance + mutationInstance, ) { const jbrowse = document.getElementById("view-browser-axis"); if (jbrowse) { diff --git a/taxonium_web_client/src/hooks/useView.js b/taxonium_web_client/src/hooks/useView.js index e864543f..3e43644b 100644 --- a/taxonium_web_client/src/hooks/useView.js +++ b/taxonium_web_client/src/hooks/useView.js @@ -64,7 +64,7 @@ class MyOrthographicController extends OrthographicController { { isZooming: zoomAxis === "Y", isPanning: true, - } + }, ); if (controlKey) { @@ -123,7 +123,7 @@ const useView = ({ settings, deckSize, deckRef, jbrowseRef }) => { // }; // }); setXzoom( - window.screen.width < 600 ? -1 : settings.treenomeEnabled ? -1 : 0 + window.screen.width < 600 ? -1 : settings.treenomeEnabled ? -1 : 0, ); }, [settings.treenomeEnabled]); @@ -324,7 +324,7 @@ const useView = ({ settings, deckSize, deckRef, jbrowseRef }) => { setViewState(newViewState); return newViewState; }, - [zoomAxis, xzoom, deckSize, viewState, jbrowseRef, mouseXY] + [zoomAxis, xzoom, deckSize, viewState, jbrowseRef, mouseXY], ); const zoomIncrement = useCallback( @@ -339,7 +339,7 @@ const useView = ({ settings, deckSize, deckRef, jbrowseRef }) => { overrideZoomAxis, }); }, - [viewState, onViewStateChange] + [viewState, onViewStateChange], ); const zoomReset = useCallback(() => { diff --git a/taxonium_web_client/src/index.js b/taxonium_web_client/src/index.js index 17f5add1..f5cafb27 100644 --- a/taxonium_web_client/src/index.js +++ b/taxonium_web_client/src/index.js @@ -8,7 +8,7 @@ ReactDOM.render( , - document.getElementById("root") + document.getElementById("root"), ); // If you want to start measuring performance in your app, pass a function diff --git a/taxonium_web_client/src/utils/jstree.js b/taxonium_web_client/src/utils/jstree.js index db0350eb..7c661c68 100644 --- a/taxonium_web_client/src/utils/jstree.js +++ b/taxonium_web_client/src/utils/jstree.js @@ -214,7 +214,7 @@ function kn_check_tree(tree) { p.x + "" + p.y + - "" + "", ); } document.write(""); @@ -557,12 +557,12 @@ function kn_get_node(tree, conf, x, y) { var tmp_x = Math.floor( conf.width / 2 + p.x * conf.real_r * Math.cos(p.y * conf.full_arc) + - 0.999 + 0.999, ); var tmp_y = Math.floor( conf.height / 2 + p.x * conf.real_r * Math.sin(p.y * conf.full_arc) + - 0.999 + 0.999, ); var tmp_l = 2; if ( diff --git a/taxonium_web_client/src/utils/nexusToNewick.js b/taxonium_web_client/src/utils/nexusToNewick.js index 74219861..313a95fd 100644 --- a/taxonium_web_client/src/utils/nexusToNewick.js +++ b/taxonium_web_client/src/utils/nexusToNewick.js @@ -37,7 +37,7 @@ function nexusToNewick(nexusString) { (match) => { //console.log(translations[match]) return translations[match] || match; - } + }, ); return translatedNewickString; diff --git a/taxonium_web_client/src/utils/processNewick.js b/taxonium_web_client/src/utils/processNewick.js index 0537d9d5..d2ba15cc 100644 --- a/taxonium_web_client/src/utils/processNewick.js +++ b/taxonium_web_client/src/utils/processNewick.js @@ -57,7 +57,7 @@ function fetch_or_extract(file_obj, sendStatusMessage, whatIsBeingDownloaded) { return do_fetch( file_obj.filename, sendStatusMessage, - whatIsBeingDownloaded + whatIsBeingDownloaded, ); } else if (file_obj.status === "loaded") { if (file_obj.filename.includes(".gz")) { @@ -226,7 +226,7 @@ export async function processMetadataFile(data, sendStatusMessage) { error: "Filetype was not set, please raise an issue on our GitHub page", }); throw new Error( - "Filetype was not set, please raise an issue on our GitHub page" + "Filetype was not set, please raise an issue on our GitHub page", ); } @@ -282,7 +282,7 @@ export async function processNewickAndMetadata(data, sendStatusMessage) { ]); const [metadata, headers] = metadata_double; const blanks = Object.fromEntries( - headers.slice(1).map((x) => ["meta_" + x, ""]) + headers.slice(1).map((x) => ["meta_" + x, ""]), ); sendStatusMessage({ message: "Assigning metadata to nodes", diff --git a/taxonium_web_client/src/utils/processNextstrain.js b/taxonium_web_client/src/utils/processNextstrain.js index 3463f307..f080c81d 100644 --- a/taxonium_web_client/src/utils/processNextstrain.js +++ b/taxonium_web_client/src/utils/processNextstrain.js @@ -8,7 +8,7 @@ const emptyList = []; const nodeMutationsFromNextStrainToTaxonium = ( mutations, unique_mutations, - mutation_lookup + mutation_lookup, ) => { //console.log("mutations", mutations); const keys = Object.keys(mutations); @@ -23,7 +23,7 @@ const nodeMutationsFromNextStrainToTaxonium = ( const index_of_position = nuc_mut.indexOf(position[0]); const previous_residue = nuc_mut.substring(0, index_of_position); const new_residue = nuc_mut.substring( - index_of_position + position[0].length + index_of_position + position[0].length, ); const tax_format = { type: "nt", @@ -56,7 +56,7 @@ const nodeMutationsFromNextStrainToTaxonium = ( const index_of_position = gene_mut.indexOf(position[0]); const previous_residue = gene_mut.substring(0, index_of_position); const new_residue = gene_mut.substring( - index_of_position + position[0].length + index_of_position + position[0].length, ); const tax_format = { type: "aa", @@ -131,7 +131,7 @@ function fetch_or_extract(file_obj, sendStatusMessage, whatIsBeingDownloaded) { return do_fetch( file_obj.filename, sendStatusMessage, - whatIsBeingDownloaded + whatIsBeingDownloaded, ); } else if (file_obj.status === "loaded") { if (file_obj.filename.includes(".gz")) { @@ -337,7 +337,7 @@ function json_preorder(root) { ? nodeMutationsFromNextStrainToTaxonium( nodeJson.branch_attrs.mutations, unique_mutations, - mutation_lookup + mutation_lookup, ) : [], }; @@ -442,7 +442,7 @@ export async function processNextstrain(data, sendStatusMessage) { }); const { jsTree, config, unique_mutations } = await json_to_tree( - JSON.parse(the_data) + JSON.parse(the_data), ); const output = await processJsTree(jsTree, data, config, sendStatusMessage); diff --git a/taxonium_web_client/src/utils/reduceMaxOrMin.js b/taxonium_web_client/src/utils/reduceMaxOrMin.js index 9747a215..ad8b8700 100644 --- a/taxonium_web_client/src/utils/reduceMaxOrMin.js +++ b/taxonium_web_client/src/utils/reduceMaxOrMin.js @@ -3,13 +3,13 @@ function reduceMaxOrMin(array, accessFunction, maxOrMin) { return accessFunction( array.reduce(function (max, item) { return accessFunction(item) > accessFunction(max) ? item : max; - }) + }), ); } else if (maxOrMin === "min") { return accessFunction( array.reduce(function (min, item) { return accessFunction(item) < accessFunction(min) ? item : min; - }) + }), ); } } diff --git a/taxonium_web_client/src/webworkers/localBackendWorker.js b/taxonium_web_client/src/webworkers/localBackendWorker.js index 14f9f89f..4d91120b 100644 --- a/taxonium_web_client/src/webworkers/localBackendWorker.js +++ b/taxonium_web_client/src/webworkers/localBackendWorker.js @@ -100,7 +100,7 @@ export const queryNodes = async (boundsForQueries) => { max_y, min_x, max_x, - boundsForQueries.xType + boundsForQueries.xType, ), }; @@ -182,7 +182,7 @@ const getDetails = async (node_id) => { const details = { ...node }; details.mutations = processedUploadedData.node_to_mut[node_id] ? processedUploadedData.node_to_mut[node_id].map( - (x) => processedUploadedData.mutations[x] + (x) => processedUploadedData.mutations[x], ) : []; console.log("details is ", details); @@ -219,7 +219,7 @@ onmessage = async (event) => { data.data.useDistances = true; processedUploadedData = await processNewickAndMetadata( data.data, - sendStatusMessage + sendStatusMessage, ); } else if ( data.type === "upload" && @@ -229,7 +229,7 @@ onmessage = async (event) => { ) { processedUploadedData = await processNextstrain( data.data, - sendStatusMessage + sendStatusMessage, ); } else if (data.type === "upload" && data.data && data.data.filename) { sendStatusMessage({ @@ -266,7 +266,7 @@ onmessage = async (event) => { data.node_id, processedUploadedData.nodes, data.config, - processedUploadedData.mutations + processedUploadedData.mutations, ); postMessage({ type: "nextstrain", data: result }); } diff --git a/taxonium_web_client/src/webworkers/treenomeWorker.js b/taxonium_web_client/src/webworkers/treenomeWorker.js index 5d129134..5f3dfde2 100644 --- a/taxonium_web_client/src/webworkers/treenomeWorker.js +++ b/taxonium_web_client/src/webworkers/treenomeWorker.js @@ -141,7 +141,7 @@ const computeVariationData = async (data, type, ntBounds, jobId) => { let filteredVarData = computeFilteredVariationData( var_data, ntBounds, - data + data, ); if (i === preorder_nodes.length && shouldCache) { postMessage({