Skip to content

Commit

Permalink
#743 Commit introduce json to evidenceview.
Browse files Browse the repository at this point in the history
  • Loading branch information
lawal-olaotan committed Jun 25, 2023
1 parent 73a6e18 commit 64a5ccb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
function getEvidencesLegend( evidenceTable )
{
var types = evidenceTable.map ( row => row [ 0 ] )
var types = evidenceTable.map ( row => row.conceptType );

var eviLegend = new Map();
// Iterate through evidence types and get counts for each evidence Concept Type.
Expand Down
34 changes: 17 additions & 17 deletions client-base/src/main/webapp/html/javascript/evidence-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,12 @@ async function openGeneListPopup(conceptId, element)
let accessionCache = new WebCacheWrapper('accession-cache', request);
let accessionData = await accessionCache.get();

// TODO: to be replaced, see the function's comments.
fixGenomeTables2OldStrings ( accessionData )

if ( accessionData ){
var geneTable = accessionData.geneTable.split("\n").slice(1,-1)
// TODO: WAITING TO CONFIRM IF THIS APPROACH IS ALLOWED
var geneTable = geneTable2OldString(accessionData.geneTable);

geneTable = geneTable.split("\n").slice(1,-1);

var accessionPopup = new AccessionPopupManager(element, conceptId, geneTable);
accessionPopup.showPopup()
}
Expand Down Expand Up @@ -421,31 +422,31 @@ function createEvidenceTableBody ( tableData, doAppend = false )
const fromRow = evidenceTableScroller.getPageStart ()
const toRow = evidenceTableScroller.getPageEnd ()

for (var ev_i = fromRow; ev_i < toRow; ev_i++)
tableData.forEach( (evidence,index) =>
{
[type, nodeLabel,,pvalue,genes, geneList,,conceptId,genesCount, ...nonUsedValues] = tableData[ev_i];
let {conceptType, name, pvalue, totalGenesSize, geneList, ondexId, userGenesSize, userGeneAccessions } = evidence

// Prefer this templating style, at least for new code
// Also, avoid "x = x + ...", it's more verbose than +=, especially when
// it's needed many times.
//
tableBody +=`<tr>
<td>
<p onclick="evidenceTableExcludeKeyword(${conceptId},this,event)" id="evidence_exclude_${ev_i}" style="padding-right:10px;" class="excludeKeyword evidenceTableExcludeKeyword" title="Exclude term"></p>
<p onclick="evidenceTableAddKeyword(${conceptId},this,event)" id="evidence_add_${ev_i}" class="addKeyword evidenceTableAddKeyword" title="Add term"></p>
<p onclick="evidenceTableExcludeKeyword(${ondexId},this,event)" id="evidence_exclude_${index}" style="padding-right:10px;" class="excludeKeyword evidenceTableExcludeKeyword" title="Exclude term"></p>
<p onclick="evidenceTableAddKeyword(${ondexId},this,event)" id="evidence_add_${index}" class="addKeyword evidenceTableAddKeyword" title="Add term"></p>
</td>`;

//link publications with pubmed
var evidenceValue;
if (type == 'Publication')
if (conceptType == 'Publication')
{
pubmedurl = 'http://www.ncbi.nlm.nih.gov/pubmed/?term=';
evidenceValue = '<a href="' + pubmedurl + nodeLabel.substring(5) + '" target="_blank">' + nodeLabel + '</a>';
evidenceValue = '<a href="' + pubmedurl + name.substring(5) + '" target="_blank">' + name + '</a>';
}
else
evidenceValue = nodeLabel;
evidenceValue = name;

tableBody += ` <td type-sort-value="${type}"><div class="evidence_item evidence_item_${type}" title="${type}"></div></td>\n`;
tableBody += ` <td type-sort-value="${conceptType}"><div class="evidence_item evidence_item_${conceptType}" title="${conceptType}"></div></td>\n`;
tableBody += ` <td>${evidenceValue}</td>\n`;

// p-values
Expand All @@ -460,14 +461,14 @@ function createEvidenceTableBody ( tableData, doAppend = false )


// Count of all matching genes
tableBody += ` <td ><span style="margin-right:.5rem;">${genes}</span> <span data-type="${type}" data-description="${nodeLabel}" class="accession-download" onclick="openGeneListPopup(${conceptId},this)"><i class="fas fa-file-download"></i></span> <div id="concept${conceptId}"></div></td>\n`;
tableBody += ` <td ><span style="margin-right:.5rem;">${totalGenesSize}</span> <span data-type="${conceptType}" data-description="${name}" class="accession-download" onclick="openGeneListPopup(${ondexId},this)"><i class="fas fa-file-download"></i></span> <div id="concept${ondexId}"></div></td>\n`;

// launch evidence network with them, if they're not too many.
tableBody += ` <td><button data-genelist="${geneList}" style="${geneList == 0 ? 'text-decoration:none;': null}" onclick="evidencePath(${conceptId},this,${genesCount})" class="userGenes_evidenceNetwork" title="Display in KnetMaps" id="userGenes_evidenceNetwork_${ev_i}">${genesCount}</button></td>\n`;
tableBody += ` <td><button data-genelist="${userGenesSize}" style="${geneList == 0 ? 'text-decoration:none;': null}" onclick="evidencePath(${ondexId},this,${totalGenesSize})" class="userGenes_evidenceNetwork" title="Display in KnetMaps" id="userGenes_evidenceNetwork_${index}">${userGenesSize}</button></td>\n`;

var select_evidence = `<input onchange="updateSelectedGenesCount('evidences', '#evidence-count', 'Term');" id="checkboxEvidence_${ev_i}" type="checkbox" name= "evidences" value="${conceptId}:${geneList}">`;
var select_evidence = `<input onchange="updateSelectedGenesCount('evidences', '#evidence-count', 'Term');" id="checkboxEvidence_${index}" type="checkbox" name= "evidences" value="${ondexId}:${userGeneAccessions}">`;
tableBody += ` <td>${select_evidence}</td>\n`; // eviView select checkbox
}
})

if ( tableBody )
{
Expand Down Expand Up @@ -499,7 +500,6 @@ class AccessionPopupManager
*/
#htmlNode = null

//
#conceptId = null
#accessionData = null
#tableNode = null;
Expand Down

0 comments on commit 64a5ccb

Please sign in to comment.