<?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="http://egonw.github.io/blog/feed/by_tag/oscar.xml" rel="self" type="application/atom+xml" /><link href="http://egonw.github.io/blog/" rel="alternate" type="text/html" /><updated>2026-11-19T06:09:00+00:00</updated><id>http://egonw.github.io/blog/feed/by_tag/oscar.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">Text mining chemistry from Dutch or Swedish texts</title><link href="http://egonw.github.io/blog/2010/12/30/text-mining-chemistry-from-dutch-or.html" rel="alternate" type="text/html" title="Text mining chemistry from Dutch or Swedish texts" /><published>2010-12-30T00:10:00+00:00</published><updated>2010-12-30T00:10:00+00:00</updated><id>http://egonw.github.io/blog/2010/12/30/text-mining-chemistry-from-dutch-or</id><content type="html" xml:base="http://egonw.github.io/blog/2010/12/30/text-mining-chemistry-from-dutch-or.html"><![CDATA[<p><a href="http://oscar3-chem.sf.net/">Oscar</a> is a text miner. It mines in text for chemistry.
<a href="https://bitbucket.org/wwmm/oscar4/">Oscar4</a> is the next iteration of Oscar
code that I worked on in the past three months, with Lezan, Sam, and David. I blogged about
aspects of Oscar4 at several occasions:</p>

<ul>
  <li><a href="https://chem-bla-ics.linkedchemistry.info/2010/10/15/working-on-oscar-for-three-months.html">Working on Oscar for three months <i class="fa-solid fa-recycle fa-xs"></i></a></li>
  <li><a href="https://chem-bla-ics.linkedchemistry.info/2010/10/21/oscar-text-mining-in-taverna.html">Oscar text mining in Taverna <i class="fa-solid fa-recycle fa-xs"></i></a></li>
  <li><a href="https://chem-bla-ics.linkedchemistry.info/2010/10/26/multiple-unit-test-inheritance-with.html">Multiple unit test inheritance with JExample <i class="fa-solid fa-recycle fa-xs"></i></a></li>
  <li><a href="https://chem-bla-ics.linkedchemistry.info/2010/10/28/oscar4-java-api-chemical-name.html">Oscar4 Java API: chemical name dictionaries <i class="fa-solid fa-recycle fa-xs"></i></a></li>
  <li><a href="https://chem-bla-ics.linkedchemistry.info/2010/11/18/oscar4-command-line-utilities.html">Oscar4 command line utilities <i class="fa-solid fa-recycle fa-xs"></i></a></li>
  <li><a href="http://chem-bla-ics.blogspot.com/2010/11/installing-oscar.html">Installing Oscar</a></li>
  <li><a href="https://chem-bla-ics.linkedchemistry.info/2010/11/29/adding-new-dictionary-to-oscar.html">Adding a new dictionary to Oscar <i class="fa-solid fa-recycle fa-xs"></i></a></li>
  <li><a href="https://chem-bla-ics.linkedchemistry.info/2010/12/11/status-update-on-bjoc-analysis-with.html">Status update on BJOC analysis with Oscar and ChemicalTagger <i class="fa-solid fa-recycle fa-xs"></i></a></li>
  <li><a href="https://chem-bla-ics.linkedchemistry.info/2010/12/11/status-update-on-bjoc-analysis-with_11.html">Status update on BJOC analysis with Oscar and ChemicalTagger #2 <i class="fa-solid fa-recycle fa-xs"></i></a></li>
  <li><a href="https://chem-bla-ics.linkedchemistry.info/2010/12/11/supramolecular-chemistry.html">Supramolecular chemistry <i class="fa-solid fa-recycle fa-xs"></i></a></li>
  <li><a href="https://chem-bla-ics.linkedchemistry.info/2010/12/23/status-update-on-bjoc-analysis-with_23.html">Status update on BJOC analysis with Oscar and ChemicalTagger #3 <i class="fa-solid fa-recycle fa-xs"></i></a></li>
  <li><a href="https://chem-bla-ics.linkedchemistry.info/2010/12/26/oscar-training-data-models-etc.html">Oscar: training data, models, etc <i class="fa-solid fa-recycle fa-xs"></i></a></li>
</ul>

<p>These posts will server is a some initial critical mass for a draft report I plan to finish
today. I might have to blog some further posts with diagrams, here and there. This post is
actually one of them, and discusses something where Oscar can be expected to go next, now
that the design is cleaned up (though this effort is not halted now) and it has become
possible again to extend it. The over <a href="https://hudson.ch.cam.ac.uk/job/oscar4/lastBuild/testReport/">250 unit tests</a>
make this a lot easier too.</p>

<p>One aspect where I expect Oscar to go in 2011 is the support for other languages. To a very
large extend this is based on multi-language support in the dictionaries, as well as having
training data in a particular language. This also provides some context to my earlier post
about the <a href="https://chem-bla-ics.linkedchemistry.info/2010/12/26/oscar-training-data-models-etc.html">need for a Oscar training data repository <i class="fa-solid fa-recycle fa-xs"></i></a>.</p>

<p>This extension opens a number of options: analysis of patent literature in other languages,
monitoring of press releases in other languages, and news items in local news papers, etc.
For example, it could analyse <a href="http://www.c2w.nl/energierijke-gistcel.119621.lynkx">this C2W news item</a>
on <a href="http://en.wikipedia.org/wiki/Yeast">yeast</a> cells:</p>

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

<p>There are many use cases for such localized text mining. And it surely matters for determining
the impact of research.</p>

<p>Oscar has various places where language specifics are found. For example, in tokenization of a
text. One step here is the detection of sentence ends. This is done in most western languages
with a period, exclamation mark, question mark, etc. But periods (dots) are also used in
abbreviations. Similarly, colons can be used in chemical names. But the every language comes in
with different abbreviations that need to be recognized.</p>

<p>Currently, some abbreviations are found in <a href="https://bitbucket.org/wwmm/oscar4/src/005ffa00a69d/oscar4-core/src/main/java/uk/ac/cam/ch/wwmm/oscar/document/NonSentenceEndings.java">NonSentenceEndings</a>.
In the past three months, we have been cleaning up the code, and restructured the source code,
making it easier to detect such places. This class will likely undergo further refactoring, to
making the list of such non-sentence-endings configurable via files or so. What I expect to see,
is that we you initiate Oscar like this:</p>

<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nc">Oscar</span> <span class="n">oscar</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">Oscar</span><span class="o">(</span><span class="nc">Locale</span><span class="o">.</span><span class="na">US</span><span class="o">);</span>
</code></pre></div></div>

