@@ -227,7 +227,7 @@ function parsePwAnnotations(entitiesById, keys, ontology) {
227227 return pwAnnotations ;
228228}
229229
230- function getPathwayAnnotations ( pathwayJson ) {
230+ export function getPathwayAnnotations ( pathwayJson , selectedOntology ) {
231231 const entitiesById = pathwayJson . entitiesById ;
232232 const keys = Object . keys ( entitiesById ) . filter ( k => k . startsWith ( 'http://identifiers.org' ) ) ;
233233 const sentenceCases = {
@@ -238,12 +238,19 @@ function getPathwayAnnotations(pathwayJson) {
238238 'Disease'
239239 // 'Pathway Ontology' // maybe later
240240 ] ;
241- const pathwayAnnotationsList = ontologies . map ( ontology => {
241+ let selectedOntologies = ontologies ;
242+ if ( selectedOntology ) {
243+ selectedOntologies = ontologies . find (
244+ ontology => ontology . toLowerCase ( ) === selectedOntology . toLowerCase ( )
245+ ) ;
246+ }
247+ const pathwayAnnotationsList = selectedOntologies . map ( ontology => {
242248 const pwAnnotations = parsePwAnnotations ( entitiesById , keys , ontology ) ;
243249 const links = pwAnnotations . map ( pwa => {
244250 const id = pwa . xrefIdentifier . replace ( ':' , '_' ) ;
245251 const url = `https://purl.obolibrary.org/obo/${ id } ` ;
246- return `<a href="${ url } " target="_blank">${ pwa . term } </a>` ;
252+ const cls = 'class="_ideoPathwayOntologyLink"' ;
253+ return `<a href="${ url } " target="_blank" ${ cls } >${ pwa . term } </a>` ;
247254 } ) . join ( ', ' ) ;
248255
249256 const refinedOntology = sentenceCases [ ontology ] ?? ontology ;
@@ -281,9 +288,10 @@ export function getPathwayGenes() {
281288}
282289
283290
284- function addFooter ( pathwayJson , pathwayContainer ) {
291+ function addFooter ( pathwayJson , pathwayContainer , showOntologies ) {
285292 const description = getDescription ( pathwayJson ) ;
286- const pathwayAnnotations = getPathwayAnnotations ( pathwayJson ) ;
293+ const pathwayAnnotations =
294+ showOntologies ? getPathwayAnnotations ( pathwayJson ) : '' ;
287295 const footer =
288296 `<br/>` +
289297 `<div class="_ideoPathwayFooter">` +
@@ -303,6 +311,7 @@ export async function drawPathway(
303311 geneNodeHoverFn ,
304312 pathwayNodeClickFn ,
305313 showDescription ,
314+ showOntologies ,
306315 showDefaultTooltips ,
307316 retryAttempt = 0
308317) {
@@ -394,7 +403,7 @@ export async function drawPathway(
394403 addHeader ( pwId , pathwayJson , pathwayContainer , showClose ) ;
395404
396405 if ( showDescription ) {
397- addFooter ( pathwayJson , pathwayContainer ) ;
406+ addFooter ( pathwayJson , pathwayContainer , showOntologies ) ;
398407 }
399408
400409 // zoomToEntity(sourceEntityId);
0 commit comments