Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 19, 2023
1 parent bd031bd commit 580e2dd
Show file tree
Hide file tree
Showing 53 changed files with 203 additions and 204 deletions.
1 change: 0 additions & 1 deletion docs/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ or make a JSON file containing
Guilhem Sempéré has created a tool called [TaxoniumColors](https://webtools.southgreen.fr/TaxoniumColors/) to help with generating these palettes.
:::


##### Title

We can supply a title with the `title` key. It will display at the top.
Expand Down
2 changes: 1 addition & 1 deletion docs/component.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ D,John,Fish`;
<script>
ReactDOM.render(
React.createElement(Taxonium, { sourceData: sourceData }),
document.getElementById("root")
document.getElementById("root"),
);
</script>
</body>
Expand Down
26 changes: 13 additions & 13 deletions taxonium_backend/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ program
.option("--data_url <data url>", "data url")
.option(
"--data_file <data file>",
"local data file, as alternative to data url"
"local data file, as alternative to data url",
);

program.parse();
Expand Down Expand Up @@ -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);
});
Expand Down Expand Up @@ -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.");
Expand All @@ -268,19 +268,19 @@ app.get("/nodes/", function (req, res) {
(Date.now() - start_time) +
"ms, and output " +
result.length +
" nodes."
" nodes.",
);
});

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");
Expand Down Expand Up @@ -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,
);
});

Expand All @@ -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,
);
});

Expand All @@ -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);
});
Expand All @@ -505,7 +505,7 @@ const loadData = async () => {
processedData = await importing.processJsonl(
supplied_object,
logStatusMessage,
ReadableWebToNodeStream.ReadableWebToNodeStream
ReadableWebToNodeStream.ReadableWebToNodeStream,
);

logStatusMessage({
Expand All @@ -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);
Expand All @@ -530,7 +530,7 @@ const loadData = async () => {
processedData.overallMaxY,
processedData.overallMinX,
processedData.overallMaxX,
"x_dist"
"x_dist",
);

cached_starting_values = result;
Expand Down
2 changes: 1 addition & 1 deletion taxonium_component/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ If you're working with basic HTML, you can include the Taxonium component using
<script>
ReactDOM.render(
React.createElement(Taxonium, { sourceData: sourceData }),
document.getElementById("root")
document.getElementById("root"),
);
</script>
</body>
Expand Down
8 changes: 4 additions & 4 deletions taxonium_component/src/Deck.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function Deck({
// Treenome state
const setMouseXY = useCallback(
(info) => view.setMouseXY([info.x, info.y]),
[view]
[view],
);
const [treenomeReferenceInfo, setTreenomeReferenceInfo] = useState(null);

Expand All @@ -91,7 +91,7 @@ function Deck({
mouseDownPos.current &&
Math.sqrt(
Math.pow(mouseDownPos.current[0] - event.clientX, 2) +
Math.pow(mouseDownPos.current[1] - event.clientY, 2)
Math.pow(mouseDownPos.current[1] - event.clientY, 2),
) > pan_threshold
) {
return false;
Expand Down Expand Up @@ -148,7 +148,7 @@ function Deck({
onViewStateChange,
xzoom,
deckRef,
]
],
);

const [hoverInfo, setHoverInfoRaw] = useState(null);
Expand All @@ -166,7 +166,7 @@ function Deck({
hoverDetails.clearNodeDetails();
}
},
[hoverDetails]
[hoverDetails],
);

const { layers, layerFilter, keyStuff } = useLayers({
Expand Down
10 changes: 5 additions & 5 deletions taxonium_component/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ src/Deck.jsx: This component renders the actual DeckGL canvas and handles intera

src/hooks: This folder contains all the React hooks used in the project. Some of the main hooks are:

- useBackend: This hook is used to interface with either a local or server backend to get data and search
- useBackend: This hook is used to interface with either a local or server backend to get data and search
- useColor, useColorBy: These hooks handle the node coloring logic
- useConfig: This hook is used to get configuration information (title, source, etc)
- useGetDynamicData: This hook is used to get data from the backend within the current viewport
- useLayers: This hook generates the DeckGL layers
- useLayers: This hook generates the DeckGL layers
- useNodeDetails: This hook is used to get details for selected nodes
- useSearch: This hook handles searching the tree
- useView: This hook manages the view state and zooming/panning
Expand All @@ -17,6 +17,6 @@ src/hooks: This folder contains all the React hooks used in the project. Some of
src/utils: This folder contains various utility functions, including:

- processNewick.js: For converting Newick/Nexus into Taxonium JSON format
- processNextstrain.js: For converting Nextstrain JSON into Taxonium JSON format
- searchUtil.js: Contains utility functions for searching
- formatNumber.js: Used to format large numbers with commas
- processNextstrain.js: For converting Nextstrain JSON into Taxonium JSON format
- searchUtil.js: Contains utility functions for searching
- formatNumber.js: Used to format large numbers with commas
6 changes: 3 additions & 3 deletions taxonium_component/src/Taxonium.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function Taxonium({
backendUrl ? backendUrl : query.backend,
query.sid,
url_on_fail,
sourceData
sourceData,
);
let hoverDetails = useHoverDetails();
const gisaidHoverDetails = useNodeDetails("gisaid-hovered", backend);
Expand All @@ -93,7 +93,7 @@ function Taxonium({
setTitle,
query,
configDict,
configUrl
configUrl,
);
const colorBy = useColorBy(config, query, updateQuery);
const colorMapping = useMemo(() => {
Expand All @@ -110,7 +110,7 @@ function Taxonium({
(xType) => {
updateQuery({ xType });
},
[updateQuery]
[updateQuery],
);

const { data, boundsForQueries, isCurrentlyOutsideBounds } =
Expand Down
6 changes: 3 additions & 3 deletions taxonium_component/src/components/Basic.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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}
Expand All @@ -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}
Expand Down
8 changes: 4 additions & 4 deletions taxonium_component/src/components/DeckSettingsModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const DeckSettingsModal = ({
checked={settings.displayTextForInternalNodes}
onChange={() =>
settings.setDisplayTextForInternalNodes(
!settings.displayTextForInternalNodes
!settings.displayTextForInternalNodes,
)
}
/>{" "}
Expand All @@ -65,7 +65,7 @@ const DeckSettingsModal = ({
checked={settings.displayPointsForInternalNodes}
onChange={() =>
settings.setDisplayPointsForInternalNodes(
!settings.displayPointsForInternalNodes
!settings.displayPointsForInternalNodes,
)
}
/>{" "}
Expand All @@ -81,7 +81,7 @@ const DeckSettingsModal = ({
value={settings.thresholdForDisplayingText}
onChange={(e) =>
settings.setThresholdForDisplayingText(
parseFloat(e.target.value)
parseFloat(e.target.value),
)
}
step="0.1"
Expand Down Expand Up @@ -120,7 +120,7 @@ const DeckSettingsModal = ({
onChange={() =>
settings.setMutationTypeEnabled(
key,
!settings.mutationTypesEnabled[key]
!settings.mutationTypesEnabled[key],
)
}
/>{" "}
Expand Down
2 changes: 1 addition & 1 deletion taxonium_component/src/components/JBrowseErrorBoundary.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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).",
);
}
}
Expand Down
6 changes: 3 additions & 3 deletions taxonium_component/src/components/JBrowsePanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand All @@ -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
Expand All @@ -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]);
Expand Down
2 changes: 1 addition & 1 deletion taxonium_component/src/components/Key.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Key = ({
<div
className={classNames(
"px-2 border-right border bg-white opacity-90 absolute bottom-2 left-2 pt-1 pb-2",
collapsed ? "w-20" : "w-32"
collapsed ? "w-20" : "w-32",
)}
>
<h3
Expand Down
4 changes: 2 additions & 2 deletions taxonium_component/src/components/NodeHoverTip.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const NodeHoverTip = ({
hoveredNode[key]
)}
</div>
)
),
)}

{config.mutations.length > 0 && (
Expand Down Expand Up @@ -164,7 +164,7 @@ const NodeHoverTip = ({
<div className="mt-1 justify">
<b className="font-semibold">Authors:</b>{" "}
{fixAuthors(
hoverDetails.nodeDetails.acknowledgements.covv_authors
hoverDetails.nodeDetails.acknowledgements.covv_authors,
)}
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions taxonium_component/src/components/SearchItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const SearchItem = ({ singleSearchSpec, setThisSearchSpec, config }) => {
}

return [type.name, obj];
})
}),
);

const setTypeTo = (type) => {
Expand Down Expand Up @@ -326,7 +326,7 @@ const SearchItem = ({ singleSearchSpec, setThisSearchSpec, config }) => {
(foundsubspec, i) =>
i === singleSearchSpec.subspecs.indexOf(subspec)
? new_subspec
: foundsubspec
: foundsubspec,
),
});
}}
Expand All @@ -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),
),
});
}}
Expand Down
Loading

0 comments on commit 580e2dd

Please sign in to comment.