<p>This might actually even make a nice student summer project. The biggest challenge will be in making a good
corpus of training data, like the SciBorg training data that was used for training Oscar3.</p>

<p>But the whole normalization is tainted with English language specifics too. For example, the normalizer
will have to ‘normalize’ the question marks, for which there exist several
<a href="http://en.wikipedia.org/wiki/Question_mark#Stylistic_variants">unicode variations</a>.
But the normalized variant is language dependent. For example, greek and armenian have different characters
(see <a href="http://en.wikipedia.org/wiki/Question_mark#Opening_and_closing_question_marks">this page</a>),
and then we have not even started talking about the right to left.</p>

<p>Besides localized dictionaries, this Oscar will also benefit from a localized <a href="http://opsin.ch.cam.ac.uk/">OPSIN</a>.
It seem to recognize the Dutch <a href="https://opsin.ch.cam.ac.uk/opsin/propaan.png">propaan</a>, but not
<a href="https://opsin.ch.cam.ac.uk/opsin/benzeen.png">benzeen</a>. I am not going to look at that soon, but if you are
interested, I recommend checking out Rich’
<a href="https://doi.org/10.59350/bbrwt-e5n35">posts <i class="fa-solid fa-recycle fa-xs"></i></a>
<a href="https://doi.org/10.59350/vtadn-tdt17">about <i class="fa-solid fa-recycle fa-xs"></i></a>
<a href="https://doi.org/10.59350/nbtxd-kdz73">forking <i class="fa-solid fa-recycle fa-xs"></i></a>
OPSIN and writing patches.</p>

