diff --git a/.all-contributorsrc b/.all-contributorsrc index 66466a8fd..5b338dd1e 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 9447a4bf7..447748960 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 446a8edb9..1da2cb440 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 def706dc1..b91e23060 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 d77b29471..142ec0df3 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 fe04ff49d..306df35f1 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 b678a55c4..6be40401b 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 f2c9e5c6c..67b67f510 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 a7f77cb58..2723ad373 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 316b51f1d..8a0a96d77 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 26f1f4488..eaf9e1534 100644 --- a/taxonium_component/src/components/Key.jsx +++ b/taxonium_component/src/components/Key.jsx @@ -31,7 +31,7 @@ const 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 7f020c4d3..458e6c670 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 8f263dad3..6b0766d9c 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 a00c518db..db753e8de 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 1f43f47ed..ce688759d 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( @@ -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_component/src/hooks/useColorBy.jsx b/taxonium_component/src/hooks/useColorBy.jsx index 7bfbd276c..3d0688416 100644 --- a/taxonium_component/src/hooks/useColorBy.jsx +++ b/taxonium_component/src/hooks/useColorBy.jsx @@ -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 60258d541..841422ae4 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 a0172a836..ca49fa110 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 a47462371..1378d7a60 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]); @@ -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 5683c7712..a093429b4 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 9f0d3a236..6202efa6a 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 224370c66..e9cb5e5f5 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 c00a52d44..08f06752c 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 dcd6f8b11..1024d36a4 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 cb19a119c..df81db913 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 0c3857ff2..b1f518a8d 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 bde8befad..44dea8982 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 8deca2e2a..c45df1d6e 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 48d81a7a7..325dbfc8a 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 a9d3db4cb..e37a13011 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 e854a5021..10e21c70f 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 999f8abc2..40f9ac771 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(""); @@ -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 14f178329..d8a5d4dcc 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 111e46100..cfb1c62f0 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 3463f3070..f080c81d8 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, ) : [], }; @@ -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_component/src/utils/reduceMaxOrMin.js b/taxonium_component/src/utils/reduceMaxOrMin.js index 9747a2153..ad8b8700a 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 9514d15ae..7b9654eda 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 5d129134d..5f3dfde2c 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 e7b43a98d..a8456f871 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 32ee922fa..85a1f2956 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 2a0434775..4f80dfff5 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); @@ -244,7 +244,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 bcc211358..4de4d650d 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 86337425b..215367db2 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 ccf1970d8..ed8de6b5e 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 7a295b4b0..cdbc4ca70 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 b678a55c4..6be40401b 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 2b1aaf3ba..057eee45f 100644 --- a/taxonium_website/src/components/InputSupplier.jsx +++ b/taxonium_website/src/components/InputSupplier.jsx @@ -72,7 +72,7 @@ export const InputSupplier = ({ inputHelper, className }) => { input.filetype = e.target.value; } return input; - }) + }), ); }} > @@ -108,7 +108,7 @@ export const InputSupplier = ({ inputHelper, className }) => { input.ladderize = e.target.checked; } return input; - }) + }), ); }} />{" "} @@ -188,7 +188,7 @@ export const InputSupplier = ({ inputHelper, className }) => { setTempURL( e.target.value .replace("http://", "") - .replace("http://", "https://") + .replace("http://", "https://"), ); }} onKeyUp={(e) => { diff --git a/taxonium_website/src/hooks/useInputHelper.jsx b/taxonium_website/src/hooks/useInputHelper.jsx index bb87e820b..62c0f558f 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 ) { @@ -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); } @@ -181,13 +181,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, @@ -214,7 +214,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 = { @@ -230,7 +230,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_website/src/hooks/useQueryAsState.jsx b/taxonium_website/src/hooks/useQueryAsState.jsx index 159dac29a..4088c8766 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 804bffd85..31685f97b 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"), );