indra_network_search/static/netSearch.js
// Function to put stmts from path in a HTML format with linkouts
Function to put stmts from path in a HTML format with linkouts
Function to put stmts from path in a HTML format with linkouts
function generatePathLinkout(pathArray) {
  let htmlString = '';
  for (let edgeDict of pathArray) {
    if (Object.keys(edgeDict).length > 0) {
      let subj = edgeDict.subj;
      let obj = edgeDict.obj;
      htmlString += `<h5><b>${subj} &rarr; ${obj}</b><span class="float-right">Statement types: ${(Object.keys(edgeDict).length-2).toString()}</span></h5>`;
      for (let stmt_type in edgeDict) {
        if ((stmt_type !== 'subj') && (stmt_type !== 'obj') && (stmt_type !== 'weight_to_show')) {
          let agentsString = '';
          if (stmt_type.toLowerCase() === 'complex') agentsString = `agent0=${subj}&agent1=${obj}&`;
          else agentsString = `subject=${subj}&object=${obj}&`;
          let dbLink = INDRA_DB_URL_AGENTS + agentsString + `type=${stmt_type}&ev_limit=1`;
          let sourceBadges = generateSourceBadges(edgeDict[stmt_type]);
          htmlString += '<a href="' + dbLink + '" target="_blank">' + subj + ', ' +
            stmt_type + ', ' + obj + '</a>' + sourceBadges + '<br>'
        }
      }
    }
  }
  return htmlString.substring(0, htmlString.length-4); 
}
function generatePathLinkout ( pathArray ) { let htmlString = '' ; for ( let edgeDict of pathArray ) { if ( Object . keys ( edgeDict ) . length > 0 ) { let subj = edgeDict . subj ; let obj = edgeDict . obj ; htmlString += ` ${ subj } ${ obj } ${ ( Object . keys ( edgeDict ) . length - 2 ) . toString ( ) } ` ; for ( let stmt_type in edgeDict ) { if ( ( stmt_type !== 'subj' ) && ( stmt_type !== 'obj' ) && ( stmt_type !== 'weight_to_show' ) ) { let agentsString = '' ; if ( stmt_type . toLowerCase ( ) === 'complex' ) agentsString = ` ${ subj } ${ obj } ` ; else agentsString = ` ${ subj } ${ obj } ` ; let dbLink = INDRA_DB_URL_AGENTS + agentsString + ` ${ stmt_type } ` ; let sourceBadges = generateSourceBadges ( edgeDict [ stmt_type ] ) ; htmlString += '<a href="' + dbLink + '" target="_blank">' + subj + ', ' + stmt_type + ', ' + obj + '</a>' + sourceBadges + '<br>' } } } } return htmlString . substring ( 0 , htmlString . length - 4 ) ; }
Function to put stmts from path in a HTML format with linkouts
Function to put stmts from path in a HTML format with linkouts
// Build an html string of the paths // pathArray is a list of dicts for each edge in the path: // pathArray[i] gives a dict for the support of edge i // pathArray[i][stmt type j] is a list of all statements of type j supporting edge i // pathArray[i][stmt type j][k] is statement k of type j supporting edge i // let dbLink = ''; // if (stmt.stmt_hash.startsWith('http')) dbLink = stmt.stmt_hash; // ?subject=BRCA1&object=BRCA2&type=activation&ev_limit=1 // Cut out the last <br>