<p>Getting Oscar going for other languages is a challenge, but also offers new opportunities. Just email the
<a href="http://sourceforge.net/mailarchive/forum.php?forum_name=oscar3-chem-developers">oscar mailing list</a>
if you are interested and need help.</p>]]></content><author><name>Egon Willighagen</name></author><category term="oscar" /><category term="textmining" /><category term="justdoi:10.59350/vtadn-tdt17" /><category term="justdoi:10.59350/nbtxd-kdz73" /><category term="justdoi:10.59350/bbrwt-e5n35" /><summary type="html"><![CDATA[Oscar is a text miner. It mines in text for chemistry. Oscar4 is the next iteration of Oscar code that I worked on in the past three months, with Lezan, Sam, and David. I blogged about aspects of Oscar4 at several occasions:]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://egonw.github.io/blog/blog/assets/images/c2w.png" /><media:content medium="image" url="http://egonw.github.io/blog/blog/assets/images/c2w.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Blogging as part of your workflow</title><link href="http://egonw.github.io/blog/2010/12/30/blogging-as-part-of-your-workflow.html" rel="alternate" type="text/html" title="Blogging as part of your workflow" /><published>2010-12-30T00:00:00+00:00</published><updated>2010-12-30T00:00:00+00:00</updated><id>http://egonw.github.io/blog/2010/12/30/blogging-as-part-of-your-workflow</id><content type="html" xml:base="http://egonw.github.io/blog/2010/12/30/blogging-as-part-of-your-workflow.html"><![CDATA[<p>Today is the last day I work on <a href="http://oscar3-chem.sourceforge.net/">Oscar</a>
in my position in <a href="http://www-pmr.ch.cam.ac.uk/wiki/Main_Page">Cambridge</a> (tomorrow
I have a day off and fly back to Sweden). Three months go quick indeed. Next
Monday I start my position in Stockholm at the <a href="http://ki.se/IMM">IMM department</a>
at the <a href="http://ki.se/">Karolinska Institutet</a> on predictive toxicology. Back
in Sweden, it is. Well, of course, I worked from home most of the time anyway.</p>

<p>So, today it is time for me to write up a report for the last three months.
This blog item is basically a prelude, or procrastination, or so. People sometimes
ask me how I find time to blog so much. The trick is just make blogging part
of your workflow. So, small scripts I use in finishing another task form a blog
post (e.g. <a href="http://chem-bla-ics.blogspot.com/2010/12/converting-json-to-rdfxml-with-groovy.html">Converting JSON to RDF/XML with Groovy</a>).
I started blogging (<a href="http://chem-bla-ics.blogspot.com/2005/10/chem-bla-ics.html">in 2005</a>)
to actually optimize my workflow. I was sending the same message (“<em>have you
seen this interesting webpage</em>”) to several mailing lists, often tuning it a
bit to the audience. Now, by just posting it in a blog, I removed the need for
tuning, and as a bonus, would reach a much larger audience too. Actually, with
more then 300 unique visitors a week, I cannot complain.</p>

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

<p>Neither can I complain about the amount of discussion it triggers. It’s like
having my own private symposium:</p>

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

<p>Anyways, time to go back to blogging about Oscar…</p>]]></content><author><name>Egon Willighagen</name></author><category term="blogging" /><category term="oscar" /><category term="workflow" /><summary type="html"><![CDATA[Today is the last day I work on Oscar in my position in Cambridge (tomorrow I have a day off and fly back to Sweden). Three months go quick indeed. Next Monday I start my position in Stockholm at the IMM department at the Karolinska Institutet on predictive toxicology. Back in Sweden, it is. Well, of course, I worked from home most of the time anyway.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://egonw.github.io/blog/blog/assets/images/blogVisitors.png" /><media:content medium="image" url="http://egonw.github.io/blog/blog/assets/images/blogVisitors.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Oscar: training data, models, etc</title><link href="http://egonw.github.io/blog/2010/12/26/oscar-training-data-models-etc.html" rel="alternate" type="text/html" title="Oscar: training data, models, etc" /><published>2010-12-26T00:00:00+00:00</published><updated>2010-12-26T00:00:00+00:00</updated><id>http://egonw.github.io/blog/2010/12/26/oscar-training-data-models-etc</id><content type="html" xml:base="http://egonw.github.io/blog/2010/12/26/oscar-training-data-models-etc.html"><![CDATA[<p><a href="https://sourceforge.net/projects/oscar3-chem/">Oscar</a> uses a Maximum Entropy Markov Model (MEMM) based on <a href="http://en.wikipedia.org/wiki/N-gram">n-grams</a>.
Peter Corbett has written this up (doi:<a href="https://doi.org/10.1186/1471-2105-9-S11-S4">10.1186/1471-2105-9-S11-S4</a>). So, it basically is statistics
once more. If you really want a proper bioinformatics education, so do your PhD at a (proteo)chemometrics department.</p>

<p>N-grams are word parts of n characters. For example, the trigrams of <a href="http://en.wikipedia.org/wiki/Acetic_acid">acetic acid</a>
include <code class="language-plaintext highlighter-rouge">ace</code>, <code class="language-plaintext highlighter-rouge">cid</code>, <code class="language-plaintext highlighter-rouge">tic</code>, <code class="language-plaintext highlighter-rouge">eti</code>, and <code class="language-plaintext highlighter-rouge">aci</code>. N-grams of length four include acid, etic, and acet. The MEMM assigns weights to
these n-grams, and based on that decided if something is in deed a <em>named entity</em> (in Oscar terminology). For example,
consider the <code class="language-plaintext highlighter-rouge">acet</code> n-gram: acetone should be matched, but the n-gram <code class="language-plaintext highlighter-rouge">facet</code> not.</p>

<p>Put this in perspective in the ongoing refactoring of the Oscar software. We are changing normalization (e.g. converting
all unicode hyphen alternatives into one specific hyphen), updating the tokenizer (e.g. changing the list of
non-sentence-endings like <em>Prof.</em>). It is clear this changes the n-grams typical for chemical-like things. Worse,
the weights are tuned towards to know n-grams, and statistical models are generally a bit overtrained for the
data, or, at least, specific for it.</p>

<p>Now, if the distribution of n-grams changes, the weights in the model need to be updated too, to not degrade
the model performance. So, Oscar is useless if we cannot retrain its MEMM component after a refactoring. If
that would be impossible, we would have effectively created an <em>intellectual monopoly</em>.</p>

<p>Thus, what the Oscar project needs, is one or more free sets of annotated literature, which can be used to
train new MEMM models. The SciBorg corpus was used to train the current Oscar3 and Oscar4 models. This data
(copyright <a href="http://rsc.org/">RSC</a>) will very likely be available under a <a href="http://creativecommons.org/licenses/">Creative Commons</a>
license (RSC++), but may have the NC clause, which would not be good for developing a business model around
the opensource Oscar (such as providing a high-performance web service via a subscription service). I have
recently written up <a href="http://chem-bla-ics.blogspot.com/2010/12/re-why-i-and-you-should-avoid-nc.html">the problems the NC clause introduces</a>,
and some <a href="http://chem-bla-ics.blogspot.com/2010/12/blog-post.html">examples of commercial Open Source cheminformatics projects</a>.</p>

<p>We need not focus only on this SciBorg data, however. In fact, we will need multiple models anyway. For
example, the SciBorg papers (42 if not mistaken) are around a particular kind of literature. So, it
introduces the risk of using it to analyse papers out of the application domain. Furthermore, I am very
interested (and others indicated so too) to use Oscar for other languages. Surely, English is the major
language, but there are many use cases for Oscar when useful for other languages.</p>

<p>Therefore, for what we need in the Oscar project, is a registry of training (/test) data, annotated itself
with metadata around how that data was created (what quality assurance, what kind of named entity types,
how many domain experts were involved, etc), test results for those data sets, etc. My time on the Oscar
project is almost over, and I have no clue when I will be able to invest the same amount of time into the
project as I did in the past three months. But the creation of this registry is clear step that must be
taken in the Oscar4 development.</p>]]></content><author><name>Egon Willighagen</name></author><category term="oscar" /><category term="textmining" /><category term="justdoi:10.1186/1471-2105-9-S11-S4" /><category term="inchikey:QTBSBXVTEAMEQO-UHFFFAOYSA-N" /><category term="inchikey:CSCPPACGZOOCGX-UHFFFAOYSA-N" /><summary type="html"><![CDATA[Oscar uses a Maximum Entropy Markov Model (MEMM) based on n-grams. Peter Corbett has written this up (doi:10.1186/1471-2105-9-S11-S4). So, it basically is statistics once more. If you really want a proper bioinformatics education, so do your PhD at a (proteo)chemometrics department.]]></summary></entry><entry><title type="html">Status update on BJOC analysis with Oscar and ChemicalTagger #3</title><link href="http://egonw.github.io/blog/2010/12/23/status-update-on-bjoc-analysis-with_23.html" rel="alternate" type="text/html" title="Status update on BJOC analysis with Oscar and ChemicalTagger #3" /><published>2010-12-23T00:00:00+00:00</published><updated>2010-12-23T00:00:00+00:00</updated><id>http://egonw.github.io/blog/2010/12/23/status-update-on-bjoc-analysis-with_23</id><content type="html" xml:base="http://egonw.github.io/blog/2010/12/23/status-update-on-bjoc-analysis-with_23.html"><![CDATA[<p>The <a href="https://chem-bla-ics.linkedchemistry.info/2010/12/11/status-update-on-bjoc-analysis-with_11.html">two <i class="fa-solid fa-recycle fa-xs"></i></a>
<a href="https://chem-bla-ics.linkedchemistry.info/2010/12/11/status-update-on-bjoc-analysis-with.html">earlier <i class="fa-solid fa-recycle fa-xs"></i></a> posts
in this series showed screenshots of results of Oscar, but the title also promised results by Lezan’s
<a href="http://www-ucc.ch.cam.ac.uk/products/software/chemicaltagger">ChemicalTagger</a>. Sam
helped with getting the HTML pages online via the Cambridge Hudson installation. Where
Oscar find named entities (chemical compounds, processes, etc), ChemicalTagger finds
roles, like solvent, acid, base, catalyst. Roles are properties of chemical compounds
in certain situations. Ethanol is not always a solvent, sometimes it is a Xmas present.
The current output is not entirely where I want to go yet, but makes it easy which
solvents are frequently found in the BJOC corpus:</p>

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

<p>This screenshot of an analysis of 15 BJOC papers shows that AcOEt (is that the
<a href="http://lab.chempedia.com/questions/427/are-etoac-and-acoet-the-same">same as EtOAc?</a>)
is mentioned as solvent three times in <a href="http://www.ncbi.nlm.nih.gov/sites/ppmc/articles/PMC1399459">PMC1399459</a>.
Brine, however, is mentioned as solvent in three papers.</p>

