Skip to content

Commit

Permalink
Link to new BFM databases, rework outgoing links so support multiple
Browse files Browse the repository at this point in the history
  • Loading branch information
milot-mirdita committed Jun 24, 2024
1 parent c4b9644 commit edc0b80
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 30 deletions.
43 changes: 40 additions & 3 deletions frontend/ResultView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,29 @@
</div>

<template slot="content" v-if="hits && hits.results">
<!-- hack to get a menu that can be used from outside the list -->
<!-- we don't want to make potentially thousands of menus -->
<v-menu offset-y ref="menuwrapper" absolute>
<template v-slot:activator="{ on: activation, attrs: attrs }">
<div style="display: none">{{ menuActivator = activation }}</div>
</template>
<v-list>
<v-list-item two-line
v-for="(item, index) in menuItems"
:key="index"
:href="item.href"
target="_blank"
rel="noopener"
>
<v-list-item-content>
<v-list-item-title>{{ item.label }}</v-list-item-title>
<v-list-item-subtitle>
{{ item.accession }}
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
</v-list>
</v-menu>
<v-tabs
:color="selectedDatabases > 0 ? hits.results[selectedDatabases - 1].color : null"
center-active
Expand Down Expand Up @@ -165,7 +188,8 @@
<template v-if="isComplex">
{{ item.query.lastIndexOf('_') != -1 ? item.query.substring(item.query.lastIndexOf('_')+1) : '' }} ➔
</template>
<a :href="item.href" target="_blank" rel="noopener" :title="item.target">{{item.target}}</a>
<a style="text-decoration: underline; color: #2196f3;" v-if="Array.isArray(item.href)" @click="forwardDropdown($event, item.href)"rel="noopener" :title="item.target">{{item.target}} Ext</a>
<a v-else :href="item.href" target="_blank" rel="noopener" :title="item.target">{{item.target}}</a>
</td>
<td class="long" data-label="Description" v-if="entry.hasDescription">
<span :title="item.description">{{ item.description }}</span>
Expand Down Expand Up @@ -248,7 +272,9 @@ export default {
activeTarget: null,
alnBoxOffset: 0,
selectedDatabases: 0,
tableMode: 0
tableMode: 0,
menuActivator: null,
menuItems: [],
}
},
props: {
Expand All @@ -262,6 +288,11 @@ export default {
beforeDestroy() {
window.removeEventListener("resize", this.handleAlignmentBoxResize);
},
mounted() {
this.$nextTick(() => {
console.log(this.menuActivator);
});
},
computed: {
mode() {
return this.hits ? this.hits.mode : "";
Expand Down Expand Up @@ -326,7 +357,13 @@ export default {
if (this.activeTarget != null) {
this.alnBoxOffset = getAbsOffsetTop(this.activeTarget) + this.activeTarget.offsetHeight;
}
}, 32, false)
}, 32, false),
forwardDropdown(event, items) {
if (this.menuActivator) {
this.menuItems = items;
this.menuActivator.click(event);
}
}
}
};
</script>
Expand Down
84 changes: 57 additions & 27 deletions frontend/Utilities.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,68 @@
import { Selection, Matrix4 } from 'ngl';

