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

Treenome Browser v1 integration #302

Merged
merged 78 commits into from
Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
69d7e84
integrate basic treenome browser into fresh fork
May 25, 2022
7e3d644
Merge branch 'master' into master
amkram May 31, 2022
7a529c0
Merge pull request #1 from theosanderson/master
amkram May 31, 2022
9ae4e3c
update app.jsx
May 31, 2022
92fa1d5
fix merge
May 31, 2022
092246b
fixes
Jun 1, 2022
ece2115
Update App.jsx
theosanderson Jun 3, 2022
3fefe5d
fix merge
Jun 3, 2022
d95ea51
Merge branch 'theosanderson-master'
Jun 3, 2022
ede8a64
fix merge
Jun 3, 2022
67f576f
Merge branch 'theosanderson-master'
Jun 3, 2022
7083ada
modify jbrowse styles, extend browser background layer
Jun 7, 2022
3f4b03e
fix merge
Jun 7, 2022
d10f9c5
Merge branch 'theosanderson-master'
Jun 7, 2022
badd8f8
add sidebar toggle, some resizing logic
Jun 7, 2022
da8f995
fix merge
Jun 11, 2022
36c011f
fix merge
Jun 11, 2022
f1e41b7
correctly color backmutations
Jun 14, 2022
9d1eb44
pan/zoom works on browser area
Jun 14, 2022
acda406
browser toggle works (but still computes in bg), tree fully overlaps …
Jun 16, 2022
fcdf3fe
avoid controlling tree while mouse is in JBrowse window
Jun 16, 2022
4981484
resizing finally works! add framework for automated annotation grabbing
Jun 17, 2022
1878faf
pull all UCSC SARS-CoV-2 tracks into JBrowse
Jun 18, 2022
962c0ef
set xbounds on browser load
Jun 21, 2022
8098538
fix merge
Jun 21, 2022
6a2313f
fix merge
Jun 21, 2022
facdf96
Merge branch 'theosanderson:master' into master
amkram Jun 30, 2022
8665836
add web worker for browser computation
amkram Jul 5, 2022
49f4352
Merge branch 'theosanderson:master' into master
amkram Jul 5, 2022
1f3ee60
Merge branch 'master' of https:/amkram/taxonium
amkram Jul 5, 2022
9f5473d
fix nodehovertip width issue (hacky)
amkram Jul 5, 2022
bdf84bf
browser dimensions correct on load
amkram Jul 5, 2022
07536c0
hide mutation hover tooltips in jbrowse area
amkram Jul 5, 2022
960f509
fix zoom increment buttons, add shadow to sidebar
amkram Jul 7, 2022
af77fc3
fix zoom to samples in browser mode
amkram Jul 7, 2022
34ccb60
mitigate tearing on zoom
amkram Jul 7, 2022
0547669
Merge branch 'theosanderson:master' into master
amkram Jul 7, 2022
9175a4b
don't compute if browser disabled
amkram Jul 7, 2022
83739ae
fix nodehovertip width
amkram Jul 7, 2022
634a388
Merge branch 'master' of https:/amkram/taxonium
amkram Jul 7, 2022
8864d6a
only make web worker once
amkram Jul 8, 2022
9004392
Merge branch 'theosanderson:master' into master
amkram Jul 15, 2022
18283fb
fix zoom to sample
amkram Jul 15, 2022
8942176
Merge branch 'master' of https:/amkram/taxonium
amkram Jul 15, 2022
b6ff00a
add horizontal overlay on selected node when zoomed in
amkram Jul 15, 2022
6b55bf1
fix tearing a bit more
amkram Jul 15, 2022
d018b2f
testing
amkram Jul 19, 2022
b64490c
add nt mutations, chunk variation loading
amkram Jul 20, 2022
760c27f
works on trees that have .gb file (root nt 'muts'
amkram Jul 20, 2022
2f71881
Merge pull request #6 from amkram/temp
amkram Jul 20, 2022
db650d6
few logic updates
amkram Jul 20, 2022
68d14df
Merge pull request #7 from amkram/temp
amkram Jul 20, 2022
8a79472
refactor browser to genomeBrowser
amkram Jul 20, 2022
d3bbddd
remove unused var
amkram Jul 20, 2022
f7811b0
remove comments
amkram Jul 21, 2022
24e5838
renaming and change treenome PolygonLayer to LineLayer
amkram Jul 21, 2022
9251053
linting
amkram Jul 22, 2022
caf00a0
add tooltip to treenome toggle
amkram Jul 22, 2022
5230bd4
merge
amkram Jul 30, 2022
7c2e36c
Merge branch 'theosanderson-master'
amkram Jul 30, 2022
9fe4045
treenome works on usher_to_taxonium trees made with .gb file
amkram Aug 1, 2022
0cb0717
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 1, 2022
91a4f64
fix colors on cov2tree
amkram Aug 1, 2022
7f0573e
Merge branch 'master' of https:/amkram/taxonium
amkram Aug 1, 2022
341ea4b
add treenome doc
amkram Aug 2, 2022
045b65d
link to treenome docs in tooltip
amkram Aug 2, 2022
7001443
fillin for treenome
amkram Aug 3, 2022
950e056
sidebar fixes and mobile optimization
amkram Aug 3, 2022
cc8f69b
sidebar width and keep buttons on tree side
amkram Aug 3, 2022
edc1b6d
sidebar down arrow should work on mobile
amkram Aug 3, 2022
86b592c
fix zoom issue and keep viewstate when treenome toggle
amkram Aug 8, 2022
c29cbfc
Merge branch 'theosanderson:master' into master
amkram Aug 8, 2022
0406b2f
testing dockerfile 18.0.0 pin
amkram Aug 10, 2022
fba06cf
test
amkram Aug 10, 2022
b2ebe20
switch docker image to bullseye
amkram Aug 11, 2022
2407740
fix package installation
amkram Aug 11, 2022
1e8cf0e
node to 16
amkram Aug 11, 2022
56c58de
revert to node 18, build canvas from source
amkram Aug 11, 2022
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
3 changes: 2 additions & 1 deletion Dockerfile.frontend
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ COPY taxonium_data_handling ./taxonium_data_handling
WORKDIR /app/taxonium_web_client

# Install dependencies for node-gyp from lzma-native
RUN apk add --no-cache python3 make g++
RUN apk add --no-cache python3 make g++ jpeg-dev cairo-dev giflib-dev pango-dev
RUN npm_config_build_from_source=true yarn add canvas
RUN yarn --frozen-lockfile
RUN yarn build

Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
index.md
taxoniumtools.md
advanced.md
treenome.md
```

Taxonium is a tool for exploring phylogenetic trees. The web interface can be accessed at [taxonium.org](https://taxonium.org/) and the source code repository at [https:/theosanderson/taxonium](https:/theosanderson/taxonium).
Expand Down
49 changes: 49 additions & 0 deletions docs/treenome.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Treenome Browser

The Treenome Browser allows simultaneous exploration of a reference genome, phylogeny, and the genetic variation within a tree.

#### Getting Started

<iframe width="560" height="315" src="https://user-images.githubusercontent.com/6502785/182259439-0435263f-fa8d-4304-b3a3-b867e0edd175.mp4" frameborder="0" allowfullscreen></iframe>

#### Enabling the Treenome Browser

:::{note}
Currently, only jsonl trees that have been created with `usher_to_taxonium` using a protobuf and an associated Genbank file work with the Treenome Browser. E.g., `usher_to_taxonium -i input.pb -o output.jsonl.gz --genbank gbfile.gb`
:::

If your supplied tree file is supported, enable Treenome Browser in the right-hand panel.

```{image} https://user-images.githubusercontent.com/6502785/182260804-29e238a0-fe18-4e07-8f45-0046ee47a4c3.png
:width: 40em
:class: no-scaled-link
```

#### Navigating the Treenome Browser

To explore the tree, see the main Taxonium [documentation](./index.md)

To explore the genome, click and drag (or scroll) left or right in the top (JBrowse) panel. Zoom into a region by entering coordinates or by dragging across a section of the genome. Hover over mutations to view details.

```{image} https://user-images.githubusercontent.com/6502785/182264410-eb760791-3d16-4162-bc94-1c83515a64fd.png
:width: 30em
:class: no-scaled-link
```

Amino acid mutations are enabled by default. You can also enable nucleotide mutations in the settings menu.

```{image} https://user-images.githubusercontent.com/6502785/182264641-d732e67d-cccd-4186-b40b-3a37a2cecffe.png
:width: 30em
:class: no-scaled-link
```

#### Loading annotations

Load annotations by clicking the track selector button in the browser panel.

```{image} https://user-images.githubusercontent.com/6502785/182264983-c62d6f13-2323-46ba-872a-2db2ac864ca5.png
:width: 20em
:class: no-scaled-link
```

If you are viewing the public SARS-CoV-2 tree ([cov2tree.org](https://cov2tree.org/)), annotation tracks are loaded automatically from the [UCSC Genome Browser](https://genome.ucsc.edu/covid19.html). Otherwise, annotations are currently limited to a reference sequence track.
2 changes: 2 additions & 0 deletions taxonium_web_client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"private": true,
"dependencies": {
"@craco/craco": "^6.1.2",
"@fontsource/roboto": "^4.5.5",
"@jbrowse/react-linear-genome-view": "^1.7.6",
"@tailwindcss/forms": "^0.5.2",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
Expand Down
59 changes: 59 additions & 0 deletions taxonium_web_client/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,66 @@
@apply outline-none ring-offset-0 ring-1 ring-gray-800 border-gray-800;
}

/* JBrowse customization */
.MuiPaper-root.MuiPaper-rounded {
box-shadow: none !important;
padding: 0px !important;
margin: 0px !important;
}

#view-browser-axis > div > span > div > div > div > div:nth-child(1) {
display: none !important;
}

.jss2 {
margin: 0px !important;
}

p[data-testid="refLabel-NC_045512v2"] {
display: none !important;
}

[class*="PrivateSwitchBase-input-"] + svg {
color: "#2463eb" !important;
}

.sidebar-toggle {
border: 2px solid rgb(136, 135, 135) !important;
border-radius: 3px;
margin: 10px;
}

.sidebar-open {
transition: right 0.3s ease-in-out !important;
}

.sidebar-closed {
transition: right 0.3s ease-in-out !important;

position: absolute;
width: 60px;
right: 0px;
}

.search-panel {
width: 100% !important;
}

select,
input {
border-color: #c7ccd8 !important;
}

.infoTooltip {
max-width: 200px;
font-size: 12pt !important;
pointer-events: auto !important;
}
.infoTooltip :hover {
visibility: visible !important;
opacity: 1 !important;
}
.tooltipLink {
color: #2563eb;
text-decoration: underline;
}
1 change: 1 addition & 0 deletions taxonium_web_client/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const default_query = {
backend: DEFAULT_BACKEND,
xType: "x_dist",
mutationTypesEnabled: JSON.stringify({ aa: true, nt: false }),
treenomeEnabled: false,
};

if (window.location.hostname.includes("mpx.taxonium.org")) {
Expand Down
91 changes: 71 additions & 20 deletions taxonium_web_client/src/Deck.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/// app.js
import React, { useState, useCallback, useRef } from "react";
import DeckGL from "@deck.gl/react";
import { View } from "@deck.gl/core";
import useLayers from "./hooks/useLayers";
import JBrowsePanel from "./components/JBrowsePanel";
import { ClipLoader } from "react-spinners";
import {
CircularProgressbarWithChildren,
Expand All @@ -11,14 +13,15 @@ import "react-circular-progressbar/dist/styles.css";

import useSnapshot from "./hooks/useSnapshot";
import NodeHoverTip from "./components/NodeHoverTip";
import MutationHoverTip from "./components/MutationHoverTip";
import { DeckButtons } from "./components/DeckButtons";
import DeckSettingsModal from "./components/DeckSettingsModal";
import FirefoxWarning from "./components/FirefoxWarning";

function Deck({
data,
search,

treenomeState,
view,
colorHook,
colorBy,
Expand All @@ -31,8 +34,9 @@ function Deck({
setDeckSize,
deckSize,
isCurrentlyOutsideBounds,
deckRef,
jbrowseRef,
}) {
const deckRef = useRef();
const snapshot = useSnapshot(deckRef);
const [deckSettingsOpen, setDeckSettingsOpen] = useState(false);

Expand All @@ -51,6 +55,13 @@ function Deck({
xzoom,
} = view;

// Treenome state
const setMouseXY = useCallback(
(info) => view.setMouseXY([info.x, info.y]),
[view]
);
const [reference, setReference] = useState(null);

const [mouseDownIsMinimap, setMouseDownIsMinimap] = useState(false);

const mouseDownPos = useRef();
Expand Down Expand Up @@ -122,7 +133,14 @@ function Deck({
});
}
},
[selectedDetails, mouseDownIsMinimap, viewState, onViewStateChange, xzoom]
[
selectedDetails,
mouseDownIsMinimap,
viewState,
onViewStateChange,
xzoom,
deckRef,
]
);

const [hoverInfo, setHoverInfoRaw] = useState(null);
Expand Down Expand Up @@ -158,6 +176,9 @@ function Deck({
settings,
isCurrentlyOutsideBounds,
config,
treenomeState,
reference,
setReference,
});
// console.log("deck refresh");

Expand Down Expand Up @@ -235,8 +256,12 @@ function Deck({
onViewStateChange={onViewStateChange}
layerFilter={layerFilter}
layers={layers}
onHover={setMouseXY}
onResize={(size) => {
setDeckSize(size);
window.setTimeout(() => {
treenomeState.handleResize();
}, 50);
console.log("resize", size);
}}
onAfterRender={(event) => {
Expand All @@ -245,23 +270,49 @@ function Deck({
}
}}
>
<NodeHoverTip
hoverInfo={hoverInfo}
hoverDetails={hoverDetails}
colorHook={colorHook}
colorBy={colorBy}
config={config}
filterMutations={settings.filterMutations}
deckSize={deckSize}
/>
<DeckButtons
zoomIncrement={zoomIncrement}
zoomAxis={zoomAxis}
setZoomAxis={setZoomAxis}
snapshot={snapshot}
loading={data.status === "loading"}
requestOpenSettings={() => setDeckSettingsOpen(true)}
/>
<View id="browser-axis">
<div
style={{
width: "100%",
height: "100%",
border: "1px solid black",
position: "relative",
zIndex: 1,
}}
>
<span ref={jbrowseRef}>
<JBrowsePanel treenomeState={treenomeState} settings={settings} />
</span>
</div>
</View>
<View id="main">
<NodeHoverTip
hoverInfo={hoverInfo}
hoverDetails={hoverDetails}
colorHook={colorHook}
colorBy={colorBy}
config={config}
filterMutations={settings.filterMutations}
deckSize={deckSize}
/>
<MutationHoverTip
hoverInfo={hoverInfo}
hoverDetails={hoverDetails}
colorHook={colorHook}
colorBy={colorBy}
config={config}
reference={reference}
/>
<DeckButtons
zoomIncrement={zoomIncrement}
zoomAxis={zoomAxis}
setZoomAxis={setZoomAxis}
snapshot={snapshot}
loading={data.status === "loading"}
requestOpenSettings={() => setDeckSettingsOpen(true)}
settings={settings}
/>
</View>
</DeckGL>
</div>
);
Expand Down
Loading