Commit 8c35c9e0 authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion

Merge branch '146-kegg-details' into 'dev'

Use new fields for KEGG details

Closes #146

See merge request !67
parents 27fbcb9a e0f295f7
Pipeline #35733 passed with stages
in 3 minutes and 46 seconds
This diff is collapsed.
from factory import DjangoModelFactory, Faker, fuzzy
from factory import Faker, fuzzy
from factory.django import DjangoModelFactory
from metagenedb.apps.catalog import models
......
from factory import (
DjangoModelFactory, Faker, RelatedFactory, SubFactory, fuzzy
Faker, RelatedFactory, SubFactory, fuzzy
)
from factory.django import DjangoModelFactory
from metagenedb.apps.catalog import models
......
from collections import OrderedDict
from factory import DjangoModelFactory, fuzzy
from factory import fuzzy
from factory.django import DjangoModelFactory
from faker import Factory
from metagenedb.apps.catalog import models
......
......@@ -55,7 +55,7 @@ export default {
},
{
title: 'Name(s)',
content: response.data.name,
content: response.data.names.join(),
},
{
title: 'Definition',
......@@ -65,12 +65,33 @@ export default {
},
buildKeggExpandDetails(response) {
this.keggExpandDetails = [
this.buildEcNumbers(response),
this.buildPathways(response),
this.buildDiseases(response),
this.buildModules(response),
this.buildReferences(response),
];
},
buildEcNumbers(response) {
var ec_numbers = {
title: 'EC numbers',
icon: 'fas fa-exchange-alt',
content: [],
};
if(response.data.ec_numbers) {
Object.entries(response.data.ec_numbers).forEach(([key, value]) => {
var link_id = value.split('.-')[0]
ec_numbers.content.push(
{
id: value,
url: `https://www.ebi.ac.uk/intenz/query?cmd=SearchEC&ec=${link_id}`,
url_label: "Open in IntEnz",
},
);
});
}
return ec_numbers;
},
buildPathways(response) {
var pathways = {
title: 'Pathways',
......@@ -139,14 +160,33 @@ export default {
};
if (response.data.references) {
for (let i = 0; i < response.data.references.length; i++) {
references.content.push(
{
id: response.data.references[i].title,
name: `${response.data.references[i].authors[0]} et al. ${response.data.references[i].journal}`,
url: `https://www.ncbi.nlm.nih.gov/pubmed/${response.data.references[i].pubmed_id}`,
url_label: "Open in Pubmed"
},
);
var url = null
if (response.data.references[i].doi){
var url = `https://doi.org/${response.data.references[i].doi}`;
var url_label = "Open in doi.org";
}
else if (response.data.references[i].pubmed_id) {
var url = `https://www.ncbi.nlm.nih.gov/pubmed/${response.data.references[i].pubmed_id}`;
var url_label = "Open in Pubmed";
}
if (url) {
references.content.push(
{
id: response.data.references[i].title,
name: `${response.data.references[i].authors[0]} et al. ${response.data.references[i].journal}`,
url: url,
url_label: url_label,
},
);
}
else {
references.content.push(
{
id: response.data.references[i].title,
name: `${response.data.references[i].authors[0]} et al. ${response.data.references[i].journal}`,
},
);
}
};
}
return references;
......
......@@ -28,14 +28,41 @@
<v-list-tile-sub-title v-html="item.content.name"></v-list-tile-sub-title>
</v-list-tile-content>
<v-list-tile-action>
<v-tooltip top>
<template v-slot:activator="{ on }">
<v-btn :href="item.url" flat icon class="primary--text" target="_blank" v-on="on">
<v-icon>open_in_new</v-icon>
</v-btn>
<v-speed-dial
direction="left"
transition="scale-transition"
>
<template v-slot:activator>
<v-tooltip top>
<template v-slot:activator="{ on }">
<v-btn
icon
flat
v-on="on"
>
<v-icon>open_in_new</v-icon>
</v-btn>
</template>
<span>Visit NCBI Taxonomy</span>
</v-tooltip>
</template>
<span>Visit NCBI taxonomy</span>
</v-tooltip>
<v-tooltip top>
<template v-slot:activator="{ on }">
<v-btn :href="item.url_info" icon class="mr-3" target="_blank" v-on="on">
<v-icon>fas fa-info</v-icon>
</v-btn>
</template>
<span>Info</span>
</v-tooltip>
<v-tooltip top>
<template v-slot:activator="{ on }">
<v-btn :href="item.url_tree" icon class="mr-3" target="_blank" v-on="on">
<v-icon>fa-sitemap</v-icon>
</v-btn>
</template>
<span>Tree</span>
</v-tooltip>
</v-speed-dial>
</v-list-tile-action>
</v-list-tile>
</template>
......
......@@ -22,7 +22,7 @@ export default {
},
})
.then((response) => {
const ncbi_tax_url = 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?id=';
const ncbi_tax_url = 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?';
this.taxonomyDetail = [
{
title: 'Superkingdom',
......@@ -67,7 +67,8 @@ export default {
];
this.taxonomyDetail.forEach((item, index) => {
if (item.content) {
item.url = ncbi_tax_url + item.content.tax_id;
item.url_info = ncbi_tax_url + "mode=info&id=" + item.content.tax_id;
item.url_tree = ncbi_tax_url + "mode=tree&id=" + item.content.tax_id;
}
});
})
......
Markdown is supported
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