<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.3.4">Jekyll</generator><link href="https://chem-bla-ics.linkedchemistry.info/feed/by_tag/javascript.xml" rel="self" type="application/atom+xml" /><link href="https://chem-bla-ics.linkedchemistry.info/" rel="alternate" type="text/html" /><updated>2026-03-08T13:54:44+00:00</updated><id>https://chem-bla-ics.linkedchemistry.info/feed/by_tag/javascript.xml</id><title type="html">chem-bla-ics</title><subtitle>Chemblaics (pronounced chem-bla-ics) is the science that uses open science and computers to solve problems in chemistry, biochemistry and related fields.</subtitle><author><name>Egon Willighagen</name></author><entry><title type="html">The April 2025 Scholia hackathon</title><link href="https://chem-bla-ics.linkedchemistry.info/2025/04/20/the-april-2025-scholia-hackathon.html" rel="alternate" type="text/html" title="The April 2025 Scholia hackathon" /><published>2025-04-20T00:00:00+00:00</published><updated>2025-04-20T00:00:00+00:00</updated><id>https://chem-bla-ics.linkedchemistry.info/2025/04/20/the-april-2025-scholia-hackathon</id><content type="html" xml:base="https://chem-bla-ics.linkedchemistry.info/2025/04/20/the-april-2025-scholia-hackathon.html"><![CDATA[<p>This is the third weekend I am working on Scholia, the first two part of the <a href="https://www.wikidata.org/wiki/Wikidata:Scholia/Events/Hackathon_April_2025#Participants">April 2025 hackathon</a>. It follows the hackathons
last year <a href="https://www.wikidata.org/wiki/Wikidata:Scholia/Events/Hackathon_October_2024">October</a> and
<a href="https://chem-bla-ics.linkedchemistry.info/2024/11/17/sparql-examples.html">November</a> hackathons.
There is some urgency for this unpaid work, because Wikidata is splitting the RDF into two
SPARQL endpoints (see <a href="https://en.wikipedia.org/wiki/Wikipedia:Wikipedia_Signpost/2024-05-16/Op-Ed">this The Signpost</a>
and <a href="https://finnaarupnielsen.wordpress.com/2024/10/18/scholia-in-the-age-of-the-wikidata-query-service-split/">this post by Finn</a>).
This split has happened, but there is a <em>legacy</em> server for tools that have not been upgraded.</p>

<p>Scholia has not been upgraded. It has more then 350 SPARQL queries, and each one has to be tested
separately and updating every query is not trivial. Together with Daniel, Finn, and others, I have
hacked up patches last year to:</p>

<ul>
  <li><a href="https://chem-bla-ics.linkedchemistry.info/2024/08/23/scholia.html">configure Scholia for the endpoint to use</a></li>
  <li><a href="https://chem-bla-ics.linkedchemistry.info/2024/11/17/sparql-examples.html">create pages for many Scholia SPARQL queries</a></li>
</ul>

<p>This month I continued working on the second, and I:</p>

<ul>
  <li><a href="https://github.com/WDscholia/scholia/pull/2597">added titles for chemistry aspect panels</a></li>
  <li><a href="https://github.com/WDscholia/scholia/pull/2589">use the legacy SPARQL endpoint</a></li>
</ul>

<p>That second also indicated that the legacy server has more limited resources and users will more
quickly run into error messages that too many queries are run in parallel. Now, users can rerun
the query, but then the results table contains the previous error message. Second, you want to run
the queries for one aspect to not run all at the same time, but have Scholia send of the
query when the panel becomes visible (and scrolling a page takes a bit of time).</p>

<p>For these issues, I wrote these two patches (yet to be approven and merged):</p>

<ul>
  <li><a href="https://github.com/WDscholia/scholia/pull/2608">delete the previous error message</a></li>
  <li><a href="https://github.com/WDscholia/scholia/pull/2611">lazy load the table and iframe panels</a></li>
</ul>

<p>Now, the iframes already had some aspects of lazy loading, but it turned out that it was mostly
lazy display, and the queries were still run as soon as possible. This last patch challenged my
JavaScript skills and I learned <code class="language-plaintext highlighter-rouge">Intersection Observer API</code>, a browser technology that allows
the browser to see what part of the webpage you are looking at right now. Yeah, I can easily
see how that does user profiling, but in this case it is just used to fire of the SPARQL
query when it become relevant. It uses an additional callback function, so I had to
make sure Jekyll/Liquid creates custom callback functions for each panel.
Actually, I intended to show the code here, but I am not entirely sure how to escape
the code so that Jekyll does not try to run the instructions. For now, you have to
<a href="https://github.com/WDscholia/scholia/pull/2611/files">check the PR</a>.</p>

<h2 id="scholia-chemistry-paper">Scholia Chemistry paper</h2>

<p>The other things I have been doing, is finally finish up the Scholia Chemistry paper.
That actually depended on the maturing of various tools, me figuring out how to characterize
the actual amount of content contributed to Wikidata and how to make that transparent,
and more recently, the above to be able to convince readers Scholia will not die with
the graph split. With the above pages, we have, I think, sufficient guarantee it will
be around for another few years, at least.</p>

<p>This paper, which I hope to finish the final draft today, applying
some good feedback from co-author last weekend, is the final bit of work done on
the Alfred P. Sloan Foundation grant.</p>