<p>As said, these <a href="https://hudson.ch.cam.ac.uk/job/oscar4-chebi/ws/target/output/bjoc.html">two</a>
<a href="https://hudson.ch.cam.ac.uk/job/oscar4-chebi/ws/target/output/roles.html">pages</a> contain
RDF and the tables are sortable. Hudson recompiles them automatically when I update the
source code to create the HTML+RDFa. So, go ahead, send me bug reports, feature requests,
and patches!</p>]]></content><author><name>Egon Willighagen</name></author><category term="oscar" /><category term="chemicaltagger" /><category term="beilstein" /><category term="justdoi:10.1186/1860-5397-1-11" /><summary type="html"><![CDATA[The two earlier posts in this series showed screenshots of results of Oscar, but the title also promised results by Lezan’s ChemicalTagger. Sam helped with getting the HTML pages online via the Cambridge Hudson installation. Where Oscar find named entities (chemical compounds, processes, etc), ChemicalTagger finds roles, like solvent, acid, base, catalyst. Roles are properties of chemical compounds in certain situations. Ethanol is not always a solvent, sometimes it is a Xmas present. The current output is not entirely where I want to go yet, but makes it easy which solvents are frequently found in the BJOC corpus:]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://egonw.github.io/blog/blog/assets/images/chemtag1.png" /><media:content medium="image" url="http://egonw.github.io/blog/blog/assets/images/chemtag1.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Supramolecular chemistry</title><link href="http://egonw.github.io/blog/2010/12/11/supramolecular-chemistry.html" rel="alternate" type="text/html" title="Supramolecular chemistry" /><published>2010-12-11T00:20:00+00:00</published><updated>2010-12-11T00:20:00+00:00</updated><id>http://egonw.github.io/blog/2010/12/11/supramolecular-chemistry</id><content type="html" xml:base="http://egonw.github.io/blog/2010/12/11/supramolecular-chemistry.html"><![CDATA[<p>Some smart software developer once said to not optimize your code too early. However, not caring about it at all does not help either.
Some basic knowledge of memory management can keep you going. That is, I just ran into the limits of <a href="http://oscar3-chem.sf.net/">Oscar</a>
and ChemicalTagger. As I blogged earlier today, I am <a href="https://chem-bla-ics.linkedchemistry.info/2010/12/11/status-update-on-bjoc-analysis-with.html">analyzing the BJOC literature <i class="fa-solid fa-recycle fa-xs"></i></a>,
but Lezan and I are running into a reproducible out-of-memory exception. At first I thought it was a memory leak, as it was the 95th
paper if fell over on, but after we optimized our code a bit, by reusing classes, the problem remained and turned out to be not in
recreating objects (though the code is significantly faster now), but in a single BJOC paper being too large.</p>

<p>The particular paper is not even ridiculously large, though it has an amazing 800 references! The paper, <em>Molecular recognition of
organic ammonium ions in solution using synthetic receptors</em> (doi:<a href="https://doi.org/10.3762/bjoc.6.32">10.3762/bjoc.6.32</a>), is in
fact an interesting review paper on supramolecular chemistry. The molecules I worked on (see one below) in my own supramolecular chemistry
time (doing a M.Sc. minor (6 month practical) with Peter Buijnsters in organic chemistry in the
<a href="http://www.molchem.science.ru.nl/about.php">group of Prof. Nolte</a>), are actually of the type they review, though surfactants are
not really covered in it particularly.</p>

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

<p>Yeah, supramolecular chemistry has this nice level complexity; it is so supramolecular, that it is currently outside the scope
of the molecular analysis of Oscar and ChemicalTagger ;)</p>

<ul>
  <li>Buijnsters, P. J. J. A.; García-Rodríguez, C. L.; Willighagen, E. L.; Sommerdijk, N. A. J. M.; Kremer, A.; Camilleri, P.; Feiters, M. C.;