function tryLinkTargetToDB(target, db) {
var res = db.toLowerCase();
if (res.startsWith("pfam")) {
return 'https://www.ebi.ac.uk/interpro/entry/pfam/' + target;
} else if (res.startsWith("pdb")) {
return 'https://www.rcsb.org/pdb/explore.do?structureId=' + target.replaceAll(/-assembly[0-9]+/g, '').replaceAll(/\.(cif|pdb)(\.gz)?/g, '').split('_')[0];
} else if (res.startsWith("uniclust") || res.startsWith("uniprot") || res.startsWith("sprot") || res.startsWith("swissprot")) {
return 'https://www.uniprot.org/uniprot/' + target;
} else if (res.startsWith("eggnog_")) {
return 'http://eggnogdb.embl.de/#/app/results?target_nogs=' + target;
} else if (res.startsWith("cdd")) {
return 'https://www.ncbi.nlm.nih.gov/Structure/cdd/cddsrv.cgi?uid=' + target;
}

if (__APP__ == "foldseek") {
if (target.startsWith("AF-")) {
return 'https://www.alphafold.ebi.ac.uk/entry/' + target.replaceAll(/-F[0-9]+-model_v[0-9]+(\.(cif|pdb))?(\.gz)?(_[A-Z0-9]+)?$/g, '');
} else if (target.startsWith("GMGC")) {
return 'https://gmgc.embl.de/search.cgi?search_id=' + target.replaceAll(/\.(cif|pdb)(\.gz)?/g, '')
} else if (target.startsWith("MGYP")) {
return 'https://esmatlas.com/explore/detail/' + target.replaceAll(/\.(cif|pdb)(\.gz)?/g, '')
try {
var res = db.toLowerCase();
if (res.startsWith("pfam")) {
return 'https://www.ebi.ac.uk/interpro/entry/pfam/' + target;
} else if (res.startsWith("pdb")) {
return 'https://www.rcsb.org/pdb/explore.do?structureId=' + target.replaceAll(/-assembly[0-9]+/g, '').replaceAll(/\.(cif|pdb)(\.gz)?/g, '').split('_')[0];
} else if (res.startsWith("uniclust") || res.startsWith("uniprot") || res.startsWith("sprot") || res.startsWith("swissprot")) {
return 'https://www.uniprot.org/uniprot/' + target;
} else if (res.startsWith("eggnog_")) {
return 'http://eggnogdb.embl.de/#/app/results?target_nogs=' + target;
} else if (res.startsWith("cdd")) {
return 'https://www.ncbi.nlm.nih.gov/Structure/cdd/cddsrv.cgi?uid=' + target;
}

if (res.startsWith("cath")) {
if (target.startsWith('af_')) {
const cath = target.substring(target.lastIndexOf('_') + 1);
return "https://www.cathdb.info/version/latest/superfamily/" + cath;
} else {
return "https://www.cathdb.info/version/latest/domain/"+ target;
if (__APP__ == "foldseek") {
if (target.startsWith("AF-")) {
let accession = target.replaceAll(/-F[0-9]+-model_v[0-9]+(\.(cif|pdb))?(\.gz)?(_[A-Z0-9]+)?$/g, '');
accession = accession.substring(3);
return [
{ label: 'AFDB', accession: accession, href:'https://www.alphafold.ebi.ac.uk/entry/' + accession },
{ label: 'UniProt', accession: accession, href: 'https://www.uniprot.org/uniprot/' + accession },
];
} else if (target.startsWith("GMGC")) {
return 'https://gmgc.embl.de/search.cgi?search_id=' + target.replaceAll(/\.(cif|pdb)(\.gz)?/g, '')
} else if (target.startsWith("MGYP")) {
return 'https://esmatlas.com/explore/detail/' + target.replaceAll(/\.(cif|pdb)(\.gz)?/g, '')
} else if (target.startsWith("LevyLab_")) {
let accession = target.split('_')[1];
return [
{ label: 'AFDB', accession: accession, href:'https://www.alphafold.ebi.ac.uk/entry/' + accession },
{ label: 'UniProt', accession: accession, href: 'https://www.uniprot.org/uniprot/' + accession },
];
} else if ( target.startsWith("ProtVar_")) {
let accession1 = target.split('_')[1];
let accession2 = target.split('_')[2];
let result = [
{ label: 'AFDB', accession: accession1, href:'https://www.alphafold.ebi.ac.uk/entry/' + accession1 },
{ label: 'UniProt', accession: accession1, href: 'https://www.uniprot.org/uniprot/' + accession1 },
];
if (accession1 != accession2) {
result.push({ label: 'AFDB', accession: accession2, href:'https://www.alphafold.ebi.ac.uk/entry/' + accession2 });
result.push({ label: 'UniProt', accession: accession2, href: 'https://www.uniprot.org/uniprot/' + accession2 });
}
return result;
} else if (target.startsWith("ModelArchive_")) {
return 'https://modelarchive.org/doi/10.5452/' + target.split('_')[1];
} else if (target.startsWith("Predictome_")) {
return 'https://predictomes.org/summary/' + target.split('_')[1];
}
if (res.startsWith("cath")) {
if (target.startsWith('af_')) {
const cath = target.substring(target.lastIndexOf('_') + 1);
return "https://www.cathdb.info/version/latest/superfamily/" + cath;
} else {
return "https://www.cathdb.info/version/latest/domain/"+ target;
}
}
}
return null;
} catch (e) {
return null;
}
return null;
}

function tryFixTargetName(target, db) {
Expand Down

0 comments on commit edc0b80

Please sign in to comment.