Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
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
27 changes: 25 additions & 2 deletions src/components/ProteinStructureView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import 'pdbe-molstar/build/pdbe-molstar-light.css'
import _ from 'lodash'
import {watch, ref} from 'vue'

import config from '@/config'
import useScopedId from '@/composables/scoped-id'

export default {
Expand Down Expand Up @@ -242,12 +243,34 @@ export default {
this.$emit('hoveredOverResidue', e.eventData)
},

render: function () {
render: async function () {
if (this.selectedAlphaFold) {
let alphafoldCifUrl
try {
const response = await axios.get(`${config.apiBaseUrl}/alphafold-files/version`)
const alphafoldFilesVersion = response.data.version
alphafoldCifUrl = `https://alphafold.ebi.ac.uk/files/AF-${this.selectedAlphaFold.id}-F1-model_${alphafoldFilesVersion}.cif`
} catch (error) {
this.$toast.add({severity: 'error', summary: 'Error', detail: 'Failed to fetch AlphaFold version'})
return
}

// verify that the alphafoldCifUrl exists by verifying 200 or 304 status
try {
const response = await fetch(alphafoldCifUrl, { method: 'HEAD' })
if (response.status !== 200 && response.status !== 304) {
this.$toast.add({severity: 'error', summary: 'Error', detail: 'Failed to fetch AlphaFold structure'})
return
}
} catch (error) {
this.$toast.add({severity: 'error', summary: 'Error', detail: 'Failed to fetch AlphaFold structure'})
return
}

const viewerInstance = new PDBeMolstarPlugin()
const options = {
customData: {
url: `https://alphafold.ebi.ac.uk/files/AF-${this.selectedAlphaFold.id}-F1-model_v6.cif`,
url: alphafoldCifUrl,
format: 'cif'
},
/** This applies AlphaFold confidence score colouring theme for AlphaFold model */
Expand Down
2 changes: 1 addition & 1 deletion src/components/screens/DashboardView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default {
}
}
)
this.scoreSets = response.data || []
this.scoreSets = response.data?.scoreSets || []
// reset published score sets search results when using search bar
this.publishedScoreSets = []
this.unpublishedScoreSets = []
Expand Down
2 changes: 1 addition & 1 deletion src/components/screens/PublicationIdentifierView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export default {
}
)
// TODO (#130) catch errors in response
this.scoreSets = response.data || []
this.scoreSets = response.data?.scoreSets || []

// reset published score sets search results when using search bar
this.publishedScoresets = []
Expand Down
2 changes: 1 addition & 1 deletion src/components/screens/ScoreSetCreator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2539,7 +2539,7 @@ export default {
}
)
// TODO (#130) catch errors in response
return response.data || []
return response.data?.scoreSets || []
} catch (err) {
console.log(`Error while loading search results")`, err)
return []
Expand Down
2 changes: 1 addition & 1 deletion src/components/screens/ScoreSetEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1753,7 +1753,7 @@ export default {
}
)
// TODO (#130) catch errors in response
return response.data || []
return response.data?.scoreSets || []
} catch (err) {
console.log(`Error while loading search results")`, err)
return []
Expand Down
Loading