Nolte, R. J. M.; Zwanenburg, B. (2002). Cationic Gemini Surfactants Based on Tartaric Acid: Synthesis, Aggregation, Monolayer Behaviour,
and Interaction with DNA European Journal of Organic Chemistry, 2002 (8), 1397-1406 :
DOI:<a href="https://doi.org/csqhbn">10.1002/1099-0690(200204)2002:8%3C1397::AID-EJOC1397%3E3.0.CO;2-6</a></li>
</ul>]]></content><author><name>Egon Willighagen</name></author><category term="oscar" /><category term="beilstein" /><category term="chemistry" /><category term="justdoi:10.3762/bjoc.6.32" /><category term="inchikey:ZXBXTKLPJKVXBD-KKLWWLSJSA-N" /><summary type="html"><![CDATA[Some smart software developer once said to not optimize your code too early. However, not caring about it at all does not help either. Some basic knowledge of memory management can keep you going. That is, I just ran into the limits of Oscar and ChemicalTagger. As I blogged earlier today, I am analyzing the BJOC literature , but Lezan and I are running into a reproducible out-of-memory exception. At first I thought it was a memory leak, as it was the 95th paper if fell over on, but after we optimized our code a bit, by reusing classes, the problem remained and turned out to be not in recreating objects (though the code is significantly faster now), but in a single BJOC paper being too large.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://egonw.github.io/blog/blog/assets/images/surfactant2002.png" /><media:content medium="image" url="http://egonw.github.io/blog/blog/assets/images/surfactant2002.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Status update on BJOC analysis with Oscar and ChemicalTagger #2</title><link href="http://egonw.github.io/blog/2010/12/11/status-update-on-bjoc-analysis-with_11.html" rel="alternate" type="text/html" title="Status update on BJOC analysis with Oscar and ChemicalTagger #2" /><published>2010-12-11T00:10:00+00:00</published><updated>2010-12-11T00:10:00+00:00</updated><id>http://egonw.github.io/blog/2010/12/11/status-update-on-bjoc-analysis-with_11</id><content type="html" xml:base="http://egonw.github.io/blog/2010/12/11/status-update-on-bjoc-analysis-with_11.html"><![CDATA[<p> </p>

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

<p>A quick update on the <a href="https://chem-bla-ics.linkedchemistry.info/2010/12/11/status-update-on-bjoc-analysis-with.html">post of this morning <i class="fa-solid fa-recycle fa-xs"></i></a>. The above screenshot
shows the progress of the reporting of text mining results using <a href="http://oscar3-chem.sf.net/">Oscar</a> on the <a href="http://www.beilstein-journals.org/bjoc/">BJOC literature</a>.
I think I am almost ready to analyze the full corpus, with a blacklist put in place for <a href="https://chem-bla-ics.linkedchemistry.info/2010/12/11/supramolecular-chemistry.html">large papers <i class="fa-solid fa-recycle fa-xs"></i></a>,
What you see is the same kind of JQuery-enabled sortable list in the HTML view, and a <a href="http://en.wikipedia.org/wiki/SPARQL">SPARQL query</a>
in <a href="https://chem-bla-ics.linkedchemistry.info/2010/07/16/rdfadev-htmlrdfa-development-with.html">RDFaDev <i class="fa-solid fa-recycle fa-xs"></i></a>, to list all papers that mention
<a href="http://www.dhmo.org/facts.html">DHMO</a> (in the first 10 of all 350 BJOC papers) by its <a href="http://en.wikipedia.org/wiki/International_Chemical_Identifier">InChI</a>.</p>

<p>Importantly, IMHO, it is using the <a href="http://code.google.com/p/semanticchemistry/">CHEMINF ontology</a>.</p>]]></content><author><name>Egon Willighagen</name></author><category term="beilstein" /><category term="oscar" /><category term="inchi" /><summary type="html"><![CDATA[ ]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://egonw.github.io/blog/blog/assets/images/bjoc1.png" /><media:content medium="image" url="http://egonw.github.io/blog/blog/assets/images/bjoc1.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Status update on BJOC analysis with Oscar and ChemicalTagger</title><link href="http://egonw.github.io/blog/2010/12/11/status-update-on-bjoc-analysis-with.html" rel="alternate" type="text/html" title="Status update on BJOC analysis with Oscar and ChemicalTagger" /><published>2010-12-11T00:00:00+00:00</published><updated>2010-12-11T00:00:00+00:00</updated><id>http://egonw.github.io/blog/2010/12/11/status-update-on-bjoc-analysis-with</id><content type="html" xml:base="http://egonw.github.io/blog/2010/12/11/status-update-on-bjoc-analysis-with.html"><![CDATA[<p> </p>

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

<p>This screenshot shows the current status of the <a href="http://oscar3-chem.sf.net/">Oscar</a> analysis results of the
<a href="http://www.beilstein-journals.org/bjoc/">BJOC literature</a>. The results our logged as HTML+RDFa page, as I explained before in
<a href="https://chem-bla-ics.linkedchemistry.info/2010/07/19/scripts-logs-as-htmlrdfa-mix-free-text.html">Scripts logs as HTML+RDFa: mix free text reporting with CSV <i class="fa-solid fa-recycle fa-xs"></i></a>.
The page is interactive, using <a href="http://jquery.com/">JQuery</a> goodies to allow table sorting.</p>]]></content><author><name>Egon Willighagen</name></author><category term="beilstein" /><category term="oscar" /><summary type="html"><![CDATA[ ]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://egonw.github.io/blog/blog/assets/images/bjoc.png" /><media:content medium="image" url="http://egonw.github.io/blog/blog/assets/images/bjoc.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Adding a new dictionary to Oscar</title><link href="http://egonw.github.io/blog/2010/11/29/adding-new-dictionary-to-oscar.html" rel="alternate" type="text/html" title="Adding a new dictionary to Oscar" /><published>2010-11-29T00:00:00+00:00</published><updated>2010-11-29T00:00:00+00:00</updated><id>http://egonw.github.io/blog/2010/11/29/adding-new-dictionary-to-oscar</id><content type="html" xml:base="http://egonw.github.io/blog/2010/11/29/adding-new-dictionary-to-oscar.html"><![CDATA[<p>Say, you have your own dictionary of chemical compounds. For example, like your company’s list of yet-unpublished
<a href="http://chembl.blogspot.com/2010/08/research-code-to-company-name-mapping.html">internal research codes</a>. Still,
you want to index your local <a href="http://en.wikipedia.org/wiki/LISTSERV">listserv</a> to make it easier for your
employees to search for particular chemistry you are working on and perhaps related to something done at
other company sites. This is what Oscar is for.</p>

<p>But, it will need to understand things like <a href="http://chembl.blogspot.com/p/research-code-stems.html">UK-92,480</a>.
This is made possible with the Oscar4 refactorings we are currently working on. You only need to
<a href="https://chem-bla-ics.linkedchemistry.info/2010/10/28/oscar4-java-api-chemical-name.html">register a dedicated dictionary <i class="fa-solid fa-recycle fa-xs"></i></a>.
Oscar4 has a default dictionary which corresponds to the dictionary used by Oscar3, and a dictionary based on
<a href="http://www.ebi.ac.uk/chebi/">ChEBI</a> (an old version) (see <a href="http://bitbucket.org/wwmm/oscar4/src/247b8deef001/oscar4-chemnamedict/src/main/java/uk/ac/cam/ch/wwmm/oscar/chemnamedict/core/">this folder</a>
in the source code repository).</p>

<p>Adding a new dictionary is very straightforward: you just implement the <a href="http://bitbucket.org/wwmm/oscar4/src/247b8deef001/oscar4-chemnamedict/src/main/java/uk/ac/cam/ch/wwmm/oscar/chemnamedict/IChemNameDict.java">IChemNameDict</a>
interface. This is, for example, what the OPSIN dictionary looks like:</p>

<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">OpsinDictionary</span>
<span class="kd">implements</span> <span class="nc">IChemNameDict</span><span class="o">,</span> <span class="nc">IInChIProvider</span> <span class="o">{</span>

  <span class="kd">private</span> <span class="no">URI</span> <span class="n">uri</span><span class="o">;</span>

  <span class="kd">public</span> <span class="nf">OpsinDictionary</span><span class="o">()</span> <span class="kd">throws</span> <span class="nc">URISyntaxException</span> <span class="o">{</span>
    <span class="k">this</span><span class="o">.</span><span class="na">uri</span> <span class="o">=</span> <span class="k">new</span> <span class="no">URI</span><span class="o">(</span>
      <span class="s">"http://wwmm.cam.ac.uk/oscar/dictionariy/opsin/"</span>
    <span class="o">);</span>
  <span class="o">}</span>

  <span class="c1">// the URI is somewhat like a namespace</span>
  <span class="kd">public</span> <span class="no">URI</span> <span class="nf">getURI</span><span class="o">()</span> <span class="o">{</span>
    <span class="k">return</span> <span class="n">uri</span><span class="o">;</span>
  <span class="o">}</span>

  <span class="c1">// there are no stop words defined in this</span>
  <span class="c1">// dictionary</span>
  <span class="kd">public</span> <span class="kt">boolean</span> <span class="nf">hasStopWord</span><span class="o">(</span><span class="nc">String</span> <span class="n">queryWord</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
  <span class="o">}</span>

  <span class="c1">// see hasStopWord()</span>
  <span class="kd">public</span> <span class="nc">Set</span> <span class="nf">getStopWords</span><span class="o">()</span> <span class="o">{</span>
    <span class="k">return</span> <span class="nc">Collections</span><span class="o">.</span><span class="na">emptySet</span><span class="o">();</span>
  <span class="o">}</span>

  <span class="c1">// it has the name in the dictionary if the name</span>
  <span class="c1">// can be converted into an InChI</span>
  <span class="kd">public</span> <span class="kt">boolean</span> <span class="nf">hasName</span><span class="o">(</span><span class="nc">String</span> <span class="n">queryName</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">return</span> <span class="nf">getInChI</span><span class="o">(</span><span class="n">queryName</span><span class="o">).</span><span class="na">size</span><span class="o">()</span> <span class="o">!=</span> <span class="mi">0</span><span class="o">;</span>
  <span class="o">}</span>

  <span class="c1">// this dictionary can return InChIs for names</span>
  <span class="c1">// so, it implements the IInChIProvider interface</span>
  <span class="kd">public</span> <span class="nc">Set</span> <span class="nf">getInChI</span><span class="o">(</span><span class="nc">String</span> <span class="n">queryName</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">try</span> <span class="o">{</span>
      <span class="nc">NameToStructure</span> <span class="n">nameToStructure</span> <span class="o">=</span>
        <span class="nc">NameToStructure</span><span class="o">.</span><span class="na">getInstance</span><span class="o">();</span>
      <span class="nc">OpsinResult</span> <span class="n">result</span> <span class="o">=</span> <span class="n">nameToStructure</span>
        <span class="o">.</span><span class="na">parseChemicalName</span><span class="o">(</span>
          <span class="n">queryName</span><span class="o">,</span> <span class="kc">false</span>
        <span class="o">);</span>
      <span class="k">if</span> <span class="o">(</span><span class="n">result</span><span class="o">.</span><span class="na">getStatus</span><span class="o">()</span>
          <span class="o">==</span> <span class="no">OPSIN_RESULT_STATUS</span><span class="o">.</span><span class="na">SUCCESS</span><span class="o">)</span> <span class="o">{</span>
        <span class="nc">Set</span> <span class="n">inchis</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">HashSet</span><span class="o">();</span>
        <span class="nc">String</span> <span class="n">inchi</span> <span class="o">=</span> <span class="nc">NameToInchi</span>
          <span class="o">.</span><span class="na">convertResultToInChI</span><span class="o">(</span>
            <span class="n">result</span><span class="o">,</span> <span class="kc">false</span>
          <span class="o">);</span>
        <span class="n">inchis</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">inchi</span><span class="o">);</span>
        <span class="k">return</span> <span class="n">inchis</span><span class="o">;</span>
      <span class="o">}</span>
    <span class="o">}</span> <span class="k">catch</span> <span class="o">(</span><span class="nc">NameToStructureException</span> <span class="n">e</span><span class="o">)</span> <span class="o">{</span>
      <span class="n">e</span><span class="o">.</span><span class="na">printStackTrace</span><span class="o">();</span>   
    <span class="o">}</span>
    <span class="k">return</span> <span class="nc">Collections</span><span class="o">.</span><span class="na">emptySet</span><span class="o">();</span>
  <span class="o">}</span>

  <span class="kd">public</span> <span class="nc">String</span> <span class="nf">getInChIforShortestSMILES</span><span class="o">(</span>
    <span class="nc">String</span> <span class="n">queryName</span><span class="o">)</span>
  <span class="o">{</span>
    <span class="nc">Set</span> <span class="n">inchis</span> <span class="o">=</span> <span class="n">getInChI</span><span class="o">(</span><span class="n">queryName</span><span class="o">);</span>
    <span class="k">if</span> <span class="o">(</span><span class="n">inchis</span><span class="o">.</span><span class="na">size</span><span class="o">()</span> <span class="o">==</span> <span class="mi">0</span><span class="o">)</span> <span class="k">return</span> <span class="kc">null</span><span class="o">;</span>
    <span class="k">return</span> <span class="n">inchis</span><span class="o">.</span><span class="na">iterator</span><span class="o">().</span><span class="na">next</span><span class="o">();</span>
  <span class="o">}</span>

  <span class="c1">// since names are converted on the fly, we do</span>
  <span class="c1">// not enumerate them</span>
  <span class="kd">public</span> <span class="nc">Set</span> <span class="nf">getNames</span><span class="o">(</span><span class="nc">String</span> <span class="n">inchi</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">return</span> <span class="nc">Collections</span><span class="o">.</span><span class="na">emptySet</span><span class="o">();</span>
  <span class="o">}</span>
  <span class="kd">public</span> <span class="nc">Set</span> <span class="nf">getNames</span><span class="o">()</span> <span class="o">{</span>
    <span class="k">return</span> <span class="nc">Collections</span><span class="o">.</span><span class="na">emptySet</span><span class="o">();</span>
  <span class="o">}</span>
  <span class="kd">public</span> <span class="nc">Set</span> <span class="nf">getOrphanNames</span><span class="o">()</span> <span class="o">{</span>
    <span class="k">return</span> <span class="nc">Collections</span><span class="o">.</span><span class="na">emptySet</span><span class="o">();</span>
  <span class="o">}</span>
  <span class="kd">public</span> <span class="nc">Set</span> <span class="nf">getChemRecords</span><span class="o">()</span> <span class="o">{</span>
    <span class="k">return</span> <span class="nc">Collections</span><span class="o">.</span><span class="na">emptySet</span><span class="o">();</span>
  <span class="o">}</span>
  <span class="kd">public</span> <span class="kt">boolean</span> <span class="nf">hasOntologyIdentifier</span><span class="o">(</span>
    <span class="nc">String</span> <span class="n">identifier</span><span class="o">)</span>
  <span class="o">{</span>
    <span class="c1">// this ontology does not use ontology</span>
    <span class="c1">// identifiers</span>
    <span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
  <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>

<p>Now, you can implement the interface in various ways. You can even have the implementation hook into a SQL database
with JDBC, or use something else fancy. The dictionary will be used at various steps of the Oscar4 text analysis
workflow.</p>

<p>Mind you, the refactoring is not over yet, and the details may change here and there.</p>

<p>Your comments are most welcome!</p>]]></content><author><name>Egon Willighagen</name></author><category term="oscar" /><category term="java" /><summary type="html"><![CDATA[Say, you have your own dictionary of chemical compounds. For example, like your company’s list of yet-unpublished internal research codes. Still, you want to index your local listserv to make it easier for your employees to search for particular chemistry you are working on and perhaps related to something done at other company sites. This is what Oscar is for.]]></summary></entry><entry><title type="html">Installing Oscar</title><link href="http://egonw.github.io/blog/2010/11/22/installing-oscar.html" rel="alternate" type="text/html" title="Installing Oscar" /><published>2010-11-22T00:10:00+00:00</published><updated>2010-11-22T00:10:00+00:00</updated><id>http://egonw.github.io/blog/2010/11/22/installing-oscar</id><content type="html" xml:base="http://egonw.github.io/blog/2010/11/22/installing-oscar.html"><![CDATA[<p>About half-way my Oscar project now. I blogged about the Oscar <a href="http://chem-bla-ics.blogspot.com/2010/10/oscar4-java-api-chemical-name.html">Java API</a>,
the <a href="http://chem-bla-ics.blogspot.com/2010/11/oscar4-command-line-utilities.html">command line utility</a>,
and the <a href="http://chem-bla-ics.blogspot.com/2010/10/oscar-text-mining-in-taverna.html">Taverna plugin</a>
(all in development). Also, David Jessop joined in, boosting the refactoring.
The meeting with the <a href="http://www.ebi.ac.uk/chebi/">ChEBI</a> team last week was
great too. We worked out details for the use cases, involving Oscar and Lezan’s
<a href="http://www-ucc.ch.cam.ac.uk/products/software/chemicaltagger">ChemicalTagger</a>.</p>