<p>We intend to put the paper up as preprint soon and then submit it do a Diamond Open Access
journal, one that supports CiTO citation intent annotation.</p>]]></content><author><name>Egon Willighagen</name></author><category term="scholia" /><category term="javascript" /><category term="sparql" /><summary type="html"><![CDATA[This is the third weekend I am working on Scholia, the first two part of the April 2025 hackathon. It follows the hackathons last year October and November hackathons. There is some urgency for this unpaid work, because Wikidata is splitting the RDF into two SPARQL endpoints (see this The Signpost and this post by Finn). This split has happened, but there is a legacy server for tools that have not been upgraded.]]></summary></entry><entry><title type="html">ISAAC Chrome Extension</title><link href="https://chem-bla-ics.linkedchemistry.info/2025/01/04/isaac-browser-extension.html" rel="alternate" type="text/html" title="ISAAC Chrome Extension" /><published>2025-01-04T00:00:00+00:00</published><updated>2025-01-04T00:00:00+00:00</updated><id>https://chem-bla-ics.linkedchemistry.info/2025/01/04/isaac-browser-extension</id><content type="html" xml:base="https://chem-bla-ics.linkedchemistry.info/2025/01/04/isaac-browser-extension.html"><![CDATA[<p>In 2022 I had my first experience with the <a href="https://isaac.nwo.nl/">ISAAC database</a>
by the Dutch <a href="https://www.nwo.nl/">NWO</a> research funding organization. ISAAC is
where you apply for funding and where grants get tracked. As such, research output
is recorded in this database.</p>

<p>The list of supported research output types in ISAAC is a bit dated, but includes
scientific articles, books and monographs, book chapters, PhD theses, conference
proceedings papers, professional publications, publications aimed at a broad audience,
patents, contracts, and other. With <a href="https://recognitionrewards.nl/">Recognition &amp; Rewards</a>
in mind, this list should
be more diverse. And clearly missing are software and data, because these are
already supported by global unique identifiers and dedicated efforts for
software citations and data citations. FAIR has progressed a lot for these two
types.</p>

<p>When entering new research output to a project in ISAAC, you get asked to fill
out various HTML forms. For articles, each author is a separate HTML form. All
in all, quite a bit of work. But with unique identifiers and open APIs, it is a
waste of research funding to have to enter this all by hand. Some time earlier
I heard of browser plugins in the USA that automagically filled out those forms,
and realized I wanted that too.</p>

<p>Fortunately, Lars Willighagen had done much of the work already with
<a href="https://citation.js.org/">citation.js</a> (doi:<a href="https://doi.org/10.7717/peerj-cs.214">10.7717/peerj-cs.214</a>),
a JavaScript library that can convert formats like BibTeX into formatted references
(with <a href="https://citationstyles.org/">Citation Style Language</a> and
<a href="https://citeproc-js.readthedocs.io/">citeproc-js</a>), but also can support various
identifiers to fetch bibliographic metadata. All we needed is to integrate that.
And so the <a href="https://chromewebstore.google.com/detail/ISAAC%20Chrome%20extension/kiljfbiapahlahhilgcgfkfjnkgggode?hl=en-GB&amp;authuser=0">ISAAC Chrome extension</a>
was born. But the history, technology, and use has not been written up, while we
have a solid base of some 50 users who regularly use it. And one user <a href="https://chromewebstore.google.com/detail/isaac-chrome-extension/kiljfbiapahlahhilgcgfkfjnkgggode/reviews">wrote</a>:</p>

<blockquote>
  <p>Werkt geweldig. [..] dit de enige manier waarop publicaties redelijk ingevoerd kunnen worden.</p>
</blockquote>

<p>Actually, maybe we should rename the extension to <em>ISAAC Browser Extenaion</em>,
because it also works in Brave and Edge.</p>

<h2 id="2025-updates">2025 updates</h2>

<p>The last update had been a while, and we got reports of some changes on the ISAAC
database side, and we could confirm at least one of the HTML form identifiers had
changed, so we fixed filling out the Open Access status of output. This is released
as <a href="https://github.com/citation-js/isaac-chrome-extension/releases/tag/v1.5.0">version 1.5.0</a>
(doi:<a href="https://doi.org/10.5281/zenodo.14562484">10.5281/zenodo.14562484</a>).</p>

<p>Another change is that the ISAAC database now supports listing the <a href="https://orcid.org/">ORCID</a>
identifier of authors, and this metadata is increasingly available from research
output metadata, and <a href="https://github.com/citation-js/isaac-chrome-extension/commit/8306809803ef93f448645fc4ca8c55d4c9bb7c6b">a single line change</a> was enough for Lars to update the extension
to automatically fill that out too. This is FAIR in action. This version is released
as <a href="https://github.com/citation-js/isaac-chrome-extension/releases/tag/v1.6.0">version 1.6.0</a>
(doi:<a href="https://doi.org/10.5281/zenodo.14562504">10.5281/zenodo.14562504</a>) and should
be available from the webstore soon.</p>

<h2 id="how-it-works">How it works</h2>

<p>While the ISAAC database does not have an API, at least we found sufficient hooks
in the HTML to get a reproducible workflow. The foundation of the browser extension
is global unique identifiers, and it supports DOIs, ISBNs, and PubMed identifiers
for research output. For authors, it supports the ORCID. To fetch the metadata,
it uses online resources Crossref, DataCite, and mEDRA, Google Books and OpenLibrary,
PubMed and Unpaywall. The first three to fetch metadata for DOIs, the next two for
ISBN numbers, and PubMed for, well, PubMed identifiers. Based on the retrieved
metadata it determines which type of research output it should fill out the HTML
for.</p>

<p><a href="https://unpaywall.org/">Unpaywall</a> is used to see if the output is, for example,
published in a purely open access venue (like a CC-BY-only journal like <a href="https://elifesciences.org/">eLife</a>
or Nature’s <a href="https://www.nature.com/sdata/">Scientific Data</a>), or published in a
hybrid journal. The ISAAC database does not have the option to drop a URL (which
could be automated with Unpaywall too), but does allow uploading documents into
their database. This last is left to the user.</p>

<h2 id="how-to-use-it">How to use it</h2>

<p>Users would install the browser extension and this would add an add-on icon to
the toolbar. The <img src="/assets/images/icon.svg" width="16" alt="Icon: Black serif font 'I' on a background of four colored squares: brown, gold, green and platinum" /> icon shows the various colors of Open Access with an <code class="language-plaintext highlighter-rouge">I</code>, for
identifier. The user would then login on the ISAAC database, open their project
grant page, and navigate to the Product tab:</p>

<p><img src="/assets/images/isaac2025_1.png" alt="" /></p>

<p>To use the extension, the user would take the following steps.
First, click the “Toevoegen” button, green-blue with white letters in the above
screenshot. This would give a page like this:</p>

