Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hover for treenome #342

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion taxonium_web_client/src/components/SearchTopLayerItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Modal from "react-modal";

function SearchTopLayerItem({ singleSearchSpec, myKey, search, config }) {
const myLoadingStatus = search.searchLoadingStatus[myKey];
console.log("myLoadingStatus", myLoadingStatus);

const [permaLinkModalOpen, setPermaLinkModalOpen] = useState(false);
const this_result = search.searchResults[myKey];

Expand Down
3 changes: 3 additions & 0 deletions taxonium_web_client/src/hooks/useLayers.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const useLayers = ({
data,
viewState,
colorHook,
hoverInfo,
setHoverInfo,
settings,
treenomeReferenceInfo,
Expand Down Expand Up @@ -486,6 +487,8 @@ const useLayers = ({
(layer.id.startsWith("fillin") &&
viewport.id === "main" &&
isCurrentlyOutsideBounds) ||
(layer.id.startsWith("browser-hovered") &&
viewport.id === "browser-main") ||
(layer.id.startsWith("browser-loaded") &&
viewport.id === "browser-main") ||
(layer.id.startsWith("browser-fillin") &&
Expand Down
32 changes: 32 additions & 0 deletions taxonium_web_client/src/hooks/useTreenomeLayers.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const useTreenomeLayers = (
data,
viewState,
colorHook,
hoverInfo,
setHoverInfo,
settings,
treenomeReferenceInfo,
Expand Down Expand Up @@ -188,6 +189,7 @@ const useTreenomeLayers = (
},
getPolygonOffset: myGetPolygonOffset,
};

const main_variation_layer_aa = new LineLayer({
...main_variation_aa_common_props,
data: layerDataAa,
Expand All @@ -199,6 +201,20 @@ const useTreenomeLayers = (
id: "browser-fillin-aa",
});

const hovered_layer_aa = new LineLayer({
...main_variation_aa_common_props,
data:
hoverInfo &&
hoverInfo.object &&
hoverInfo.object.m &&
hoverInfo.object.m.gene &&
hoverInfo.object.m.gene !== "nt"
? [hoverInfo.object]
: [],
id: "browser-hovered-aa",
getWidth: aaWidth * 1.5,
});

const main_variation_nt_common_props = {
onHover: (info) => setHoverInfo(info),
pickable: true,
Expand Down Expand Up @@ -283,6 +299,20 @@ const useTreenomeLayers = (
id: "browser-fillin-nt",
});

const hovered_layer_nt = new LineLayer({
...main_variation_nt_common_props,
data:
hoverInfo &&
hoverInfo.object &&
hoverInfo.object.m &&
hoverInfo.object.m.gene &&
hoverInfo.object.m.gene === "nt"
? [hoverInfo.object]
: [],
id: "browser-hovered-nt",
getWidth: ntWidth * 2,
});

const dynamic_background_data = useMemo(() => {
if (!settings.treenomeEnabled || cov2Genes === null) {
return [];
Expand Down Expand Up @@ -441,10 +471,12 @@ const useTreenomeLayers = (
if (settings.mutationTypesEnabled.aa) {
layers.push(fillin_variation_layer_aa);
layers.push(main_variation_layer_aa);
layers.push(hovered_layer_aa);
}
if (settings.mutationTypesEnabled.nt) {
layers.push(fillin_variation_layer_nt);
layers.push(main_variation_layer_nt);
layers.push(hovered_layer_nt);
}
layers.push(selected_node_layer);

Expand Down