From f7cbfbf02c0ec8451b6432d50aeae548e2469a75 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 18 Dec 2023 19:02:25 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .all-contributorsrc | 36 ++++------------ docs/component.md | 2 +- taxonium_backend/server.js | 26 ++++++------ taxonium_component/README.md | 2 +- taxonium_component/src/Deck.jsx | 8 ++-- taxonium_component/src/Taxonium.jsx | 6 +-- taxonium_component/src/components/Basic.jsx | 6 +-- .../src/components/DeckSettingsModal.jsx | 10 ++--- .../src/components/JBrowseErrorBoundary.jsx | 2 +- .../src/components/JBrowsePanel.jsx | 6 +-- taxonium_component/src/components/Key.jsx | 6 +-- .../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_component/src/hooks/useBackend.jsx | 2 +- taxonium_component/src/hooks/useColor.jsx | 6 +-- taxonium_component/src/hooks/useColorBy.jsx | 20 ++++----- taxonium_component/src/hooks/useConfig.jsx | 2 +- .../src/hooks/useGetDynamicData.jsx | 12 +++--- taxonium_component/src/hooks/useLayers.jsx | 30 ++++++------- .../src/hooks/useLocalBackend.jsx | 16 +++---- .../src/hooks/useNodeDetails.jsx | 2 +- .../src/hooks/usePerNodeFunctions.jsx | 8 ++-- taxonium_component/src/hooks/useSearch.jsx | 18 ++++---- .../src/hooks/useServerBackend.jsx | 20 ++++----- taxonium_component/src/hooks/useSettings.jsx | 8 ++-- .../src/hooks/useTreenomeAnnotations.jsx | 2 +- .../src/hooks/useTreenomeLayerData.jsx | 4 +- .../src/hooks/useTreenomeLayers.jsx | 8 ++-- .../src/hooks/useTreenomeState.jsx | 2 +- taxonium_component/src/hooks/useView.jsx | 8 ++-- taxonium_component/src/utils/deckglToSvg.js | 4 +- taxonium_component/src/utils/jstree.js | 10 ++--- taxonium_component/src/utils/nexusToNewick.js | 2 +- taxonium_component/src/utils/processNewick.js | 6 +-- .../src/utils/processNextstrain.js | 18 ++++---- .../src/utils/reduceMaxOrMin.js | 4 +- .../src/webworkers/localBackendWorker.js | 12 +++--- .../src/webworkers/treenomeWorker.js | 2 +- taxonium_data_handling/exporting.js | 8 ++-- taxonium_data_handling/filtering.js | 42 +++++++++---------- taxonium_data_handling/importing.js | 18 ++++---- taxonium_electron/index.html | 2 +- taxonium_electron/src/main.js | 2 +- taxonium_website/index.html | 2 +- taxonium_website/src/App.jsx | 6 +-- taxonium_website/src/components/Basic.jsx | 6 +-- .../src/components/InputSupplier.jsx | 6 +-- taxonium_website/src/hooks/useInputHelper.jsx | 18 ++++---- .../src/hooks/useQueryAsState.jsx | 4 +- taxonium_website/src/main.jsx | 2 +- 53 files changed, 230 insertions(+), 250 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 66466a8f..5b338dd1 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1,7 +1,5 @@ { - "files": [ - "README.md" - ], + "files": ["README.md"], "imageSize": 100, "commit": false, "contributors": [ @@ -10,67 +8,49 @@ "name": "Alex Kramer", "avatar_url": "https://avatars.githubusercontent.com/u/6502785?v=4", "profile": "https://github.com/amkram", - "contributions": [ - "code", - "design", - "ideas" - ] + "contributions": ["code", "design", "ideas"] }, { "login": "AngieHinrichs", "name": "Angie Hinrichs", "avatar_url": "https://avatars.githubusercontent.com/u/186983?v=4", "profile": "http://genome.ucsc.edu/", - "contributions": [ - "ideas", - "data" - ] + "contributions": ["ideas", "data"] }, { "login": "richardgoater", "name": "Richard Goater", "avatar_url": "https://avatars.githubusercontent.com/u/1429721?v=4", "profile": "https://github.com/richardgoater", - "contributions": [ - "design", - "code" - ] + "contributions": ["design", "code"] }, { "login": "chaoran-chen", "name": "Chaoran Chen", "avatar_url": "https://avatars.githubusercontent.com/u/18666552?v=4", "profile": "https://github.com/chaoran-chen", - "contributions": [ - "ideas" - ] + "contributions": ["ideas"] }, { "login": "corneliusroemer", "name": "Cornelius Roemer", "avatar_url": "https://avatars.githubusercontent.com/u/25161793?v=4", "profile": "https://github.com/corneliusroemer", - "contributions": [ - "ideas" - ] + "contributions": ["ideas"] }, { "login": "sungyeonkwon", "name": "Sung Kwon", "avatar_url": "https://avatars.githubusercontent.com/u/25865179?v=4", "profile": "https://github.com/sungyeonkwon", - "contributions": [ - "infra" - ] + "contributions": ["infra"] }, { "login": "kvargha", "name": "Koorous Vargha", "avatar_url": "https://avatars.githubusercontent.com/u/35252220?v=4", "profile": "https://kvargha.com/", - "contributions": [ - "code" - ] + "contributions": ["code"] } ], "contributorsPerLine": 7, diff --git a/docs/component.md b/docs/component.md index 9447a4bf..44774896 100644 --- a/docs/component.md +++ b/docs/component.md @@ -49,7 +49,7 @@ D,John,Fish`; diff --git a/taxonium_backend/server.js b/taxonium_backend/server.js index 446a8edb..1da2cb44 100644 --- a/taxonium_backend/server.js +++ b/taxonium_backend/server.js @@ -26,7 +26,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(); @@ -154,7 +154,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); }); @@ -256,7 +256,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."); @@ -268,7 +268,7 @@ app.get("/nodes/", function (req, res) { (Date.now() - start_time) + "ms, and output " + result.length + - " nodes." + " nodes.", ); }); @@ -276,11 +276,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"); @@ -452,7 +452,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, ); }); @@ -463,7 +463,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, ); }); @@ -474,11 +474,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); }); @@ -505,7 +505,7 @@ const loadData = async () => { processedData = await importing.processJsonl( supplied_object, logStatusMessage, - ReadableWebToNodeStream.ReadableWebToNodeStream + ReadableWebToNodeStream.ReadableWebToNodeStream, ); logStatusMessage({ @@ -517,7 +517,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); @@ -530,7 +530,7 @@ const loadData = async () => { processedData.overallMaxY, processedData.overallMinX, processedData.overallMaxX, - "x_dist" + "x_dist", ); cached_starting_values = result; diff --git a/taxonium_component/README.md b/taxonium_component/README.md index def706dc..b91e2306 100644 --- a/taxonium_component/README.md +++ b/taxonium_component/README.md @@ -73,7 +73,7 @@ If you're working with basic HTML, you can include the Taxonium component using diff --git a/taxonium_component/src/Deck.jsx b/taxonium_component/src/Deck.jsx index d77b2947..142ec0df 100644 --- a/taxonium_component/src/Deck.jsx +++ b/taxonium_component/src/Deck.jsx @@ -73,7 +73,7 @@ function Deck({ // Treenome state const setMouseXY = useCallback( (info) => view.setMouseXY([info.x, info.y]), - [view] + [view], ); const [treenomeReferenceInfo, setTreenomeReferenceInfo] = useState(null); @@ -99,7 +99,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; @@ -157,7 +157,7 @@ function Deck({ onViewStateChange, xzoom, deckRef, - ] + ], ); const [hoverInfo, setHoverInfoRaw] = useState(null); @@ -175,7 +175,7 @@ function Deck({ hoverDetails.clearNodeDetails(); } }, - [hoverDetails] + [hoverDetails], ); const { layers, layerFilter, keyStuff, triggerSVGdownload } = useLayers({ diff --git a/taxonium_component/src/Taxonium.jsx b/taxonium_component/src/Taxonium.jsx index fe04ff49..306df35f 100644 --- a/taxonium_component/src/Taxonium.jsx +++ b/taxonium_component/src/Taxonium.jsx @@ -84,7 +84,7 @@ function Taxonium({ backendUrl ? backendUrl : query.backend, query.sid, url_on_fail, - sourceData + sourceData, ); let hoverDetails = useHoverDetails(); const gisaidHoverDetails = useNodeDetails("gisaid-hovered", backend); @@ -100,7 +100,7 @@ function Taxonium({ setTitle, query, configDict, - configUrl + configUrl, ); const colorBy = useColorBy(config, query, updateQuery); const [additionalColorMapping, setAdditionalColorMapping] = useState({}); @@ -119,7 +119,7 @@ function Taxonium({ (xType) => { updateQuery({ xType }); }, - [updateQuery] + [updateQuery], ); const { data, boundsForQueries, isCurrentlyOutsideBounds } = diff --git a/taxonium_component/src/components/Basic.jsx b/taxonium_component/src/components/Basic.jsx index b678a55c..6be40401 100644 --- a/taxonium_component/src/components/Basic.jsx +++ b/taxonium_component/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_component/src/components/DeckSettingsModal.jsx b/taxonium_component/src/components/DeckSettingsModal.jsx index f2c9e5c6..67b67f51 100644 --- a/taxonium_component/src/components/DeckSettingsModal.jsx +++ b/taxonium_component/src/components/DeckSettingsModal.jsx @@ -75,7 +75,7 @@ const DeckSettingsModal = ({ checked={settings.displayTextForInternalNodes} onChange={() => settings.setDisplayTextForInternalNodes( - !settings.displayTextForInternalNodes + !settings.displayTextForInternalNodes, ) } />{" "} @@ -90,7 +90,7 @@ const DeckSettingsModal = ({ checked={settings.displayPointsForInternalNodes} onChange={() => settings.setDisplayPointsForInternalNodes( - !settings.displayPointsForInternalNodes + !settings.displayPointsForInternalNodes, ) } />{" "} @@ -110,7 +110,7 @@ const DeckSettingsModal = ({ onChange={() => settings.setMutationTypeEnabled( key, - !settings.mutationTypesEnabled[key] + !settings.mutationTypesEnabled[key], ) } />{" "} @@ -133,7 +133,7 @@ const DeckSettingsModal = ({ value={settings.thresholdForDisplayingText} onChange={(e) => settings.setThresholdForDisplayingText( - parseFloat(e.target.value) + parseFloat(e.target.value), ) } step="0.1" @@ -263,7 +263,7 @@ const DeckSettingsModal = ({ checked={settings.displaySearchesAsPoints} onChange={() => settings.setDisplaySearchesAsPoints( - !settings.displaySearchesAsPoints + !settings.displaySearchesAsPoints, ) } />{" "} diff --git a/taxonium_component/src/components/JBrowseErrorBoundary.jsx b/taxonium_component/src/components/JBrowseErrorBoundary.jsx index a7f77cb5..2723ad37 100644 --- a/taxonium_component/src/components/JBrowseErrorBoundary.jsx +++ b/taxonium_component/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_component/src/components/JBrowsePanel.jsx b/taxonium_component/src/components/JBrowsePanel.jsx index 316b51f1..8a0a96d7 100644 --- a/taxonium_component/src/components/JBrowsePanel.jsx +++ b/taxonium_component/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_component/src/components/Key.jsx b/taxonium_component/src/components/Key.jsx index 26f1f448..071f4df5 100644 --- a/taxonium_component/src/components/Key.jsx +++ b/taxonium_component/src/components/Key.jsx @@ -31,7 +31,7 @@ const Key = ({
{collapsed ? "▲" : "▼"} diff --git a/taxonium_component/src/components/NodeHoverTip.jsx b/taxonium_component/src/components/NodeHoverTip.jsx index ee6d7f60..3c6f36de 100644 --- a/taxonium_component/src/components/NodeHoverTip.jsx +++ b/taxonium_component/src/components/NodeHoverTip.jsx @@ -119,7 +119,7 @@ const NodeHoverTip = ({ hoveredNode[key] )}
- ) + ), )} {config.mutations.length > 0 && ( @@ -164,7 +164,7 @@ const NodeHoverTip = ({
Authors:{" "} {fixAuthors( - hoverDetails.nodeDetails.acknowledgements.covv_authors + hoverDetails.nodeDetails.acknowledgements.covv_authors, )}
diff --git a/taxonium_component/src/components/SearchItem.jsx b/taxonium_component/src/components/SearchItem.jsx index 7f020c4d..458e6c67 100644 --- a/taxonium_component/src/components/SearchItem.jsx +++ b/taxonium_component/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_component/src/components/SearchPanel.jsx b/taxonium_component/src/components/SearchPanel.jsx index 8f263dad..6b0766d9 100644 --- a/taxonium_component/src/components/SearchPanel.jsx +++ b/taxonium_component/src/components/SearchPanel.jsx @@ -64,7 +64,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; @@ -156,7 +156,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; @@ -190,7 +190,7 @@ function SearchPanel({ backend .getNextstrainJsonUrl( selectedDetails.nodeDetails.node_id, - config + config, ) .replace("https://", "") .replace("http://", "") @@ -362,7 +362,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" @@ -427,7 +427,7 @@ function SearchPanel({ title="Select parent" onClick={() => { selectedDetails.getNodeDetails( - selectedDetails.nodeDetails.parent_id + selectedDetails.nodeDetails.parent_id, ); }} > @@ -454,7 +454,7 @@ function SearchPanel({ @@ -465,7 +465,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_component/src/components/SearchTopLayerItem.jsx b/taxonium_component/src/components/SearchTopLayerItem.jsx index a00c518d..db753e8d 100644 --- a/taxonium_component/src/components/SearchTopLayerItem.jsx +++ b/taxonium_component/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_component/src/components/TreenomeModal.jsx b/taxonium_component/src/components/TreenomeModal.jsx index 1f43f47e..ce688759 100644 --- a/taxonium_component/src/components/TreenomeModal.jsx +++ b/taxonium_component/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( @@ -152,7 +152,7 @@ const useColor = (colorMapping) => { return result; } }, - [toRGB_uncached] + [toRGB_uncached], ); const toRGBCSS = useCallback( @@ -160,7 +160,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_component/src/hooks/useColorBy.jsx b/taxonium_component/src/hooks/useColorBy.jsx index 7bfbd276..b8242500 100644 --- a/taxonium_component/src/hooks/useColorBy.jsx +++ b/taxonium_component/src/hooks/useColorBy.jsx @@ -12,13 +12,13 @@ function useColorBy(config, query, updateQuery) { const colorByField = colorByConfig.field ? colorByConfig.field : config.defaultColorByField - ? config.defaultColorByField - : "meta_pangolin_lineage"; + ? config.defaultColorByField + : "meta_pangolin_lineage"; const colorByGene = colorByConfig.gene ? colorByConfig.gene : config.genes && config.genes.includes("S") - ? "S" - : "nt"; + ? "S" + : "nt"; const colorByPosition = colorByConfig.pos !== undefined ? colorByConfig.pos : 484; @@ -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_component/src/hooks/useConfig.jsx b/taxonium_component/src/hooks/useConfig.jsx index 60258d54..841422ae 100644 --- a/taxonium_component/src/hooks/useConfig.jsx +++ b/taxonium_component/src/hooks/useConfig.jsx @@ -7,7 +7,7 @@ const useConfig = ( setTitle, query, configDict, - configUrl + configUrl, ) => { const [config, setConfig] = useState({ title: "loading", diff --git a/taxonium_component/src/hooks/useGetDynamicData.jsx b/taxonium_component/src/hooks/useGetDynamicData.jsx index a0172a83..ca49fa11 100644 --- a/taxonium_component/src/hooks/useGetDynamicData.jsx +++ b/taxonium_component/src/hooks/useGetDynamicData.jsx @@ -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_component/src/hooks/useLayers.jsx b/taxonium_component/src/hooks/useLayers.jsx index a4746237..c464b4da 100644 --- a/taxonium_component/src/hooks/useLayers.jsx +++ b/taxonium_component/src/hooks/useLayers.jsx @@ -67,7 +67,7 @@ const useLayers = ({ treenomeReferenceInfo, setTreenomeReferenceInfo, selectedDetails, - isCurrentlyOutsideBounds + isCurrentlyOutsideBounds, ); layers.push(...treenomeLayers); @@ -93,11 +93,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 @@ -125,7 +125,7 @@ const useLayers = ({ (node) => node.is_tip || (node.is_tip === undefined && node.num_tips === 1) || - settings.displayPointsForInternalNodes + settings.displayPointsForInternalNodes, ); }, [detailed_data, settings.displayPointsForInternalNodes]); @@ -135,7 +135,7 @@ const useLayers = ({ (node) => node.is_tip || (node.is_tip === undefined && node.num_tips === 1) || - settings.displayPointsForInternalNodes + settings.displayPointsForInternalNodes, ) : []; }, [base_data, settings.displayPointsForInternalNodes]); @@ -190,9 +190,9 @@ const useLayers = ({ d === (hoverInfo && hoverInfo.object) ? 3 : selectedDetails.nodeDetails && - selectedDetails.nodeDetails.node_id === d.node_id - ? 3.5 - : 1, + selectedDetails.nodeDetails.node_id === d.node_id + ? 3.5 + : 1, onHover: (info) => setHoverInfo(info), @@ -214,9 +214,9 @@ const useLayers = ({ d === (hoverInfo && hoverInfo.object) ? 2 : selectedDetails.nodeDetails && - selectedDetails.nodeDetails.node_id === d.node_id - ? 2.5 - : 1, + selectedDetails.nodeDetails.node_id === d.node_id + ? 2.5 + : 1, modelMatrix: modelMatrix, updateTriggers: { getSourcePosition: [detailed_data, xType], @@ -353,7 +353,7 @@ const useLayers = ({ fillin_scatter_layer, clade_label_layer, selectedLayer, - hoveredLayer + hoveredLayer, ); } @@ -373,7 +373,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], @@ -556,7 +556,7 @@ const useLayers = ({ return first_bit; }, - [isCurrentlyOutsideBounds] + [isCurrentlyOutsideBounds], ); const processedLayers = layers @@ -582,7 +582,7 @@ const useLayers = ({ const { triggerSVGdownload } = getSVGfunction( layers.filter((x) => x !== null), - viewState + viewState, ); return { layers: processedLayers, layerFilter, keyStuff, triggerSVGdownload }; diff --git a/taxonium_component/src/hooks/useLocalBackend.jsx b/taxonium_component/src/hooks/useLocalBackend.jsx index 5683c771..a093429b 100644 --- a/taxonium_component/src/hooks/useLocalBackend.jsx +++ b/taxonium_component/src/hooks/useLocalBackend.jsx @@ -40,7 +40,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); @@ -78,7 +78,7 @@ function useLocalBackend(uploaded_data) { 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.", ); } } @@ -102,23 +102,23 @@ function useLocalBackend(uploaded_data) { 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( @@ -136,7 +136,7 @@ function useLocalBackend(uploaded_data) { "got search result from ", key, // singleSearch, - "result" + "result", // receivedData ); setResult(receivedData); @@ -147,7 +147,7 @@ function useLocalBackend(uploaded_data) { }, }; }, - [] + [], ); const getDetails = useCallback((node_id, setResult) => { diff --git a/taxonium_component/src/hooks/useNodeDetails.jsx b/taxonium_component/src/hooks/useNodeDetails.jsx index 9f0d3a23..6202efa6 100644 --- a/taxonium_component/src/hooks/useNodeDetails.jsx +++ b/taxonium_component/src/hooks/useNodeDetails.jsx @@ -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_component/src/hooks/usePerNodeFunctions.jsx b/taxonium_component/src/hooks/usePerNodeFunctions.jsx index 224370c6..e9cb5e5f 100644 --- a/taxonium_component/src/hooks/usePerNodeFunctions.jsx +++ b/taxonium_component/src/hooks/usePerNodeFunctions.jsx @@ -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_component/src/hooks/useSearch.jsx b/taxonium_component/src/hooks/useSearch.jsx index c00a52d4..08f06752 100644 --- a/taxonium_component/src/hooks/useSearch.jsx +++ b/taxonium_component/src/hooks/useSearch.jsx @@ -32,7 +32,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) @@ -84,10 +84,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], @@ -95,7 +95,7 @@ const useSearch = ({ ]; setSearchControllers({ ...searchControllers }); }, - [searchControllers, singleSearch, inflightSearches] + [searchControllers, singleSearch, inflightSearches], ); useEffect(() => { @@ -103,7 +103,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]; @@ -117,7 +117,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 @@ -130,7 +130,7 @@ const useSearch = ({ "result_changed", key, searchResults[key].boundingBox, - boundsForQueries + boundsForQueries, ); return true; @@ -275,7 +275,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] @@ -290,7 +290,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_component/src/hooks/useServerBackend.jsx b/taxonium_component/src/hooks/useServerBackend.jsx index dcd6f8b1..1024d36a 100644 --- a/taxonium_component/src/hooks/useServerBackend.jsx +++ b/taxonium_component/src/hooks/useServerBackend.jsx @@ -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_component/src/hooks/useSettings.jsx b/taxonium_component/src/hooks/useSettings.jsx index cb19a119..df81db91 100644 --- a/taxonium_component/src/hooks/useSettings.jsx +++ b/taxonium_component/src/hooks/useSettings.jsx @@ -57,16 +57,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) => { @@ -99,7 +99,7 @@ export const useSettings = ({ query, updateQuery }) => { } for hovered and selected nodes`, { position: "bottom-center", - } + }, ); }} />{" "} diff --git a/taxonium_component/src/hooks/useTreenomeAnnotations.jsx b/taxonium_component/src/hooks/useTreenomeAnnotations.jsx index 0c3857ff..b1f518a8 100644 --- a/taxonium_component/src/hooks/useTreenomeAnnotations.jsx +++ b/taxonium_component/src/hooks/useTreenomeAnnotations.jsx @@ -56,7 +56,7 @@ const useTreenomeAnnotations = (settings) => { } return output; }, - [settings.chromosomeName] + [settings.chromosomeName], ); const json = useMemo(() => { diff --git a/taxonium_component/src/hooks/useTreenomeLayerData.jsx b/taxonium_component/src/hooks/useTreenomeLayerData.jsx index bde8befa..44dea898 100644 --- a/taxonium_component/src/hooks/useTreenomeLayerData.jsx +++ b/taxonium_component/src/hooks/useTreenomeLayerData.jsx @@ -6,7 +6,7 @@ const useTreenomeLayerData = ( data, treenomeState, settings, - selectedDetails + selectedDetails, ) => { const [varDataAa, setVarDataAa] = useState([]); const [varDataNt, setVarDataNt] = useState([]); @@ -46,7 +46,7 @@ const useTreenomeLayerData = ( setVarDataNt, setCachedVarDataAa, setCachedVarDataNt, - ] + ], ); useEffect(() => { diff --git a/taxonium_component/src/hooks/useTreenomeLayers.jsx b/taxonium_component/src/hooks/useTreenomeLayers.jsx index 8deca2e2..c45df1d6 100644 --- a/taxonium_component/src/hooks/useTreenomeLayers.jsx +++ b/taxonium_component/src/hooks/useTreenomeLayers.jsx @@ -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_component/src/hooks/useTreenomeState.jsx b/taxonium_component/src/hooks/useTreenomeState.jsx index 48d81a7a..325dbfc8 100644 --- a/taxonium_component/src/hooks/useTreenomeState.jsx +++ b/taxonium_component/src/hooks/useTreenomeState.jsx @@ -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_component/src/hooks/useView.jsx b/taxonium_component/src/hooks/useView.jsx index a9d3db4c..e37a1301 100644 --- a/taxonium_component/src/hooks/useView.jsx +++ b/taxonium_component/src/hooks/useView.jsx @@ -64,7 +64,7 @@ class MyOrthographicController extends OrthographicController { { isZooming: zoomAxis === "Y", isPanning: true, - } + }, ); if (controlKey) { @@ -129,7 +129,7 @@ const useView = ({ // }; // }); setXzoom( - window.screen.width < 600 ? -1 : settings.treenomeEnabled ? -1 : 0 + window.screen.width < 600 ? -1 : settings.treenomeEnabled ? -1 : 0, ); }, [settings.treenomeEnabled]); @@ -335,7 +335,7 @@ const useView = ({ setViewState(newViewState); return newViewState; }, - [zoomAxis, xzoom, deckSize, viewState, jbrowseRef, mouseXY] + [zoomAxis, xzoom, deckSize, viewState, jbrowseRef, mouseXY], ); const zoomIncrement = useCallback( @@ -350,7 +350,7 @@ const useView = ({ overrideZoomAxis, }); }, - [viewState, onViewStateChange] + [viewState, onViewStateChange], ); const zoomReset = useCallback(() => { diff --git a/taxonium_component/src/utils/deckglToSvg.js b/taxonium_component/src/utils/deckglToSvg.js index e854a502..10e21c70 100644 --- a/taxonium_component/src/utils/deckglToSvg.js +++ b/taxonium_component/src/utils/deckglToSvg.js @@ -68,7 +68,7 @@ const getSVGfunction = (layers, viewState) => { let strokeColor, strokeWidth; if (layer.stroked) { strokeColor = accessOrConstant(layer.getLineColor, point).join( - "," + ",", ); strokeWidth = accessOrConstant(layer.getLineWidth, point); } @@ -112,7 +112,7 @@ const getSVGfunction = (layers, viewState) => { const size = accessOrConstant(layer.getSize, text); const alignment = accessOrConstant( layer.getAlignmentBaseline, - text + text, ); const anchor = accessOrConstant(layer.getTextAnchor, text); const pixelOffset = accessOrConstant(layer.getPixelOffset, text); diff --git a/taxonium_component/src/utils/jstree.js b/taxonium_component/src/utils/jstree.js index 999f8abc..d1289600 100644 --- a/taxonium_component/src/utils/jstree.js +++ b/taxonium_component/src/utils/jstree.js @@ -217,7 +217,7 @@ function kn_check_tree(tree) { p.x + "" + p.y + - "" + "", ); } document.write(""); @@ -422,8 +422,8 @@ function kn_reorder(root) { return String(a.name) < String(b.name) ? -1 : String(a.name) > String(b.name) - ? 1 - : 0; + ? 1 + : 0; }; const sort_weight = function (a, b) { return a.weight / a.n_tips - b.weight / b.n_tips; @@ -560,12 +560,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_component/src/utils/nexusToNewick.js b/taxonium_component/src/utils/nexusToNewick.js index 14f17832..d8a5d4dc 100644 --- a/taxonium_component/src/utils/nexusToNewick.js +++ b/taxonium_component/src/utils/nexusToNewick.js @@ -31,7 +31,7 @@ function nexusToNewick(nexusString) { /([^:\,\(\)]+)/gims, (match) => { return translations[match] || match; - } + }, ); return { newick: translatedNewickString }; diff --git a/taxonium_component/src/utils/processNewick.js b/taxonium_component/src/utils/processNewick.js index 111e4610..cfb1c62f 100644 --- a/taxonium_component/src/utils/processNewick.js +++ b/taxonium_component/src/utils/processNewick.js @@ -53,7 +53,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")) { @@ -255,7 +255,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", ); } @@ -315,7 +315,7 @@ export async function processNewickAndMetadata(data, sendStatusMessage) { } const blanks = Object.fromEntries( - headers.slice(1).map((x) => ["meta_" + x, ""]) + headers.slice(1).map((x) => ["meta_" + x, ""]), ); const all_keys = new Set(); diff --git a/taxonium_component/src/utils/processNextstrain.js b/taxonium_component/src/utils/processNextstrain.js index 84c74100..ad445d3c 100644 --- a/taxonium_component/src/utils/processNextstrain.js +++ b/taxonium_component/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, ) : [], }; @@ -357,8 +357,8 @@ function json_preorder(root) { attr.value && typeof attr.value !== "object" ? attr.value : typeof attr !== "object" - ? attr - : ""; + ? attr + : ""; }); path.push(parsedNode); @@ -438,7 +438,7 @@ async function json_to_tree(json) { const maintainerLinks = json.meta.maintainers .map( (source) => - `${source.name}` + `${source.name}`, ) .join(" & "); config.overlay += `

The Nextstrain build is maintained by ${maintainerLinks}.

`; @@ -459,7 +459,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_component/src/utils/reduceMaxOrMin.js b/taxonium_component/src/utils/reduceMaxOrMin.js index 9747a215..ad8b8700 100644 --- a/taxonium_component/src/utils/reduceMaxOrMin.js +++ b/taxonium_component/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_component/src/webworkers/localBackendWorker.js b/taxonium_component/src/webworkers/localBackendWorker.js index 9514d15a..7b9654ed 100644 --- a/taxonium_component/src/webworkers/localBackendWorker.js +++ b/taxonium_component/src/webworkers/localBackendWorker.js @@ -101,7 +101,7 @@ export const queryNodes = async (boundsForQueries) => { max_y, min_x, max_x, - boundsForQueries.xType + boundsForQueries.xType, ), }; @@ -183,7 +183,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); @@ -211,7 +211,7 @@ onmessage = async (event) => { processedUploadedData = await processJsonl( data.data, sendStatusMessage, - ReadableWebToNodeStream + ReadableWebToNodeStream, ); console.log("processedUploadedData created"); } else if ( @@ -224,7 +224,7 @@ onmessage = async (event) => { data.data.useDistances = true; processedUploadedData = await processNewickAndMetadata( data.data, - sendStatusMessage + sendStatusMessage, ); } else if ( data.type === "upload" && @@ -234,7 +234,7 @@ onmessage = async (event) => { ) { processedUploadedData = await processNextstrain( data.data, - sendStatusMessage + sendStatusMessage, ); } else if (data.type === "upload" && data.data && data.data.filename) { sendStatusMessage({ @@ -271,7 +271,7 @@ onmessage = async (event) => { data.node_id, processedUploadedData.nodes, data.config, - processedUploadedData.mutations + processedUploadedData.mutations, ); postMessage({ type: "nextstrain", data: result }); } diff --git a/taxonium_component/src/webworkers/treenomeWorker.js b/taxonium_component/src/webworkers/treenomeWorker.js index 5d129134..5f3dfde2 100644 --- a/taxonium_component/src/webworkers/treenomeWorker.js +++ b/taxonium_component/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({ 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 32ee922f..85a1f295 100644 --- a/taxonium_data_handling/filtering.js +++ b/taxonium_data_handling/filtering.js @@ -36,7 +36,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)); }; @@ -50,7 +50,7 @@ const reduceOverPlotting = (input, precisionX, precisionY, xType) => { "precisionX:", precisionX, "precisionY:", - precisionY + precisionY, ); const filtered = input.filter((node) => { @@ -123,7 +123,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."); @@ -151,7 +151,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."); @@ -194,7 +194,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; @@ -223,7 +223,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)); }); @@ -277,14 +277,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") { @@ -296,7 +296,7 @@ function searchFilteringIfUncached({ .map((line) => { return line.trim(); }) - .filter((line) => line !== "") + .filter((line) => line !== ""), ); filtered = data.filter((node) => { @@ -330,8 +330,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; @@ -343,7 +343,7 @@ function searchFilteringIfUncached({ revertant_mutations_set = getRevertantMutationsSet( all_data, node_to_mut, - mutations + mutations, ); } @@ -351,8 +351,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; @@ -371,7 +371,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])); @@ -427,7 +427,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); @@ -439,7 +439,7 @@ function singleSearch({ filtered_cut, getPrecision(min_x, max_x), getPrecision(min_y, max_y), - xType + xType, ); result = { type: "filtered", @@ -527,7 +527,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 @@ -538,7 +538,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); @@ -553,7 +553,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"); @@ -565,7 +565,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 2a043477..e9cef1f7 100644 --- a/taxonium_data_handling/importing.js +++ b/taxonium_data_handling/importing.js @@ -17,13 +17,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; - }) + }), ); } } @@ -82,10 +82,10 @@ export const setUpStream = (the_stream, data, sendStatusMessage) => { export const processJsonl = async ( jsonl, sendStatusMessage, - ReadableWebToNodeStream + ReadableWebToNodeStream, ) => { console.log( - "Worker processJsonl" //, jsonl + "Worker processJsonl", //, jsonl ); const data = jsonl.data; const status = jsonl.status; @@ -166,12 +166,12 @@ export const processJsonl = async ( 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); @@ -240,11 +240,11 @@ export const generateConfig = (config, processedUploadedData) => { firstNode.x_dist !== undefined && firstNode.x_time !== undefined ? ["x_dist", "x_time"] : firstNode.x_dist - ? ["x_dist"] - : ["x_time"]; + ? ["x_dist"] + : ["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_website/index.html b/taxonium_website/index.html index ccf1970d..ed8de6b5 100644 --- a/taxonium_website/index.html +++ b/taxonium_website/index.html @@ -1,4 +1,4 @@ - + diff --git a/taxonium_website/src/App.jsx b/taxonium_website/src/App.jsx index c3124951..c44402b9 100644 --- a/taxonium_website/src/App.jsx +++ b/taxonium_website/src/App.jsx @@ -125,7 +125,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; @@ -136,7 +136,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; @@ -193,7 +193,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_website/src/components/Basic.jsx b/taxonium_website/src/components/Basic.jsx index b678a55c..6be40401 100644 --- a/taxonium_website/src/components/Basic.jsx +++ b/taxonium_website/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_website/src/components/InputSupplier.jsx b/taxonium_website/src/components/InputSupplier.jsx index 6ab9c2dd..7ca1d24f 100644 --- a/taxonium_website/src/components/InputSupplier.jsx +++ b/taxonium_website/src/components/InputSupplier.jsx @@ -40,7 +40,7 @@ export const InputSupplier = ({ inputHelper, className }) => { let finalURL = tempURL; if (useProxy) { finalURL = `https://proxy.taxonium.org/proxy?url=${encodeURIComponent( - tempURL + tempURL, )}`; } if (finalURL) { @@ -79,7 +79,7 @@ export const InputSupplier = ({ inputHelper, className }) => { input.filetype = e.target.value; } return input; - }) + }), ); }} > @@ -115,7 +115,7 @@ export const InputSupplier = ({ inputHelper, className }) => { input.ladderize = e.target.checked; } return input; - }) + }), ); }} />{" "} diff --git a/taxonium_website/src/hooks/useInputHelper.jsx b/taxonium_website/src/hooks/useInputHelper.jsx index da8a2f78..3b9f8f2b 100644 --- a/taxonium_website/src/hooks/useInputHelper.jsx +++ b/taxonium_website/src/hooks/useInputHelper.jsx @@ -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 ) { @@ -179,13 +179,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, @@ -212,7 +212,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 = { @@ -228,7 +228,7 @@ export const useInputHelper = ({ (input) => input.filetype === "nwk" || input.filetype === "nextstrain" || - input.filetype === "nexus" + input.filetype === "nexus", ); upload_obj.filename = tree_file.name; @@ -265,8 +265,8 @@ export const useInputHelper = ({ filetype: query.metaType ? query.metaType : query.metaUrl.includes("csv") - ? "meta_csv" - : "meta_tsv", + ? "meta_csv" + : "meta_tsv", status: "url_supplied", taxonColumn: query.taxonColumn, }; diff --git a/taxonium_website/src/hooks/useQueryAsState.jsx b/taxonium_website/src/hooks/useQueryAsState.jsx index 159dac29..4088c876 100644 --- a/taxonium_website/src/hooks/useQueryAsState.jsx +++ b/taxonium_website/src/hooks/useQueryAsState.jsx @@ -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_website/src/main.jsx b/taxonium_website/src/main.jsx index 804bffd8..31685f97 100644 --- a/taxonium_website/src/main.jsx +++ b/taxonium_website/src/main.jsx @@ -7,5 +7,5 @@ ReactDOM.render( , - document.getElementById("root") + document.getElementById("root"), );