<p><img src="/assets/images/isaac2025_2.png" alt="" /></p>

<p>Second, and optionally, click one of the types. The metadata retrieved by the extension
contains sufficient information to make the right guess, so that this step is optional.
If you find that the metadata is wrong and the wrong guess was made, in this step
you can first manually indicate the research output type.</p>

<p>Third, one the page with the above screenshot (or, optionally, after indicating
the output type), click the ISAAC Chrome Extension icon in the browser toolbar
to give a popup dialog:</p>

<p><img src="/assets/images/isaac2025_3.png" alt="" /></p>

<p>Fourth, select the identifier type (DOI, ISBN, or PubMed) and give the identifier
itself, and then click Search. For example, for a DOI, it would look like this:</p>

<p><img src="/assets/images/isaac2025_4.png" alt="" /></p>

<p>Fifth, the plugin will then guide you through the ISAAC HTML forms, just like you
would do manually, but with the important difference that some forms show in different
order. But rest assured, it will not submit anything before your final approval.
For example, for a journal article I would immediate fo to the HTML form for the
first author, which, for a random article, could look like this:</p>

<p><img src="/assets/images/isaac2025_5.png" alt="" /></p>

<p>By clicking “Verder”, the browser extension allows you to add missing metadata
(for example, the ORCID is not listed for this author in the CrossRef metadata
and the gender is not shared by the publisher), and sometimes you may find yourself
needing to correct metadata.</p>

<p>Sixth, after going through all author pages, you will return to the main product
form, which will look something like this (for a random paper):</p>

<p><img src="/assets/images/isaac2025_6.png" alt="" /></p>

<p>Here you can add the final missing information and upload additional files, like
a PDF of the article. In the above screenshot we find some required (red asterix)
missing. In this case, the DOI referred to an article published as “as soon as
publishable” and the page numbers and issue is simply not known yet. You can also
see the Unpaywall metadat in action here.</p>

<p>Seven, like before, the final submission of this new output is done manually.
The ISAAC Chrome Extension requires that manual step; on purpose: you are in control.</p>]]></content><author><name>Egon Willighagen</name></author><category term="javascript" /><category term="cito:usesMethodIn:10.7717/peerj-cs.214" /><category term="doi:10.5281/ZENODO.14562484" /><category term="doi:10.5281/ZENODO.14562504" /><summary type="html"><![CDATA[In 2022 I had my first experience with the ISAAC database by the Dutch NWO research funding organization. ISAAC is where you apply for funding and where grants get tracked. As such, research output is recorded in this database.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://chem-bla-ics.linkedchemistry.info/assets/images/isaac2025_1.png" /><media:content medium="image" url="https://chem-bla-ics.linkedchemistry.info/assets/images/isaac2025_1.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Programming in the Life Sciences #6: functions</title><link href="https://chem-bla-ics.linkedchemistry.info/2013/10/12/programming-in-life-sciences-6-functions.html" rel="alternate" type="text/html" title="Programming in the Life Sciences #6: functions" /><published>2013-10-12T00:00:00+00:00</published><updated>2013-10-12T00:00:00+00:00</updated><id>https://chem-bla-ics.linkedchemistry.info/2013/10/12/programming-in-life-sciences-6-functions</id><content type="html" xml:base="https://chem-bla-ics.linkedchemistry.info/2013/10/12/programming-in-life-sciences-6-functions.html"><![CDATA[<p>One key feature of programming languages is the following: first, there is linearity. This is an important point
that is not always clear to students who just start to program. In fact, ask yourself what the algorithm is for
counting the chairs in the room where you are now sitting. Could a computer do that in the same way? How should
your algorithm change? A key point is, is that the program is run step by step, in a linear way.</p>

<p>However, we very easily jump to functions. In fact, we use so many libraries nowadays, this linearity is not so
clear anymore. Things just happen with magic library calls. But at the same time, the library calls make our life
a lot easier: by using functions, we group functionality in easy to read and easier to understand blobs.</p>

<p>OK, the previous example showed that we could use the HTML <code class="language-plaintext highlighter-rouge">@onClick</code> attribute to provide further detail.
But I did not show how. This is how:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nx">html</span> <span class="o">+=</span> <span class="dl">"</span><span class="s2">Name: &lt;span onClick=</span><span class="se">\"</span><span class="s2">showDetails('</span><span class="dl">"</span> <span class="o">+</span>
  <span class="nf">escape</span><span class="p">(</span><span class="nx">dataJSON</span><span class="p">)</span> <span class="o">+</span> <span class="dl">"</span><span class="se">\</span><span class="s2">')</span><span class="se">\"</span><span class="s2">&gt;</span><span class="dl">"</span> <span class="o">+</span> 
  <span class="nx">response</span><span class="p">[</span><span class="nx">i</span><span class="p">].</span><span class="nx">prefLabel</span> <span class="o">+</span> <span class="dl">"</span><span class="s2">&lt;/span&gt;</span><span class="dl">"</span><span class="p">;</span>
</code></pre></div></div>

<p>This code adds the <code class="language-plaintext highlighter-rouge">@onClick</code> attribute and a function call to the <code class="language-plaintext highlighter-rouge">showDetails()</code> method which takes one parameter,
where we pass escaped JSON. That is non-trivial, I understand, and may be due to my limited knowledge of JavaScript.
The escaping of the JSON is needed to make quotes match in the generated HTML. In the function later, we can unescape
it and get the original JSON again. Importantly, the dataJSON data contains all the details I like to show.</p>

<p>Now, this functions needs to be defined. Yes, plural, because two functions are used in this code snippet: <code class="language-plaintext highlighter-rouge">showDetails()</code>
and <code class="language-plaintext highlighter-rouge">escape()</code>. The last is defined by one of the used libraries. The <code class="language-plaintext highlighter-rouge">showDetails()</code> function, however, I made up.
So, I had to define it elsewhere in the HTML document, and it looks like:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">var</span> <span class="nx">showDetails</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">dataJSON</span><span class="p">){</span>
  <span class="nx">data</span> <span class="o">=</span> <span class="nx">JSON</span><span class="p">.</span><span class="nf">parse</span><span class="p">(</span><span class="nf">unescape</span><span class="p">(</span><span class="nx">dataJSON</span><span class="p">));</span>
  <span class="nb">document</span><span class="p">.</span><span class="nf">getElementById</span><span class="p">(</span><span class="dl">"</span><span class="s2">details</span><span class="dl">"</span><span class="p">).</span><span class="nx">innerHTML</span> <span class="o">=</span>
    <span class="nx">data</span><span class="p">.</span><span class="nx">_about</span><span class="p">;</span>
<span class="p">};</span>
</code></pre></div></div>

<p>This example actually gives the exact same output as the code in the previous post, but with one major difference.
We now can extend the function as much as we like, but the code to output the list of found compounds does not have
to get more complex than it already is.</p>]]></content><author><name>Egon Willighagen</name></author><category term="pra3006" /><category term="javascript" /><category term="html" /><summary type="html"><![CDATA[One key feature of programming languages is the following: first, there is linearity. This is an important point that is not always clear to students who just start to program. In fact, ask yourself what the algorithm is for counting the chairs in the room where you are now sitting. Could a computer do that in the same way? How should your algorithm change? A key point is, is that the program is run step by step, in a linear way.]]></summary></entry><entry><title type="html">Programming in the Life Sciences #4: communication from within HTML</title><link href="https://chem-bla-ics.linkedchemistry.info/2013/10/09/programming-in-life-sciences-4.html" rel="alternate" type="text/html" title="Programming in the Life Sciences #4: communication from within HTML" /><published>2013-10-09T00:00:00+00:00</published><updated>2013-10-09T00:00:00+00:00</updated><id>https://chem-bla-ics.linkedchemistry.info/2013/10/09/programming-in-life-sciences-4</id><content type="html" xml:base="https://chem-bla-ics.linkedchemistry.info/2013/10/09/programming-in-life-sciences-4.html"><![CDATA[<p>The purpose of a web service is that you give it a question or task, and that it returns an answer. For example, we can ask the
<a href="http://www.openphacts.org/">Open PHACTS</a> platform what compounds it knows with aspirin in the name. We pass the question (with the
<a href="http://chem-bla-ics.blogspot.nl/2013/10/programming-in-life-sciences-2-accounts.html">API key</a>) and get a list of matching compounds.
Now, this communication is complex: it happens at many levels, which are spelled out in the
<a href="https://en.wikipedia.org/wiki/Internet_model">Internet Model</a>. There are various variants of the stack of communication layers,
but we are interested mostly in the top layers, at the <em>application layer</em>. In fact, for this course this model only serves as
supporting information for those who want to learn more.</p>

<p>Practically, what matters here is how to ask the question and how to understand the answer.</p>

<p>We are supported in these practicalities with JavaScript libraries, in particular the <a href="https://github.com/openphacts/ops.js">ops.js</a>
library and general <a href="https://en.wikipedia.org/wiki/JSON">JSON</a> functionality provided by most browsers (unless the student decided to use
a <em>different</em> programming language, in which there are different libraries). Personally, I have only very limited JavaScript experience,
and this mostly goes back to the good old <a href="http://www.biomedcentral.com/1471-2105/8/487">Userscript and Greasemonkey days</a> (wow! the
paper is actually the <a href="http://www.altmetric.com/details.php?citation_id=103983">4th highest scoring BMC Bioinformatics article!</a>).
But because my JavaScript knowledge is limited and rusty, I spent a good part of today, to get a basic example running. Very basic,
and barely exceeding the communication details. That is, this is the output in the browser:</p>

<p><img src="/assets/images/mcspils_jsonOutput.png" alt="" /></p>

<p>So, what does the question look like? The question is actually hardcoded in the HTML source, but the page does take two parameters:
the <code class="language-plaintext highlighter-rouge">app_key</code> and <code class="language-plaintext highlighter-rouge">app_id</code> that come <a href="http://chem-bla-ics.blogspot.nl/2013/10/programming-in-life-sciences-2-accounts.html">with your Open PHACTS account</a>.</p>

<p>The ops.js library helps us, and wraps the Open PHACTS LDA methods in JavaScript methods. Thus, rather can crafting special HTTP calls,
we use two JavaScript calls:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">var</span> <span class="nx">searcher</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Openphacts</span><span class="p">.</span><span class="nc">ConceptWikiSearch</span><span class="p">(</span>
  <span class="dl">"</span><span class="s2">https://beta.openphacts.org</span><span class="dl">"</span><span class="p">,</span>
  <span class="nx">params</span><span class="p">[</span><span class="dl">"</span><span class="s2">app_id</span><span class="dl">"</span><span class="p">],</span> <span class="nx">params</span><span class="p">[</span><span class="dl">"</span><span class="s2">app_key</span><span class="dl">"</span><span class="p">]</span>
<span class="p">);</span>
<span class="nx">searcher</span><span class="p">.</span><span class="nf">byTag</span><span class="p">(</span>
  <span class="dl">'</span><span class="s1">Aspirin</span><span class="dl">'</span><span class="p">,</span> <span class="dl">'</span><span class="s1">20</span><span class="dl">'</span><span class="p">,</span> <span class="dl">'</span><span class="s1">4</span><span class="dl">'</span><span class="p">,</span> <span class="dl">'</span><span class="s1">07a84994-e464-4bbf-812a-a4b96fa3d197</span><span class="dl">'</span><span class="p">,</span>
  <span class="nx">callback</span>
<span class="p">);</span>
</code></pre></div></div>

<p>The first statement creates an LDA method object, while the second makes an actual question. I have not defined the callback variable,
which actually is a JavaScript function that looks like:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">var</span> <span class="nx">callback</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">success</span><span class="p">,</span> <span class="nx">status</span><span class="p">,</span> <span class="nx">response</span><span class="p">){</span>
  <span class="kd">var</span> <span class="nx">result</span> <span class="o">=</span> <span class="nx">searcher</span><span class="p">.</span><span class="nf">parseResponse</span><span class="p">(</span><span class="nx">response</span><span class="p">);</span>
  <span class="nb">document</span><span class="p">.</span><span class="nf">getElementById</span><span class="p">(</span><span class="dl">"</span><span class="s2">output</span><span class="dl">"</span><span class="p">).</span><span class="nx">innerHTML</span> <span class="o">=</span>
    <span class="dl">"</span><span class="s2">Results: </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">JSON</span><span class="p">.</span><span class="nf">stringify</span><span class="p">(</span><span class="nx">result</span><span class="p">);</span>
<span class="p">};</span>
</code></pre></div></div>

<p>When the LDA web service returns data, this method gets called, providing asynchronous functionality to keep the web page responsive.
But when called, it first parses the returned data, and then puts the JSON output as text in the HTML. The output that is given in
the earlier screenshot.</p>

<p>So, hurdle taken. From here on it’s easier. Regular looping over the results, creating some HTML output, etc. The
<a href="https://gist.github.com/egonw/6902776">full source code</a> if this example is available as Gist.</p>]]></content><author><name>Egon Willighagen</name></author><category term="pra3006" /><category term="javascript" /><category term="html" /><category term="openphacts" /><category term="doi:10.1186/1471-2105-8-487" /><summary type="html"><![CDATA[The purpose of a web service is that you give it a question or task, and that it returns an answer. For example, we can ask the Open PHACTS platform what compounds it knows with aspirin in the name. We pass the question (with the API key) and get a list of matching compounds. Now, this communication is complex: it happens at many levels, which are spelled out in the Internet Model. There are various variants of the stack of communication layers, but we are interested mostly in the top layers, at the application layer. In fact, for this course this model only serves as supporting information for those who want to learn more.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://chem-bla-ics.linkedchemistry.info/assets/images/mcspils_jsonOutput.png" /><media:content medium="image" url="https://chem-bla-ics.linkedchemistry.info/assets/images/mcspils_jsonOutput.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Programming in the Life Sciences #5: converting the results into HTML</title><link href="https://chem-bla-ics.linkedchemistry.info/2013/10/09/programming-in-life-sciences-5.html" rel="alternate" type="text/html" title="Programming in the Life Sciences #5: converting the results into HTML" /><published>2013-10-09T00:00:00+00:00</published><updated>2013-10-09T00:00:00+00:00</updated><id>https://chem-bla-ics.linkedchemistry.info/2013/10/09/programming-in-life-sciences-5</id><content type="html" xml:base="https://chem-bla-ics.linkedchemistry.info/2013/10/09/programming-in-life-sciences-5.html"><![CDATA[<p>Now that we have <a href="http://chem-bla-ics.blogspot.nl/2013/10/programming-in-life-sciences-4.html">the communication working</a>
with the Open PHACTS LDA, it is time to make a nice GUI. I will not go into details, but we can use basic JavaScript to
iterate over the JSON results, and, for example, create a HTML table:</p>

<p><img src="/assets/images/mscpils1_output.png" alt="" /></p>

<p>In fact, I hooked in some HTML <code class="language-plaintext highlighter-rouge">onClick()</code> functionality so that when you click one of the compound names, you get further
details (under <em>Compound Details</em>), though that only outputs the ConceptWiki URI at this moment. A simple for-loop does
the heavy work:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nx">html</span> <span class="o">=</span> <span class="dl">"</span><span class="s2">&lt;table&gt;</span><span class="dl">"</span><span class="p">;</span>
<span class="k">for </span><span class="p">(</span><span class="kd">var</span> <span class="nx">i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span> <span class="nx">i</span><span class="o">&lt;</span><span class="nx">response</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
  <span class="nx">html</span> <span class="o">+=</span> <span class="dl">"</span><span class="s2">&lt;tr&gt;</span><span class="dl">"</span><span class="p">;</span>
  <span class="nx">html</span> <span class="o">+=</span> <span class="dl">"</span><span class="s2">&lt;td&gt;</span><span class="dl">"</span><span class="p">;</span>
  <span class="nx">dataJSON</span> <span class="o">=</span> <span class="nx">JSON</span><span class="p">.</span><span class="nf">stringify</span><span class="p">(</span><span class="nx">response</span><span class="p">[</span><span class="nx">i</span><span class="p">]);</span>
  <span class="c1">//   dataJSON.replace(/"/g, "'");</span>
  <span class="nx">html</span> <span class="o">+=</span> <span class="dl">"</span><span class="s2">Name: &lt;span&gt;</span><span class="dl">"</span> <span class="o">+</span> <span class="nx">response</span><span class="p">[</span><span class="nx">i</span><span class="p">].</span><span class="nx">prefLabel</span> <span class="o">+</span> <span class="dl">"</span><span class="s2">&lt;/span&gt;</span><span class="dl">"</span><span class="p">;</span>
  <span class="nx">html</span> <span class="o">+=</span> <span class="dl">"</span><span class="s2">&lt;/td&gt;</span><span class="dl">"</span><span class="p">;</span>
  <span class="nx">html</span> <span class="o">+=</span> <span class="dl">"</span><span class="s2">&lt;/tr&gt;</span><span class="dl">"</span><span class="p">;</span>
<span class="p">}</span>
<span class="nx">html</span> <span class="o">+=</span> <span class="dl">"</span><span class="s2">&lt;/table&gt;</span><span class="dl">"</span><span class="p">;</span>
<span class="nb">document</span><span class="p">.</span><span class="nf">getElementById</span><span class="p">(</span><span class="dl">"</span><span class="s2">table</span><span class="dl">"</span><span class="p">).</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="nx">html</span><span class="p">;</span>
</code></pre></div></div>

<p>So, we’re set to teach the students all the basics of programming: loops, variables, functions, etc.</p>]]></content><author><name>Egon Willighagen</name></author><category term="pra3006" /><category term="html" /><category term="javascript" /><summary type="html"><![CDATA[Now that we have the communication working with the Open PHACTS LDA, it is time to make a nice GUI. I will not go into details, but we can use basic JavaScript to iterate over the JSON results, and, for example, create a HTML table:]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://chem-bla-ics.linkedchemistry.info/assets/images/mscpils1_output.png" /><media:content medium="image" url="https://chem-bla-ics.linkedchemistry.info/assets/images/mscpils1_output.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Programming in the Life Sciences #2: accounts and API keys</title><link href="https://chem-bla-ics.linkedchemistry.info/2013/10/08/programming-in-life-sciences-2-accounts.html" rel="alternate" type="text/html" title="Programming in the Life Sciences #2: accounts and API keys" /><published>2013-10-08T00:00:00+00:00</published><updated>2013-10-08T00:00:00+00:00</updated><id>https://chem-bla-ics.linkedchemistry.info/2013/10/08/programming-in-life-sciences-2-accounts</id><content type="html" xml:base="https://chem-bla-ics.linkedchemistry.info/2013/10/08/programming-in-life-sciences-2-accounts.html"><![CDATA[<p>I have outlined the scope of the <a href="http://chem-bla-ics.blogspot.nl/2013/10/programming-in-life-sciences-1-six-day.html">six-day course</a>:
the students will learn to program while hacking on the <a href="https://dev.openphacts.org/docs">Open PHACTS’ Linked Data API</a> (LDA). The first
step is to get an account for the LDA. I have already done that to save time. But these are the steps to take. You go to
<a href="https://dev.openphacts.org/signup">https://dev.openphacts.org/signup</a>:</p>

<p><img src="/assets/images/gscholar1.png" alt="" /></p>

<p>You then approve the account via your email account and you are set. The account is needed to get an API key. Using this key,
Open PHACTS developers can contact you if your scripts go berserk  So, you are kindly invited to make crazy hypotheses and hack the
hell out of the platform. That’s what I hope my students will do.</p>

<p>To try your new key, go to the documentation page, and open, for example, the <em>SMILES to URL</em> method:</p>

<p><img src="/assets/images/mscpils.png" alt="" /></p>

<p>Here you can see what parameters this LDA method has. We focus now on the <code class="language-plaintext highlighter-rouge">app_id</code> and <code class="language-plaintext highlighter-rouge">app_key</code> fields. Each account comes by default
with a, um, default <code class="language-plaintext highlighter-rouge">app_id</code> and default <code class="language-plaintext highlighter-rouge">app_key</code>. Just click on the field and select them:</p>

<p><img src="/assets/images/mscpils1.png" alt="" /></p>

<p>Select the defaults and enter a SMILES (try: <a href="https://apps.ideaconsult.net:8080/ambit2/depict?search=CC(=O)NC1=CC=C(C=C1)O">CC(=O)NC1=CC=C(C=C1)O)</a>).
You can select the format you like (I like Turtle) and you get Linked Data back on this <a href="https://rdf.chemspider.com/1906">compound</a>.</p>

<p>Now, go explore the LDA methods.</p>]]></content><author><name>Egon Willighagen</name></author><category term="pra3006" /><category term="openphacts" /><category term="javascript" /><category term="rest" /><summary type="html"><![CDATA[I have outlined the scope of the six-day course: the students will learn to program while hacking on the Open PHACTS’ Linked Data API (LDA). The first step is to get an account for the LDA. I have already done that to save time. But these are the steps to take. You go to https://dev.openphacts.org/signup:]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://chem-bla-ics.linkedchemistry.info/assets/images/gscholar1.png" /><media:content medium="image" url="https://chem-bla-ics.linkedchemistry.info/assets/images/gscholar1.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Programming in the Life Sciences #1: a six day course</title><link href="https://chem-bla-ics.linkedchemistry.info/2013/10/05/programming-in-life-sciences-1-six-day.html" rel="alternate" type="text/html" title="Programming in the Life Sciences #1: a six day course" /><published>2013-10-05T00:00:00+00:00</published><updated>2013-10-05T00:00:00+00:00</updated><id>https://chem-bla-ics.linkedchemistry.info/2013/10/05/programming-in-life-sciences-1-six-day</id><content type="html" xml:base="https://chem-bla-ics.linkedchemistry.info/2013/10/05/programming-in-life-sciences-1-six-day.html"><![CDATA[<p>Our <a href="http://www.bigcat.unimaas.nl/">department</a> will soon start the course Programming in the Life Sciences for a group of some
10 students from the <a href="http://www.maastrichtuniversity.nl/web/Schools/MaastrichtScienceProgramme.htm">Maastricht Science Programme</a>.
This is the first time we give this course, and over the next weeks I will be blogging about this course. First, some information.
These are the goals, to use programming to:</p>

<ul>
  <li>have the ability to recognize various classes of chemical entities in pharmacology and to understand the basic physical and chemical interactions.</li>
  <li>be familiar with technologies for web services in the life sciences.</li>
  <li>obtain experience in using such web services with a programming language.</li>
  <li>be able to select web services for a particular pharmacological question.</li>
  <li>have sufficient background for further, more advanced, bioinformatics data analyses.</li>
</ul>

<p>So, this course will be a mix of things. I will likely start with a lecture or too about scientific programming, such as the
importance of reproducibility, licensing, documentation, and (unit) testing. To achieve these learning goals we have set a
problem. The description is:</p>

<blockquote>
  <p>In the life sciences the interactions between chemical entities is of key interest. Not only do these play an important role
in the regulation of gene expression, and therefore all cellular processes, they are also one of the primary approaches in
drug discovery. Pharmacology is the science studies the action of drugs, and for many common drugs, this is studying the
interaction of small organic molecules and protein targets.</p>

  <p>And with the increasing information in the life sciences, automation becomes increasingly important. Big data and small data
alike, provide challenges to integrate data from different experiments. The Open PHACTS platform provides web services to
support pharmacological research and in this course you will learn how to use such web services from programming languages,
allowing you to link data from such knowledge bases to other platforms, such as those for data analysis.</p>
</blockquote>

<p>So, it becomes pretty clear what the students will be doing. They only have six days, so it won’t be much. It’s just to learn
them the basic skills. The students are in their 3rd year at the university, and because of the nature of the programme they
follow, a mixed background in biology, mathematics, chemistry, and physics. So, I have a good hope they will surprise me in
what they will get done.</p>

<p>Pharmacology is the basic topic: drug-protein interaction, but the students are free to select a research question. In fact,
I will not care that much what they like to study, as long as they do it properly. They will start with
<a href="https://dev.openphacts.org/docs">Open PHACTS’ Linked Data API</a>, but here too, they are free to complement data from the
OPS cache with additional information. I hope they do.</p>

<p>Now, regarding the technology they will use. The default will be JavaScript, and in the next week I will hack up demo code
showing the integration of <a href="https://github.com/openphacts/ops.js">ops.js</a> and <a href="http://d3js.org/">d3.js</a>.
Let’s see how hard it will be; it’s new to me too. But, if the students
already are familiar with another programming language and prefer to use that, I won’t stop them.</p>

<p>(For the Dutch readers, would #mscpils be a good tag?)</p>]]></content><author><name>Egon Willighagen</name></author><category term="pra3006" /><category term="javascript" /><category term="openphacts" /><summary type="html"><![CDATA[Our department will soon start the course Programming in the Life Sciences for a group of some 10 students from the Maastricht Science Programme. This is the first time we give this course, and over the next weeks I will be blogging about this course. First, some information. These are the goals, to use programming to:]]></summary></entry><entry><title type="html">The Molecular Chemometrics Principles #3: stand on shoulders</title><link href="https://chem-bla-ics.linkedchemistry.info/2010/08/14/molecular-chemometrics-principles-3.html" rel="alternate" type="text/html" title="The Molecular Chemometrics Principles #3: stand on shoulders" /><published>2010-08-14T00:00:00+00:00</published><updated>2010-08-14T00:00:00+00:00</updated><id>https://chem-bla-ics.linkedchemistry.info/2010/08/14/molecular-chemometrics-principles-3</id><content type="html" xml:base="https://chem-bla-ics.linkedchemistry.info/2010/08/14/molecular-chemometrics-principles-3.html"><![CDATA[<p>I have blogged about two Molecular Chemometrics principles so far:</p>

<ul>
  <li><a href="https://chem-bla-ics.linkedchemistry.info/2010/08/09/molecular-chemometrics-principles-1.html">McPrinciple #1: access to data</a></li>
  <li><a href="https://chem-bla-ics.linkedchemistry.info/2010/08/12/molecular-chemometrics-principles-2-be.html">McPrinciple #2: be clear in what you mean</a></li>
</ul>

<p>Peter’s post <a href="https://blogs.ch.cam.ac.uk/pmr/2010/08/14/solo10-green-chain-reaction-where-to-store-the-data-dsr-ir-biotorrent-okf-or/">#solo10: Green Chain Reaction; where to store the data? DSR? IR? BioTorrent, OKF or ??? <i class="fa-solid fa-recycle fa-xs"></i></a>
gives me enough basis to write up a third principle:</p>

<p><strong>Molecular Chemometrics Principles #3</strong>: We make scientific progress if we build on past achievements.</p>

<p>Sounds logical, right? Practically, the way we share our cheminformatics knowledge makes this standing on shoulders pretty difficult.
But there is one particular aspect I would like to ask your attention for: you can contribute by making clear what shoulders
you would like to stand on. That is, where do you prefer to put your effort, and what message would you like to give to your user community.</p>

<p>In the aforelinked post, Peter asks where he should upload his data, and he suggest <a href="http://www.biotorrents.net/">BioTorrent</a> (see my review
<a href="http://chem-bla-ics.blogspot.com/2010/04/bittorrents-for-science.html">BitTorrents for Science</a>), DSpace, and <a href="http://www.ckan.net/">CKAN</a>.
Now, his <a href="http://www.google.se/search?sourceid=chrome&amp;client=ubuntu&amp;channel=cs&amp;ie=UTF-8&amp;q=%22Green+Chain+Reaction%22">Green Chain Reaction</a>
is picked up (see <a href="http://researchremix.wordpress.com/2010/08/11/green-chain-reaction-project-putting-my-minutes-where-my-mouth-is/">these</a>
<a href="http://scienceonlinelondon.wikidot.com/topics:green-chain-reaction">few</a> <a href="https://blogs.ch.cam.ac.uk/pmr/2010/08/14/solo10-green-chain-reaction-much-progress-and-continued-request-for-help/">blog <i class="fa-solid fa-recycle fa-xs"></i></a> posts),
and the resulting data should be distributed as much as possible. The exact location does not really matter…</p>

<p>But…</p>

<p>By picking where you upload, you make a statement to your community: “<em>Look guys, we are distributing our data via Foo, because we believe those guys are doing good work! Perhaps you can support them too.</em>”.</p>

<p>This principle does not only apply to data, it applies to things too. For example, when
<a href="http://www.chemspider.com/blog/ichemlabs-and-rsc-chemspider-announce-partnership.html">iChemLabs and RSC ChemSpider Announce Partnership</a>
they do not just improve the user experience of ChemSpider (which I certainly won’t object against), but they also imply
“<em>Look dudes, your product is just not good enough and we do not want to help you improve it either</em>”.
Of course, ChemSpider has every right, and for them to succeed it is crucial to make decisions like this. Fortunately,
<a href="http://web.chemdoodle.com/installation.php">ChemDoodle is GPL</a>.</p>

<p>Every project with a user base has the opportunity to support shoulders, if they only visibly stand on them. By merely discussion the
<em>Green Chain Reaction</em>, I show to support this social web experiment. You can too. Use these powers wisely. May the McPrinciples be with you.</p>]]></content><author><name>Egon Willighagen</name></author><category term="mcprinciples" /><category term="solo10" /><category term="chemdoodle" /><category term="chemspider" /><category term="javascript" /><summary type="html"><![CDATA[I have blogged about two Molecular Chemometrics principles so far:]]></summary></entry><entry><title type="html">New FriendFeed layout, but there is a fix…</title><link href="https://chem-bla-ics.linkedchemistry.info/2009/04/30/new-friendfeed-layout-but-there-is-fix.html" rel="alternate" type="text/html" title="New FriendFeed layout, but there is a fix…" /><published>2009-04-30T00:00:00+00:00</published><updated>2009-04-30T00:00:00+00:00</updated><id>https://chem-bla-ics.linkedchemistry.info/2009/04/30/new-friendfeed-layout-but-there-is-fix</id><content type="html" xml:base="https://chem-bla-ics.linkedchemistry.info/2009/04/30/new-friendfeed-layout-but-there-is-fix.html"><![CDATA[<p><a href="http://friendfeed.com/">FriendFeed</a> is the missing link between social [bookmarking|news|…] and <a href="http://en.wikipedia.org/wiki/Internet_Relay_Chat">IRC</a>
(#cdk on <a href="http://www.freenode.net/">irc.freenode.net</a>); I quite like it. Anyway, as of today, they have a new layout, and that I do not like. No more
icons for feed types, and big avatar photo’s. Really, I <em>know</em> what my fellow blogger look like (even met many of them
<a href="http://chem-bla-ics.blogspot.com/2008/08/science-blogging-2008-london-was-cool.html">in London last year</a>). The rest of
the layout is a bit too colourful for my taste.</p>

<p>Fortunately, <a href="http://nsaunders.wordpress.com/">Neil</a> posted <a href="http://friendfeed.com/neilfws/3c83a2e5/my-beta-ff-greasemonkey-suite-is-complete">three very useful</a>
<a href="http://en.wikipedia.org/wiki/Greasemonkey">GreaseMonkey</a> script to clean stuff (and since I use those to link science databases and resources anyway, see
<a href="https://chem-bla-ics.linkedchemistry.info/2007/12/21/christmas-presents.html">Christmas Presents <i class="fa-solid fa-recycle fa-xs"></i></a> and
DOI:<a href="http://dx.doi.org/10.1186/1471-2105-8-487">10.1186/1471-2105-8-487</a>): <a href="http://userscripts.org/scripts/show/46187#">FriendFeed Service Icons</a>,
<a href="http://userstyles.org/styles/16747">Cleaner FriendFeed</a>, and <a href="http://userstyles.org/styles/16763">Remove avatars from Friendfeed beta</a>.
The last may require the script target websites to no longer point to the beta server, but the real thing. However, by the time you read this,
the script may already be updated.</p>

<p>After installing these, my FriendFeed page looks better again:</p>

<p><img src="/assets/images/cleanFF.png" alt="" /></p>]]></content><author><name>Egon Willighagen</name></author><category term="friendfeed" /><category term="javascript" /><category term="doi:10.1186/1471-2105-8-487" /><summary type="html"><![CDATA[FriendFeed is the missing link between social [bookmarking|news|…] and IRC (#cdk on irc.freenode.net); I quite like it. Anyway, as of today, they have a new layout, and that I do not like. No more icons for feed types, and big avatar photo’s. Really, I know what my fellow blogger look like (even met many of them in London last year). The rest of the layout is a bit too colourful for my taste.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://chem-bla-ics.linkedchemistry.info/assets/images/cleanFF.png" /><media:content medium="image" url="https://chem-bla-ics.linkedchemistry.info/assets/images/cleanFF.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Bioclipse2 Scripting #2: searching PubChem</title><link href="https://chem-bla-ics.linkedchemistry.info/2009/02/21/bioclipse2-scripting-2-searching.html" rel="alternate" type="text/html" title="Bioclipse2 Scripting #2: searching PubChem" /><published>2009-02-21T00:00:00+00:00</published><updated>2009-02-21T00:00:00+00:00</updated><id>https://chem-bla-ics.linkedchemistry.info/2009/02/21/bioclipse2-scripting-2-searching</id><content type="html" xml:base="https://chem-bla-ics.linkedchemistry.info/2009/02/21/bioclipse2-scripting-2-searching.html"><![CDATA[<p>This week I have been porting the PubChem plugin for <a href="http://www.bioclipse.net/">Bioclipse</a> 1.2 to the new manager-based architecture. While still working on the Wizards,
you can run the following JavaScript in Bioclipse2 from SVN and from the next beta (*):</p>

<script src="https://gist.github.com/67462.js"></script>

<p>*) There was some confusion on the <em>two</em> beta Bioclipse2 releases so far. Some people expected a release without any bugs left. That release is what we planned to call a
<em>Release Candidate</em>. We agree that the first two betas at least turned out to be more alpha than we actually hoped, and we thank everyone who has given these releases a
go. Those who tried several development releases of Bioclipse2 saw a lot of ongoing development, and we are fixing
<a href="http://bugs.bioclipse.net/">any bug reported</a> on these releases. So, do not hesitate in reporting bugs!</p>

<p>Earlier in this series:</p>

<ul>
  <li><a href="https://chem-bla-ics.linkedchemistry.info/2008/10/25/bioclipse2-scripting-1-from-smiles-to.html">Bioclipse2 Scripting #1: from SMILES to a UFF optimized structure in Jmol <i class="fa-solid fa-recycle fa-xs"></i></a></li>
  <li><a href="https://chem-bla-ics.linkedchemistry.info/2008/11/04/next-generation-asynchronous.html">Next generation asynchronous webservices #2 <i class="fa-solid fa-recycle fa-xs"></i></a></li>
  <li><a href="https://chem-bla-ics.linkedchemistry.info/2008/11/20/scripting-jchempaint.html">Scripting JChemPaint <i class="fa-solid fa-recycle fa-xs"></i></a></li>
  <li><a href="https://chem-bla-ics.linkedchemistry.info/2009/02/15/bioclipse-for-cdk-developers-1.html">Bioclipse for CDK Developers #1 <i class="fa-solid fa-recycle fa-xs"></i></a></li>
</ul>]]></content><author><name>Egon Willighagen</name></author><category term="bioclipse" /><category term="pubchem" /><category term="javascript" /><summary type="html"><![CDATA[This week I have been porting the PubChem plugin for Bioclipse 1.2 to the new manager-based architecture. While still working on the Wizards, you can run the following JavaScript in Bioclipse2 from SVN and from the next beta (*):]]></summary></entry></feed>