Skip to content
Snippets Groups Projects
Commit f3bd6728 authored by Remi  PLANEL's avatar Remi PLANEL
Browse files

Handle pdb and cif inputs

parent 750d2c5f
No related branches found
No related tags found
1 merge request!134Resolve "Table with all PDB files, to make them available to download"
Pipeline #118410 passed with stages
in 7 minutes
<script lang="ts" setup> <script lang="ts" setup>
import { useDisplay } from 'vuetify'
const { mobile } = useDisplay()
export interface Props { export interface Props {
fluid?: boolean fluid?: boolean
toc?: boolean toc?: boolean
...@@ -31,7 +35,7 @@ function onScroll() { ...@@ -31,7 +35,7 @@ function onScroll() {
<v-container v-scroll="onScroll" :fluid="fluid"> <v-container v-scroll="onScroll" :fluid="fluid">
<v-row justify="center"> <v-row justify="center">
<v-col cols="auto"> <v-col cols="auto">
<v-card flat color="transparent" :max-width="fluid ? undefined : 1280"> <v-card flat color="transparent" :min-width="mobile ? undefined : 900" :max-width="fluid ? undefined : 1500">
<slot /> <slot />
<EditGitlab v-if="edit" /> <EditGitlab v-if="edit" />
<NavPrevNext v-if="edit" /> <NavPrevNext v-if="edit" />
......
...@@ -62,11 +62,11 @@ const computedHeight = computed(() => { ...@@ -62,11 +62,11 @@ const computedHeight = computed(() => {
return height.value - 250 return height.value - 250
}) })
const paeError: Ref<string | null> = ref(null)
function closeStructure() { function closeStructure() {
selectedPdb.value = null selectedPdb.value = null
dialog.value = false dialog.value = false
} }
...@@ -107,11 +107,19 @@ watch(selectedPaePath, async (newPaePath) => { ...@@ -107,11 +107,19 @@ watch(selectedPaePath, async (newPaePath) => {
try { try {
const data = await d3.tsv(newPaePath); const data = await d3.tsv(newPaePath);
console.log(data.length) console.log(data.length)
console.log(data[0][0])
console.log(data?.[0]?.[0] !== undefined)
if (data.length > 500) { if (data.length > 500) {
paeError.value = "The PAE is too large to be displayed"
paeData.value = []
}
else if (data?.[0]?.[0] === undefined) {
paeError.value = "The PAE cannot be downloaded"
paeData.value = [] paeData.value = []
} }
else { else {
paeData.value = data paeData.value = data
paeError.value = null
} }
} }
...@@ -151,15 +159,19 @@ const plotPaeOptions = computed(() => { ...@@ -151,15 +159,19 @@ const plotPaeOptions = computed(() => {
} }
}) })
watch(selectedPdb, (selectedPdb, prevSelectPdb) => { watch(selectedPdb, (newSelectedPdb, prevSelectPdb) => {
if (selectedPdb !== null) { if (newSelectedPdb !== null) {
dialog.value = true dialog.value = true
const format = toValue(newSelectedPdb)?.split(".").slice(-1)[0]?.toLowerCase() ?? "pdb"
console.log(toValue(newSelectedPdb)?.split(".").slice(-1))
console.log(format)
moleculeFormat.value = format
if (pdbeMolstarComponent.value?.viewerInstance) { if (pdbeMolstarComponent.value?.viewerInstance) {
const viewerInstance = pdbeMolstarComponent.value.viewerInstance const viewerInstance = pdbeMolstarComponent.value.viewerInstance
// show.value = true // show.value = true
const customData = { url: selectedPdb, format: "pdb", binary: false } const customData = { url: newSelectedPdb, format: format, binary: false }
viewerInstance.visual.update({ customData }) viewerInstance.visual.update({ customData })
...@@ -168,6 +180,10 @@ watch(selectedPdb, (selectedPdb, prevSelectPdb) => { ...@@ -168,6 +180,10 @@ watch(selectedPdb, (selectedPdb, prevSelectPdb) => {
} }
}) })
// const moleculeFormat = computed(() => {
// return toValue(selectedPdb)?.split(".")?.[-1]?.toLowerCase() ?? "pdb"
// })
const moleculeFormat: Ref<string> = ref("pdb")
</script> </script>
...@@ -198,12 +214,13 @@ watch(selectedPdb, (selectedPdb, prevSelectPdb) => { ...@@ -198,12 +214,13 @@ watch(selectedPdb, (selectedPdb, prevSelectPdb) => {
:height="computedHeight" :width="computedWidth" position="relative"> :height="computedHeight" :width="computedWidth" position="relative">
<pdbe-molstar ref="pdbeMolstarComponent" hide-controls="true" landscape="true" <pdbe-molstar ref="pdbeMolstarComponent" hide-controls="true" landscape="true"
:custom-data-url="selectedPdb" alphafold-view="true" :custom-data-url="selectedPdb" alphafold-view="true"
custom-data-format="cif"></pdbe-molstar> :custom-data-format="moleculeFormat"></pdbe-molstar>
</v-sheet> </v-sheet>
</v-col> </v-col>
<v-col > <v-col>
<PlotFigure v-if="sanitizedPaeData?.length > 0" defer :options="plotPaeOptions"></PlotFigure> <PlotFigure v-if="sanitizedPaeData?.length > 0 && paeError === null" defer
<v-alert type="warning">The PAE is to large</v-alert> :options="plotPaeOptions"></PlotFigure>
<v-alert v-else type="warning">{{ paeError }}</v-alert>
<v-card flat color="transparent"> <v-card flat color="transparent">
<v-card-title>Model Confidence</v-card-title> <v-card-title>Model Confidence</v-card-title>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment