Skip to content

Commit

Permalink
Merge branch 'egonw-feature/chemicalStructure'
Browse files Browse the repository at this point in the history
  • Loading branch information
fnielsen committed Oct 26, 2023
2 parents 8dce24f + dad8244 commit 59c26fa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
9 changes: 9 additions & 0 deletions scholia/app/static/scholia.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ function convertDataTableData(data, columns) {
var column = columns[i];
if (column.slice(-11) == 'Description') {
convertedColumns.push(column.slice(0, column.length - 11) + ' description');
} else if (column.slice(-17) == 'ChemicalStructure') {
convertedColumns.push(column.slice(0, column.length - 17) + ' structure');
} else if (column.slice(-5) == 'Label') {
// pass
} else if (column.slice(-3) == 'Url') {
Expand All @@ -107,6 +109,13 @@ function convertDataTableData(data, columns) {
data[i][key + 'Url'] +
'">' + data[i][key + 'Label'] + '</a>';

} else if (key.slice(-17) == 'ChemicalStructure') {
convertedRow[key.slice(0, key.length - 17) + ' structure'] = '<img loading="lazy" src="' +
'https://cdkdepict.toolforge.org/depict/bow/svg?smi=' +
encodeURIComponent(data[i][key]) +
'&abbr=on&hdisp=bridgehead&showtitle=false&zoom=2&annotate=cip' +
'" />';

} else if (
key + 'Label' in data[i] &&
/^http/.test(data[i][key]) &&
Expand Down
7 changes: 5 additions & 2 deletions scholia/app/templates/taxon_metabolome.sparql
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
PREFIX target: <http://www.wikidata.org/entity/{{ q }}>

SELECT DISTINCT
?metabolite ?metaboliteLabel ?metaboliteDescription
?metabolite ?metaboliteLabel ?metaboliteChemicalStructure ?metaboliteDescription
WITH {
SELECT DISTINCT ?children WHERE {
?children (wdt:P171*) target:.
}
} AS %taxa
WITH {
SELECT DISTINCT ?metabolite WHERE {
SELECT DISTINCT ?metabolite ?metaboliteChemicalStructure WHERE {
INCLUDE %taxa
{ ?metabolite wdt:P703 ?children }
UNION
{ ?metabolite wdt:P1582 ?children }
VALUES ?chemical { wd:Q11173 wd:Q59199015 wd:Q56256086 wd:Q15711994 }.
?metabolite wdt:P31|wdt:P279/wdt:P31 ?chemical .
OPTIONAL { ?metabolite wdt:P233 ?canSmiles }
OPTIONAL { ?metabolite wdt:P2017 ?isoSmiles }
BIND(COALESCE(?isoSmiles, ?canSmiles) AS ?metaboliteChemicalStructure)
}
} AS %results {
INCLUDE %results
Expand Down

0 comments on commit 59c26fa

Please sign in to comment.