<p>Here follow some install instructions to get going. Please give things a try,
even though we are under heavy development. You can monitor the stability of
the code via these Hudson pages for <a href="https://hudson.ch.cam.ac.uk/job/oscar4/">oscar4</a>,
<a href="https://hudson.ch.cam.ac.uk/job/oscar4-cli/">oscar4-cli</a>, <a href="https://hudson.ch.cam.ac.uk/job/ChemicalTagger/">ChemicalTagger</a>,
and <a href="https://hudson.ch.cam.ac.uk/">others</a>. This continuous building of software
should be set up for any scientific code.</p>

<p><strong>Requirements</strong>
The follow the below instructions, you will need a working environment with
a tool to process <a href="http://en.wikipedia.org/wiki/ZIP_%28file_format%29">zip files</a>
(or equivalent), <a href="http://en.wikipedia.org/wiki/Java_Development_Kit">Java DK</a>,
and <a href="http://maven.apache.org/">Maven</a>. Having wget makes things easier. Oh,
and you need a working internet connection.</p>

<p>The pattern is otherwise the same for all above tools. I will demonstrate the
process with oscar4-cli.</p>

<p>Ubuntu and Debian users can use:</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>aptitude <span class="nb">install </span>unzip maven2 <span class="se">\\</span>
  openjdk-6-jdk wget
