Skip to content
Snippets Groups Projects
Commit 9e67786a authored by HongKee Moon's avatar HongKee Moon
Browse files

Close #8

Evidence Stars on Protein Table in Condensate Detail Page
parent add0fe1d
No related branches found
No related tags found
No related merge requests found
......@@ -14,17 +14,31 @@
let table;
function getRatingValue(data) {
const scoreMap = {'hungarian': 5, 'blue': 5, 'pink': 1, 'grey': 1}
const scoreMap = { 'http://llps.biocuckoo.cn/': 1,
'http://db.phasep.pro/browse/highthroughput/': 2,
'http://db.phasep.pro/browse/reviewed/': 4,
'http://db.phasep.pro/browse/uniprotreviewed/': 4,
'http://bio-comp.ucas.ac.cn/': 4,
'https://phasepro.elte.hu/': 4,
'https://pubmed.ncbi.nlm.nih.gov/': 4 }
function getStartWith(url) {
let ret = ''
_.forEach(_.keys(scoreMap), i => {
if(url.startsWith(i)) {
ret = i;
}
})
return ret
}
function getRatingValue(data) {
return _.max(_.map(data, i => scoreMap[i]));
}
function getRating(data) {
const scoreMap = {'hungarian': 5, 'blue': 5, 'pink': 1, 'grey': 1}
const rating = _.max(_.map(data, i => scoreMap[i]));
// console.log(rating);
const rating = _.max(_.map(data, i => scoreMap[getStartWith(i)]));
const r = ['<div style="white-space: nowrap;">']
for (let i = 0; i < 5; i++) {
if (i < rating) {
......@@ -60,6 +74,11 @@
// console.log(url)
window.open(url)
},
createLink(link) {
return `<a href="" class="uniprot-link tooltipped tooltipped-n tooltipped-multiline"
aria-label="Clicking this link opens Evidence page."> ${link}
</a>`
},
createTable(id, data) {
const vm = this;
......@@ -173,7 +192,7 @@
let data = vm.map[oData.uniprot_id];
if(data) {
// $(nTd).html(data.filter(a => a.startsWith('http')).join('\n'));
$(nTd).html(data.join('\n'));
$(nTd).html(data.map(i => vm.createLink(i)).join('<br/>'));
}
}
},
......@@ -207,15 +226,14 @@
title: 'Evidence Stars',
className: "text-nowrap",
data: 'uniprot_id',
render: function ( data, type, row, meta ) {
// console.log(_.flatMap(row.condensates, c => c.data_sources))
if(row.condensates) {
return getRatingValue(vm.map[row.uniprot_id]);
}
return '';
},
// render: function ( data, type, row, meta ) {
// // console.log(_.flatMap(row.condensates, c => c.data_sources))
// if(row.condensates) {
// return getRatingValue(vm.map[row.uniprot_id]);
// }
// return '';
// },
fnCreatedCell: (nTd, sData, oData) => {
// console.log(sData)
let data = vm.map[oData.uniprot_id];
if(data) {
$(nTd).html(getRating(data).join('\n'));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment