Skip to content

Commit

Permalink
Misc
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Oct 12, 2023
1 parent d06a7e4 commit abd1cbd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
"name": "MsaView"
},
"dependencies": {
"@types/pako": "^2.0.1",
"pako": "^2.1.0",
"react-msaview": "^2.0.0",
"regenerator-runtime": "^0.14.0",
"tslib": "^2.3.1"
Expand Down
12 changes: 8 additions & 4 deletions src/LaunchMsaView/LaunchMsaViewDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from '@mui/material'
import { Feature, getSession } from '@jbrowse/core/util'
import { makeStyles } from 'tss-react/mui'
import { ungzip } from 'pako'

// locals

Expand Down Expand Up @@ -74,7 +75,6 @@ export default function LaunchProteinViewDialog({
const options = getTranscriptFeatures(feature)

const [userSelection, setUserSelection] = useState(getId(options[0]))
console.log({ options })
return (
<Dialog
maxWidth="xl"
Expand Down Expand Up @@ -108,17 +108,21 @@ export default function LaunchProteinViewDialog({
;(async () => {
try {
const res = await fetch(
`https://jbrowse.org/demos/msaview/knownCanonical/${userSelection}.json`,
`https://jbrowse.org/demos/msaview/knownCanonical/${userSelection}.mfa.gz`,
)
if (!res.ok) {
throw new Error(
`HTTP ${res.status} fetching ${await res.text()}`,
)
}
const data = await res.json()
console.log({ data })
const data = await res.arrayBuffer()
const d = new TextDecoder().decode(ungzip(data))
session.addView('MsaView', {
type: 'MsaView',
data: {
msa: d,
tree: '',
},
})
handleClose()
} catch (e) {
Expand Down
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1818,6 +1818,11 @@
dependencies:
undici-types "~5.25.1"

"@types/pako@^2.0.1":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@types/pako/-/pako-2.0.1.tgz#99e4b7ae6a8560c5928d7f31e89a394e1e6fd169"
integrity sha512-fXhui1fHdLrUR0KEyQsBzqdi3Z+MitnRcpI2eeFJyzaRdqO2miX/BDz2Hh0VdkBbrWprgcQ+ItFmbdKYdbMjvg==

"@types/parse-json@^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0"
Expand Down Expand Up @@ -6545,6 +6550,11 @@ pako@^1.0.11:
resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf"
integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==

pako@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/pako/-/pako-2.1.0.tgz#266cc37f98c7d883545d11335c00fbd4062c9a86"
integrity sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==

parent-module@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2"
Expand Down

0 comments on commit abd1cbd

Please sign in to comment.