</code></pre></div></div>

<p><strong>Downloading the source</strong>
The source code for the above tools is all hosted on <a href="http://bitbucket.org">BitBucket</a>,
using the <a href="http://mercurial.selenic.com/">Mercurial</a> version control system.
However, there is no need to worry about that, because BitBucket provides source
drops. At <a href="http://bitbucket.org/egonw/oscar4-cli/downloads">this page</a> you can
download a .zip file for the command line utilities, which you can unzip with
your favorite tool.</p>

<p>If you have <em>wget</em> installed you could do from the command line:</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>wget http://bitbucket.org/egonw/oscar4-cli/get/tip.zip
unzip tip.zip
</code></pre></div></div>

<p>which downloads and unzips the latest version in the repository. (This is where
monitoring Hudson comes in; there you can check if there are failing unit tests.)</p>

<p><strong>Compiling the code</strong>
With the source code locally installed, it is same for Maven to come into action.
Again, I have no clue how to do this on Windows (other than with Cygwin, which
every Windows users should have installed, if a virtual machine with a full
Linux is no option), but maven should run the ‘<a href="http://maven.apache.org/plugins/maven-assembly-plugin/single-mojo.html">assembly:single</a>’
target. Or, from the command line:</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">cd </span>oscar4-cli/
mvn assembly:assembly
<span class="nb">cp </span>target/oscar4-cli-4.0-SNAPSHOT-jar-with-dependencies.jar <span class="se">\\</span>
  ./oscar4-cli-4.0-SNAPSHOT.jar
</code></pre></div></div>

<p>That should do: the created <em>oscar4-cli-4.0-SNAPSHOT.jar</em> can be used now to
run the <a href="http://chem-bla-ics.blogspot.com/2010/11/oscar4-command-line-utilities.html">command line utilities</a>.
Actually, it should also do fine for using the <a href="ttp://chem-bla-ics.blogspot.com/2010/10/oscar4-java-api-chemical-name.html">Oscar4 Java API</a>.</p>

<p><strong>Provide feedback</strong>
We most welcome feedback, or any kind. Feature requests can be posted <a href="http://sourceforge.net/tracker/?group_id=169991&amp;atid=852565">here</a>,
and bug reports <a href="http://sourceforge.net/tracker/?group_id=169991&amp;atid=852562">here</a>.
You can also send email to the <a href="http://sourceforge.net/mailarchive/forum.php?forum_name=oscar3-chem-developers">oscar3-chem-developers</a>
mailing list.</p>

<p><strong>Update</strong>: <em>mvn assembly:assembly</em> should be used instead of <em>mvn assembly:single</em>.</p>]]></content><author><name>Egon Willighagen</name></author><category term="oscar" /><category term="textmining" /><summary type="html"><![CDATA[About half-way my Oscar project now. I blogged about the Oscar Java API, the command line utility, and the Taverna plugin (all in development). Also, David Jessop joined in, boosting the refactoring. The meeting with the ChEBI team last week was great too. We worked out details for the use cases, involving Oscar and Lezan’s ChemicalTagger.]]></summary></entry><entry><title type="html">Oscar4 command line utilities</title><link href="http://egonw.github.io/blog/2010/11/18/oscar4-command-line-utilities.html" rel="alternate" type="text/html" title="Oscar4 command line utilities" /><published>2010-11-18T00:00:00+00:00</published><updated>2010-11-18T00:00:00+00:00</updated><id>http://egonw.github.io/blog/2010/11/18/oscar4-command-line-utilities</id><content type="html" xml:base="http://egonw.github.io/blog/2010/11/18/oscar4-command-line-utilities.html"><![CDATA[<p>One goal of my three month project is to take Oscar4 to the community. We want to get it used more, and we need
a larger development community. Oscar4 and the related technologies do a good, sometimes excellent, job, but
have to be maintained, just like any other piece of code. To make using it easier, we are developing new APIs,
as well as two user-oriented applications: <a href="https://chem-bla-ics.linkedchemistry.info/2010/10/21/oscar-text-mining-in-taverna.html">a Taverna 2 plugin <i class="fa-solid fa-recycle fa-xs"></i></a>,
and command line utilities. The <a href="https://chem-bla-ics.linkedchemistry.info/2010/10/28/oscar4-java-api-chemical-name.html">Oscar4 Java API <i class="fa-solid fa-recycle fa-xs"></i></a>
has slightly evolved in the last three weeks, removing some complexity. In this post, I will introduce the command
line utilities.</p>

<h2 id="oscar4">Oscar4</h2>

<p>Most people will be mostly interested into the full Oscar4 program, to extract chemical entities. Oscar3 was
also capable of extracting data (like <a href="https://chem-bla-ics.linkedchemistry.info/2006/09/08/chemical-archeology-oscar3-to.html">NMR spectra <i class="fa-solid fa-recycle fa-xs"></i></a>),
but that is not yet being ported. The OscarCLI program takes input, extracts chemicals, and where possible resolves
them into connection tables (viz. InChI).</p>

<p>To extract chemicals from a line of text (e.g. <em>“This is propane.”</em>, you do:</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>java <span class="nt">-cp</span> oscar4-cli-4.0-SNAPSHOT.jar <span class="se">\</span>
  uk.ac.cam.ch.wwmm.oscar.oscarcli.OscarCLI <span class="se">\</span>
  This is propane.
propane: <span class="nv">InChI</span><span class="o">=</span>1/C3H8/c1-3-2/h3H2,1-2H3
</code></pre></div></div>

<p>For larger chunks of texts it is easier to route it via <a href="http://en.wikipedia.org/wiki/Standard_streams">stdin</a>,
for which we can use the <code class="language-plaintext highlighter-rouge">-stdin</code> option:</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">echo</span> <span class="s2">"This is propane."</span> | <span class="se">\</span>
  java <span class="nt">-cp</span> oscar4-cli-4.0-SNAPSHOT.jar <span class="se">\</span>
  uk.ac.cam.ch.wwmm.oscar.oscarcli.OscarCLI <span class="se">\</span>
  <span class="nt">-stdin</span>
propane: <span class="nv">InChI</span><span class="o">=</span>1/C3H8/c1-3-2/h3H2,1-2H3
</code></pre></div></div>

<p>That way, we can easily process large plain text files (output omitted):</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">cat </span>largeFile.txt | <span class="se">\</span>
  java <span class="nt">-cp</span> oscar4-cli-4.0-SNAPSHOT.jar <span class="se">\</span>
  uk.ac.cam.ch.wwmm.oscar.oscarcli.OscarCLI <span class="se">\</span>
  <span class="nt">-stdin</span>
</code></pre></div></div>

<p>If you prefer RDF output, for further integration, use the <code class="language-plaintext highlighter-rouge">-output text/turtle</code>:</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">cat </span>largeFile.txt | <span class="se">\</span>
  java <span class="nt">-cp</span> oscar4-cli-4.0-SNAPSHOT.jar <span class="se">\</span>
  uk.ac.cam.ch.wwmm.oscar.oscarcli.OscarCLI <span class="se">\</span>
  <span class="nt">-stdin</span> <span class="nt">-output</span> text/turtle
</code></pre></div></div>

<p>This returns RDF using the <a href="http://code.google.com/p/semanticchemistry/">CHEMINF</a> ontology like:</p>

<div class="language-turtle highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">@prefix</span><span class="w"> </span><span class="nn">dc:</span><span class="w">  </span><span class="p">.</span><span class="w">
</span><span class="kd">@prefix</span><span class="w"> </span><span class="nn">rdfs:</span><span class="w">  </span><span class="p">.</span><span class="w">
</span><span class="kd">@prefix</span><span class="w"> </span><span class="nn">ex:</span><span class="w">  </span><span class="p">.</span><span class="w">
</span><span class="kd">@prefix</span><span class="w"> </span><span class="nn">cheminf:</span><span class="w">  </span><span class="p">.</span><span class="w">
</span><span class="kd">@prefix</span><span class="w"> </span><span class="nn">sio:</span><span class="w"> </span><span class="p">.</span><span class="w">

</span><span class="nn">ex:</span><span class="n">entity0
</span><span class="w">  </span><span class="nn">rdfs:</span><span class="n">subClassOf</span><span class="w"> </span><span class="nn">cheminf:</span><span class="n">CHEMINF_000000</span><span class="w"> </span><span class="p">;</span><span class="w">
  </span><span class="nn">dc:</span><span class="n">label</span><span class="w"> </span><span class="s">"propane"</span><span class="w"> </span><span class="p">;</span><span class="w">
  </span><span class="nn">cheminf:</span><span class="n">CHEMINF_000200</span><span class="w"> </span><span class="p">[</span><span class="w">
    </span><span class="k">a</span><span class="w"> </span><span class="nn">cheminf:</span><span class="n">CHEMINF_000113</span><span class="w"> </span><span class="p">;</span><span class="w">
    </span><span class="nn">sio:</span><span class="n">SIO_000300</span><span class="w"> </span><span class="s">"InChI=1/C3H8/c1-3-2/h3H2,1-2H3"</span><span class="w"> </span><span class="p">.</span><span class="w">
  </span><span class="p">]</span><span class="w"> </span><span class="p">.</span><span class="w">
</span></code></pre></div></div>

<p>We can, however, also use <a href="http://jericho.htmlparser.net/docs/index.html">Jericho</a> to extract text from HTML pages, made
available with the <code class="language-plaintext highlighter-rouge">-html</code> option, and pulling in a <a href="http://www.beilstein-journals.org/bjoc/">Beilstein Journal of Organic Chemistry</a>
paper with <a href="http://en.wikipedia.org/wiki/Wget">wget</a>:</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>wget <span class="nt">-qO-</span> https://doi.org/10.3762/bjoc.6.122 | <span class="se">\</span>
  java <span class="nt">-cp</span> oscar4-cli-4.0-SNAPSHOT.jar <span class="se">\</span>
  uk.ac.cam.ch.wwmm.oscar.oscarcli.OscarCLI <span class="se">\</span>
  <span class="nt">-stdin</span> <span class="nt">-html</span>
</code></pre></div></div>

<p>This will return 271 chemical entities recognized in the text, matching 48 unique chemical structures.</p>]]></content><author><name>Egon Willighagen</name></author><category term="oscar" /><category term="textmining" /><category term="beilstein" /><category term="inchikey:ATUOYWHBWRKTHZ-UHFFFAOYSA-N" /><summary type="html"><![CDATA[One goal of my three month project is to take Oscar4 to the community. We want to get it used more, and we need a larger development community. Oscar4 and the related technologies do a good, sometimes excellent, job, but have to be maintained, just like any other piece of code. To make using it easier, we are developing new APIs, as well as two user-oriented applications: a Taverna 2 plugin , and command line utilities. The Oscar4 Java API has slightly evolved in the last three weeks, removing some complexity. In this post, I will introduce the command line utilities.]]></summary></entry></feed>