Sunday, December 28, 2014

Ammon Hennacy: Questions and Answers

This post is a continuation of the "Heroes in Their Own Words" theme that started with a translation of the Zamenhof's Declaration of Homaranism. Basically what I'm doing is finding and posting texts in which people who I consider to be heroes briefly describe their core beliefs. Ammon Hennacy was a self-described "Christian Anarchist". He spent 18 months in solitary confinement for resisting the draft during WWI, and was arrested over 30 times for picketing and tax evasion. Like Zamenhof, Hennacy lived a life that demonstrated a high degree of moral courage. He lived a life consistent with his ideals, and constantly propagandized against war even when it was obvious that his propaganda was incapable of effecting any major changes in the world. For this post I transcribed chapter 19 of Hennacy's autobiography, "The Book of Ammon" (pdf link). The book appears to be self-published and contains no copyright notice, and it is almost certain that Hennacy would not object to my transcribing and posting it. The chapter, called "Questions and Answers," is basically an FAQ of Hennacy's opinions in the period from 1950 to 1964. I don't agree with all of Hennacy's positions, but I think they are all well worth reading and contemplating. There's nothing in the world as valuable as passionate people speaking on topics they're passionate about. What follows are not my words, but those of Hennacy (there are some spelling mistakes in the original that I have corrected without note, hopefully without introducing too many new ones at the same time):

Monday, December 22, 2014

Poetry as a force of destruction

This is an essay about the limitations of poetry and the potential for the poetic process to destroy the information it intends to preserve. I think the ideas could also be applied to other forms of art. I wrote it in January of 2011, and revised it just now. I don't think this is by any means the last word on this subject (it's barely even the first word), and I welcome discussion.

Thursday, November 13, 2014

Hunting and eating the wild Ginkgo

There are a bunch of Ginkgo trees in various places around the WSU campus. When, staring up into one of them, I noticed that it was a fruit bearing female, I was pretty excited. Like with some other plants, there are male and female ginkgos. Most of the time people only plant male ginkgos for decorative purposes because the fruit produced by the females is kind of stinky and messy. However, inside the stinky fruit is a seed rumored to be delicious when cooked. I'd never tried one, and was eager to get the chance.

Friday, November 7, 2014

By a train window (a translation by me of an Esperanto poem by Julio Baghy)

I like translating stuff from Esperanto. Here's a translation  (followed by the original) of a poem that I encountered in the book "Vojaĝo en Esperanto Lando" edited by Boris Kolker, which is a collection of a wide range of different kinds of writings. I got bored with that book and quit about 2/3 of the way through, but I liked the poetry. This isn't quite a literal translation, but it's pretty close (for better or worse).

Monday, November 3, 2014

An improved tempe incubator and more lupin tempe

It's been a while since I've posted about cooking with lupins, making tempe, or the impending Dennis Moore memorial dinner. Rest assured, the lupin project is advancing at characteristic pace for a project of mine (that is, not very fast...) .In this post I discuss an improved heater setup for the incubation. Then I talk about making tempe from lupin grits, and whole california white sweet lupins. I've also figured out how to make lupin icecream, but I'll save talking about that for later this winter when I get a chance to make a big batch of it.

Tuesday, October 28, 2014

International Chemical Identifers (InChIs): You should use them!

One easy and increasingly common way to increase the make metabolite data more useful is to associate compounds with their corresponding InChI  International Chemical Identifier (InChI) (Heller et al., 2013). An InChI is a unique, standardized text representation of the structure of an organic molecule. Inclusion of InChIs in database records facilitates cross-referencing among databases. The InChI system has a number of advantages over other kinds of identifiers. Some chemical identifiers, such as PubChem IDs, Chemical Abstracts Service (CAS) numbers, and ChemSpider IDs, are database-specific accession numbers with no direct relation to the structure of the molecule they describe, this means that a molecule must have been indexed by one of these services to have an identifier. An InChI, by contrast, is a database-independent structure description, so it can be generated for a molecule regardless of whether the molecule has been indexed by a major database. An InChI can be generated for a novel natural product structure, whereas the other IDs cannot. InChI also has advantages over other linear text representations of molecule structure, such as SMILES. Unlike for SMILES, there is a single open source implementation of the InChI generation algorithm, so while a single structure may have multiple valid SMILES representations, it will only have one Standard InChI representation (Heller et al., 2013). A fixed length compressed version of an InChI, an InChIKey, can be generated from any InChI. InChIKeys are more compatible than InChIs with web search engines such as Google ( (Southan, 2013), however, multiple distinct structure may have, and have been observed to have, the same InChIKey (, so InChIKeys should not be used as a basis for cross-referencing. When unambiguous identification of a molecule is the priority, InChI should be preferred. When ease of indexing and searchability is the priority, InChIKey should be preferred. When possible, both identifiers should be listed. By listing InChIs and InChIKeys in websites, databases, and publications (Coles et al., 2005), chemists can enhance the ability of their data to be indexed, searched, and cross-referenced. Free and easy to use software for generating InChIs and InChIKeys are the InChI software available from the InChI Trust (, and MolConverter available from ChemAxon (

Of course, even with the use of InChIs, inconsistencies can still arise in cross referencing. Galgonek and Vondrášek provide an excellent (and Open Access) analysis of the kinds of inconsistencies that can arise, and their sources.

I originally wrote this as part of a draft of the manuscript that eventually became this review article. It's a bit out of the scope of that article, so we dropped it. But I posted it here because I still think it's a good analysis.

Heller et al. 2013
Coles et al. 2005
Southan 2013 

Monday, October 20, 2014

What kinds of problems can (mathematical) models (of biochemical systems) solve?

I think the useful applications of computer modeling to biochemistry are in the following kind of situation: You have identified a phenotype of interest, you want to know what the molecular basis is for that phenotype, you know the form of the hypothesis (“a change in the concentration of substance X causes decreased activity of enzyme Y”), but there are too many possible instantiations of the hypothesis to test all of them experimentally (there may be 100 possibilities for “substance X” and 1000 possibilities for “enzyme Y”, giving 100,000 possible hypotheses). If you have some idea of how the system works, enough to make some kind of mathematical model of the system, and some experimental data (for example omics data comparing the condition displaying the phenotype to the condition not displaying the phenotype), you can use the computer to answer questions like: What instantiations of my hypothesis are most likely to be true, based on this dataset (or based on all available datasets)?

What is exciting?

I apologize in advance if this reads like an exercise in self indulgence. I wrote this after a conversation with a friend which basically went like this:

Her: "I'm going to go whitewater rafting next month, doesn't that sound exciting!"
Me: "Kind of. I think it would be more exciting to sit under a tree and read a good book, though."
Her: "What!? That doesn't make any sense."

It made perfect sense to me, so I wrote this essay and sent it to her. And now I'm posting it here for my throng of fans to read:

What is exciting? White water rafting?  Paragliding? Sky diving? Bungee-jumping? Roller coasters? Motorcycles? These things are exciting. They are fun (at least those of these that I have experienced).  But it is a short-lived excitement.  It’s there, and then it’s gone.

To me, a deeper kind of excitement, one that lasts, one that I can return to again and again, comes from learning.  Any idea that changes my perspective on the world or deepens my understanding is an exciting idea.  It’s an idea that makes my heart beat faster.

Saturday, September 13, 2014

Zamenhof's 1917 Declaration of Homaranism

In my previous post I wrote a little bit about the life of L.L. Zamenhof, and why even though he was certainly idealistic, I don't think it is fair or accurate to characterize him as "naive". In this post I present an English translation of Zamenhof's 1917 Declaration of Homaranism (Deklaracio pri Homaranismo) (pgs. 235-242 of "Mi Estas Homo", an Esperanto anthology of Zamenhof's letters and philosophical writings). I think it is unlikely that anyone will ever establish a Homaranist organization, nevertheless, the problems that Zamenhof was trying to use Homaranism to solve are as serious today as they were in his day. So whether one agrees with the principles and methodology of Homaranism or not, I think Zamenhof's ideas on the causes and solutions to human conflict are valuable at least as food for thought for modern discussions of these same topics.

L.L. Zamenhof was not naive

Ludwik Lazarus Zamenhof, creator of the Esperanto language, dedicated his life to the idea of ending inter-ethnic conflict. To speakers of Esperanto (or at least to me), he's a hero. First and foremost, he's a hero to Esperanto speakers in the same way that George Lucas is to Star Wars fans, and J.S. Bach is to people who enjoy pipe organ music: he created magnificent works of art (the language, along with his translations and original writings) that continue to bring us a lot of joy. It's not an exaggeration to say that the reason Esperanto succeeded in becoming a language spoken by tens of thousands of people (or whatever the number is) all over the world was Zamenhof's stubbornness and tenacity in promoting the language and creating, from the ground up, a literature for the language. Unlike the creators of other artificial languages, Zamenhof created not only a grammar and dictionary, but powerfully demonstrated that the language was suitable even for great works of literature by translating, among many other works, examples of Shakespeare and Charles Dickens and eventually even the entire Old Testament of the Bible. Zamenhof's early works and translations were able to serve as stylistic examples to other authors and translators, and the body of Esperanto literature snowballed, and became self sustaining.

Monday, August 18, 2014

Eating really cheap: a 50 cent meal, and why I think Soylent will never be a food for the poor (although it may help them indirectly)

Two of my major interests in life are eating delicious food and spending as little money as possible. So when I read about the Soylent project, which aims to produce an ultra-cheap food powder that meets all of a person's nutrition needs I was very much interested (about the ultra-cheap part and the nutritional needs meeting part, not so much about the tasteless powder part). My philosophy about food is much different than that of Soylent creator Rob Rhinehart, who states on his blog "In my own life I resented the time, money, and effort the purchase, preparation, consumption, and clean-up of food was consuming." Personally, I see the time I spend cooking as an adventure: an opportunity to learn and experiment. I rarely cook from recipes (although I do keep a notebook), and pretty much never eat the same thing twice. I see cooking as a kind of huge multivariable optimization problem with a complicated (and changing) objective function and no global optimum, but lots of local optima all over the place. I want to make food that is delicious, nutritious, cheap, and not monotonous, and I have fun trying to do that.

Wednesday, August 13, 2014

Chemspider python scripting

In the past, I've shown how to script Chemdraw and ChemAxon for the purposes of converting chemical information among different file formats. In this post I'll show how to achieve (vaguely) similar results using the ChemSpider web API. ChemSpider is nice because (unlike SciFinder) it is free, they don't mind if you reuse their data, and they don't mind if you access their website with scripts. Using ChemSpider has the advantage that it is a huge database and provides cross-references to other databases, it has images, mol files, and lots of other data about each compound.

Tuesday, July 29, 2014

Using SwissProt and ExPASy ENZYME to generate putative EC annotations for sequence data

There was a question on Biostars about how to make EC assignments based on sequence. I gave one of the answers, suggesting a few possible solutions. One of my solutions was to Blast against ExPASy ENZYME and base the annotations on the best hit from there. In this post I explain how to do that, and supply the necessary Python code.
[Note: PRIAM is another tool that assigns EC numbers to sequences based on the data in the ENZYME database. Instead of individual blast hits, it uses profiles built from multiple sequence alignments of peptides known to catalyze a given reaction. It's also a lot quicker to use than the method outlined here, so it's probably worth checking out first]

Sunday, July 27, 2014

Wikipedia (cat)

Here's a silly poem I wrote a few years ago. It comes with its own silly introduction. I think this is pretty much the apex of my poetical achievement, so if you're not a fan of it... well, it just goes downhill from here folks... Also, I'd love to see this turned into a music video, so if anyone with musical or artistic talent would like to collaborate on that, let me know and maybe we can make something really cool.

srj_chembiolib a set of scripts for doing Bioinformaticky type stuff

This post is to announce srj_chembiolib which in an uncreatively named set of scripts I've written to perform various bioinformatics (and hopefully eventually some cheminformatic) tasks that would otherwise be a pain in the rear to accomplish. Most of the scripts work both as libraries that can be imported into other scripts, and as stand alone command line scripts. Some depend on external libraries such as BioPython. Documentation is mostly found in block comments at the top of the script files. Where possible, for example with the scripts that manipulate fasta files, I've tried to make it so that multiple programs can be chained together with pipes on the command line to accomplish more complex tasks. I hope they're useful for someone.

Here's an overview of some (but not all!) of the scripts in the package: Converts Blast+ xml output to '-outfmt 6' style output (a tab separated form). Allows for some additional features not available in the standard outfmt 6, such as printing a line for query sequences that had no hits. Give it a fasta file and a list of strings, and it will give you a fasta file containing only those sequences whose names contain something from the list of strings as a substring. A class to read and store data from MassBank format text files, such as those used by MassBank, ReSpect, and Spektraris (my favorite database...). Reads a blast xml file and outputs the names of the top hits for each query sequence. There's an option for making a file listing the sequences the queries where the top hit matched in the reverse direction, which is useful, for example with Blastx, to determine whether a nucleotide sequence represents the coding strand, or the non-coding strand.

Monday, July 14, 2014

Head hair as a sensory organ

It's no mystery that hair acts to amplify the sense of touch. Everyone is familiar with the feeling of a bug crawling on their arm, and everyone who has ever gone swimming with a beard knows how much more pleasurable (like a million tiny hands gently pulling at your chin) it is than swimming without a beard. There are also more mystical ideas about long hair granting a kind of sixth sense.

I recently gave myself a buzz cut after letting my hair grow for about 2 years. My hair is moderately curly, so when it's long it poofs out an inch or two from my scalp. From my experience, I don't think long hair grants any kind of mysterious powers (nor do I think it has any effect on personality or intelligence, although people with certain personality traits may be more likely to choose to grow their hair long), but I was surprised to find that scalp hair does seem to contribute to spatial awareness. My evidence for this (which is admittedly circumstantial and has a low sample size, but this would be a very hard thing to test in a controlled environment, you can't very well have a "double blind" haircut) is that in the 24 hours after I cut my hair, I bonked my head into the wall twice. Once I was leaning over to put something in the trash can, and hit my head on the corner of the doorway that the can is next to. The other time I was in the shower and leaning around the too-hot stream of water to adjust the knobs. So I think scalp hair can function for people kind of like how whiskers function for cats.

I think that when I had poofy hair, I subconsciously used it to provide spatial information about the environment immediately around my head. Lacking that information, but not yet having had a chance to compensate by other means, my lack of hair temporarily increased my propensity to bonk into things.

Tuesday, June 24, 2014

maximum blastx tblastn translation length?

Blastx the sequence below against SwissProt. It has an orf that's 493 amino acids long, but the best hsp it turns up (from a protein that is completely identical to the orf) is 453 a.a. long. The same is true when you do tblastn the other way. However, when you first translate the orf (for instance here) and Blastp against SwissProt, you get an hsp covering the whole orf. What's going on here? Does Blast have a maximum length it stores translations at? Hopefully someday I'll have time to investigate this further, or maybe some knowledgeable stranger will pass by this blog and let me know. (edit: This seems to be a freak occurrence with this particular sequence. I have since noticed other Blastx searches to find longer hsps than this one. There is a truncated version of this protein in the NCBI Protein database so maybe that has something to do with it)

Friday, May 30, 2014

Milling lupins with a pasta maker machine

In an earlier post, I hypothesized that soaked lupin beans could be effectively dehulled with a pasta maker. Turns out, one of my co-workers has a pasta machine, so I finally got the chance to test this hypothesis. And it does in fact work, particularly after the beans have sprouted a little bit.

As is, the pasta machine is an improvement over hand de-hulling, but I think it could be improved. Set to maximum, the gap on this pasta machine is 2.5 mm, I'd like to try one with a 5 mm gap because this one kind of crushed the beans (although, I still think they'd make decent tempe in this state). The rollers are not grippy enough, (this would be less of a problem with wider spacing), you have to apply gentle pressure to the beans to get them to go through. The pasta machine lacks a hopper so beans have to be fed through fairly slowly and can't be piled up very high on the machine, if there were a hopper, the pressure of beans on other beans might be enough to make extra grip on the rollers unnecessary.

I don't think I'll actually end up using this method, because I suspect that dicing with a food processor will turn out to be cheaper and more effective, but it's certainly a viable strategy, and much preferable to hand hulling.

Thursday, May 29, 2014

Exporting diagrams from Dia into Microsoft Word or Powerpoint

Short answer: on Windows, export to "emf" format, then add the image to the document like you would any other image.

Tuesday, May 27, 2014

Lupin tempe and fried lupin hulls

Lupin tempe is highly touted, and apparently one of the most promising possibilities for expanding the presence of lupins in the human food supply. Tempe (or "tempeh", if you prefer the crude anglicization) is made by growing fungus, usually Rhizopus oligosporus (sometimes also with Rhizopus orzae and other minor components) on beans (usually soy beans, but a wide range of substrates are possible). Tempe is a traditional food in Indonesia and is recently becoming popular in Europe and North America. I've made soybean tempe several times and it's turned out well, so I was excited to try to make lupin tempe. Differences between soy and lupin that may make the process different are that lupins are tougher (more fiber, less oil) than soy beans and have a much thicker hull.

Monday, May 19, 2014

lupin sprouts

Sprouting lupins is not much different from sprouting any other kind of bean. In this post, I'll relate the sprouting method I used for Australian sweet lupins (which I purchased from Lupina), and highlight some differences I noticed between sprouting lupins and sprouting mung beans. Lupin sprouts are bigger and a bit tougher than mung sprouts, and their cotyledons are much more prominent. The sprouts don't have a strong flavor, but the cotyledons seem to have a faint cucumber taste to them. Any thing you can do with mung sprouts, I think you can do also with lupin sprouts. I made a salad from fresh sprouts, which was good. I also cooked some of them and put them in a stew, which was also good (although you can't really taste them in the stew...).

  1. Sort seeds to pick out rocks and remove any obviously damaged seeds.
  2. Soak seeds. 1-3 days. For most beans, 12 hours is sufficient. After 12 hours, more than half of the lupin beans will be nicely swelled, but a pretty good portion will still not be. The longer you soak for, the more beans will be swelled and ready to sprout. 3 days seemed to be long enough for 95% or more of the lupin beans to become swelled (I plan to look at this more scientifically in the future). I don't think over-soaking will effect germination rate, but it might be a good idea to change the water and let them breathe for a little while every day. Also, if you happen to have a wire mesh with about 0.6 cm between the wires, it should be easy to screen the unswelled beans from the swelled beans.
  3. After soaking, drain and put in a pot, or a large bowl, or any other large container with a cover. Put the cover on (I usually leave it open just a crack, the idea is to keep the humidity high, but you also don't want to suffocate them).
  4. Rinse and drain at least once every day. You need to be gentle with lupin sprouts, blasting them with water (as I do with mung sprouts) will cause the cotyledons to snap off which will prevent the sprout from growing any bigger (the cotyledons are what gives them the energy to grow).
  5. Do this for about 7 days, or until they are the desired size. At 7 days, some of them will have started making their first little leafs.
  6. Rinse, drain, eat, or refrigerate
  7. Do not attempt to remove the hulls. Sometimes with other beans, I remove the hulls by soaking the beans in a big pot of water and using my hands to agitate them so the hulls fall off, then just pouring the hulls off. Lupin hulls seem to be attached more firmly than the hulls of other beans. It's definitely possible to slip them off, but the only way I could find to get them off without also knocking the cotyledons off was to individually pull them off of each sprout. That was way more work than I was interested in doing, so I just left them on. The hulls are a bit chewy, which maybe some people won't like, but, it's good fiber, so you might as well just eat them...

Wednesday, May 14, 2014

lupin rejuvelac

Rejuvelac is a lightly fermented beverage with two ingredients: sprouted seeds (usually grains), and water. Making rejuvelac is really easy. All you do is soak the seeds over night, sprout them for 1 or two days, put them at the bottom of a pitcher, fill the pitcher with water, and let the pitcher sit on the counter for 2-3 days. If done well, it has a mild, refreshing, taste, which I can best compare to diluted lemon juice with a pinch of salt (this is a pretty crude approximation of the taste though, if you want to know how it tastes, I recommend making some yourself). It has a unique, but not unpleasant smell. The flavor seems to vary depending on the kind of seed used. It may also vary depending on the water used, but all I've ever used was local tap water, so I don't know.

Grains are by far the most common seeds to use as substrate. I've made it with spelt berries, and barley (the unhulled kind with a thick hull still on it). The spelt rejuvelac turned out better for me than the barley rejuvelac. The original version uses wheat berries. Sprout people recommend rye. But I've also seen references to people using legumes such as lentil or mung. So in the spirit of Dennis Moore, I figured, why not try lupins, and it wound up working ok. I use tap water exclusively because it's convenient, but other recipes I've seen, including the original, recommend using "purified water".

Lupin Rejuvelac
  • Soak 1/3 cup of dry lupin seeds for 24 hour
  • Drain off water and pick out unswelled seeds (if you soak these longer, they will actually swell eventually but in the interest of time, just take them out)
  • Let remaining seeds sprout for 24-48 hours, rinsing and draining every 12 hours or so (I sprouted for 36 hours, but I think that whenever the tails are at least as long as the bean, you should be ok) (the original recipe also specifically says not to rinse, so you can probably get away with skipping that step and it may give you a stronger brew)
  • Take out any seeds that didn't sprout
  • Cover sprouts with 2 quarts of water
  • let sit at room temperature for 4 days (I swirl it around about once a day, but that might not be necessary), or until the rejuvelac is as strong as you prefer.

I drain the finished rejuvelac off into another pitcher, then I refill the first pitcher and make another batch. After the second batch, I cook up the sprouts (which probably causes Ann Wigmore some postmortem restlessness, for which I apologize) and eat them with rice or quinoa.

Conclusion: Lupin actually makes decent rejuvelac, nevertheless, I drink it with a squirt of lemon. It's not as good as spelt rejuvelac, but better than barley rejuvelac. I'm sure the process could be optimized to make a better brew: for example by increasing the amount of sprouts, the sprouting time, or the rejuvelac incubation time. For the purposes of a dinner to be served to guests, I would be hesitant to include this on the menu, at least the current version of this, because it has a taste and smell that I think are too unfamiliar to most people. For myself, I may make it from time to time because it's an interesting flavor and I can cook up and eat the beans afterwards, so it's not as though it is a waste of good lupins.

Saturday, May 10, 2014

Lupin hummus

I have found that sweet lupin makes a fine substrate for hummus. The point of this post isn't to present an optimal hummus recipe, but merely to show that lupin can be used instead of chick pea, and the hummus will still be pretty good.

I made one batch of raw sprouted hummus, and one batch of cooked hummus.

Raw sprouted lupin hummus:
Soak seeds over night.
Remove unswelled seeds (I'll post later on how to deal with these)
Sprout the swelled seeds for 36 hours (put them in a bowl with a lid set lightly on top, rinse and drain every 12 hours).

Put in blender:
3/4 cup sprouts
2 tsp olive oil (or any other kind of vegetable oil)
1 clove of garlic
1 tsp fresh diced chives
1/2 tbsp lemon juice
pinch of salt

Blend, enjoy

Cooked lupin hummus:
Soak seeds over night.
Remove unswelled seedsboil swelled seeds for 2 hours (after 2 hours, they were still kind of tough, but it didn't seem to matter)

Put in blender:
3/4 cup sprouts
2 tsp olive oil (or any other kind of vegetable oil)
1 clove of garlic
1 tsp fresh diced chives
1/2 tsp of salt

Blend, enjoy

You'll notice that I put lemon juice in the raw hummus, and additional salt in the cooked hummus, but there's no reason you couldn't make a saltier raw hummus or a lemony cooked hummus. I was just experimenting (and you should too!). Both recipes worked. The cooked hummus is a bit richer, and the raw hummus is a bit fresher, which are the effects I was going for.

My hummus ended up being pretty coarse, and a little chewy. I think this could be solved by more thorough blending, possibly in the presence of additional oil. I was using a fairly inexpensive blender, and not filling the chamber all the way, so it didn't blend very well.

An issue with lupins is that they have a tougher hull than most other edible beans, and there isn't an easy way to remove the hull, so if you don't thoroughly cream the hummus, the hull fragments will contribute to a texture that is a bit unusual for hummus (although I personally don't find it unpleasant).

Sprouted lupins, ready to blend

Raw on the left, cooked on the right. The raw is a bit lighter color, but other than that, they looked the same to me.

Thursday, May 8, 2014

Ten Pounds of Lupins

So... I bought 10 lbs. of Australian Sweet Lupins from Lupina LLC. I intended to only buy 5 or 6 lbs, but they offer free shipping on orders more than about $40. Each pound of lupin is $4, and shipping was otherwise going to be $12, so by buying enough for free shipping I ended up with 3 lbs of free lupins (right?!). My 10 lbs was divided among 7 lbs of seeds, and 3 lbs of flour.
When I opened the box, there was flour everywhere (maybe 1/2 teaspoon total but well spread out so it looked like a lot), but none of the bags seemed obviously damaged. I immediately cut the flour bags open and dumped them into a big plastic container.

Friday, May 2, 2014

printing print-locked pdfs

software needed: ghost script, ghost view, foxit reader (or any other pdf reader, the print options in foxit seem to play better with my printer for doing things like printing multiple pages to one sheet).

open pdf with ghost view (GSview).
File->convert->device:pdfwrite->ok (default options seem to work fine)

open the generated file with foxit.
print the file

There are lots of other ways to do this also...

Thursday, May 1, 2014

Betel leaf tea: like drinking a dental office

I had the opportunity to eat some betel leafs today. My first impression was that it was like chewing on a spicy local anesthetic with a hint of black licorice. Which turns out to be pretty close to the truth. Betel is related to the plant that is the source of black pepper (hence the spiciness?), its oil contains eugenol (which is the major component of clove oil, is used as a local oral anesthetic, and is the source of the typical smell of dentists offices), and its oil contains anethole, one of the components of licorice root extract.

The initial chewing not being wholly unpleasant, I decided to make tea out of the betel leaf. The tea was much less strong than the leaf itself. I think from dilution and because the oil in betel leafs is held in glands in the middle of the leaf and the leaf is pretty tough and waxy, so the oil probably doesn't extract very well. The tea wasn't spicy at all, and had a much less powerful anesthetic effect. Drinking the tea gave an overall sensory experience similar to what I imagine one would experience if eating licorice in a dental office.

In 1999, there was actually a study published about how people associate the smell of eugenol with either positive or negative emotions depending on their attitude towards dental offices. Personally, I'm pretty indifferent towards dental offices, although I generally don't associate them with food, which is probably why I thought the betel leaf taste was pretty odd for a food. Also, I tend to prefer that my food not make my tongue go numb. However, given the huge popularity of betel leaf consumption in certain parts of Asia, I guess this is a cultural phenomenon. I wonder if people who spend more time chewing betel leafs than sitting in dental offices associate dental offices with betel leafs, and start getting cravings when they're having their teeth looked at.

Checking md5 sums for lots of files from Windows

I run a lot of local BLAST searches on Windows machines. When you download a blast database from NCBI, you should also download the md5 file so you can check that the downloaded file is exactly the same as the one on the server (sometimes there can be fidelity issues when transferring data). Linux has a handy tool for comparing md5 sums, called md5sum. Example.

Saturday, April 12, 2014

Finding a minimal set of English vocabulary with WordNet, Perl, and GLPK integer programming

This was my semester project for the class "Principles of Optimization" which was one of my absolute favorite classes that I took in college. It uses WordNet, which is a fantastic database for looking at relationships between English words, (it seems to be the basis of many online tools such as the Visual Thesuarus that is constantly advertised on, it was fun to see how the graphs I made for this project exactly matched the content of Visual Thesuarus, a website that seems to be just begging for an open-source ripoff...). To access WordNet, I used the Perl library WordNet::QueryData which seemed to work quite well. For the Integer Programming, I had a much harder time, I used the library Math::GLPK which has bugs that confused me for quite a while (I wish I remembered what they were, but I don't, all I remember is a general feeling of frustration with the library), if I were to redo this project, I'd take a different approach, maybe writing lp text files and solving with the glpk command line interface, or maybe using Python to interface with an IP solver. I used Cytoscape to generate the network graphs.

For those just here for example code for WordNet::QueryData, or Math::GLPK,
you can find it in a the perl file that you can download here. All others, Read On!

Monday, March 31, 2014

Python Numpy Munkres Hungarian matching algorithm

I didn't make this, but there is a numpy implementation of this algorithm available through scikit-learn in sklearn/utils/ . I'm glad I found it, as it seems to be about 4 times faster than the munkres package from PyPI (on which it is based, and which is the python implementation that comes up the most on google).


Tuesday, March 25, 2014

building a django app that uses ZeroMQ: an annotated webliography

I wanted to build a website that allows people to search their data against a database (in the not too distant future, when the website is live I'll link it and the source code and give more of an explanation. Edit: and here it is, the code, the ZeroMQ stuff is mostly at "/nmr/management/commands", and the website ). Each search takes a few seconds, so in order to be able to serve multiple clients at a time, and allow scaling, I wanted to build a system where the main wsgi process does not block, but passes the search request off to another process that puts it in a queue and executes requests in the queue one by one. I ended up following a simple approach using ZeroMQ. There is a scheduler that runs as a thread in the main wsgi process. When the search input view receives a search request, it writes the search parameters into the database and opens a connection to the scheduler thread and passes it the unique ID of the database record storing the search parameters. There are one or more worker processes each running as a subprocess. The workers are permanently attached via a socket to the scheduler. When a worker completes a job, the scheduler sends it the ID of the next job in the queue, the worker executes the job, writes the results in a database table, and tells the scheduler it is ready for another job. There can be many workers attached to the scheduler, so that multiple searches can be run concurrently.

Here then is a list of (some of) the websites I used for reference while writing this program.

Tuesday, March 18, 2014

ChemDraw ChemAxon synergy

In my previous post, I was complaining that there wasn't any free software with a nice command line interface to reliably convert molfiles to InChI strings, and back again. I also mentioned that there was an issue with the way ChemDraw converts structures to InChI strings that made it unacceptable for my purposes. The technical issue with ChemDraw is that it doesn't preserve the isoform of tautomers. Some of the molecules I'm interested in contain amides that are typically found in the amide form, rather than the imidic acid form. When I copy these molecules as InChI from ChemDraw, and then paste them back in, the amide is changed to the imidic acid form, which I don't want. It turns out that this is due to a feature of the InChI format (a format that is still mostly opaque to me) called "Mobile H Perception", where it simplifies a molecule encoding by not specifying the which tautomer it is (thereby saving 1 bit of information I guess). Many programs have the option to export InChI with Mobile H perception off, which is what I want, but I can't find that option in Chemdraw.

Automating Chemdraw: win32 com scripting with python pywin32

Once again I find myself adventuring in the land of Windows COM scripts. Last time I tried, with mixed success. This time, I'm using it to control ChemDraw to help me convert molecule formats. Anytime I use COM scripts, it feels pretty clumsy, like it would be a lot slicker just to have a command line utility, but in this case I couldn't find anything that seemed like it would work well enough (update: I later found out about ChemAxon Molconverter which is quite nice), so COM scripts it is. Python is currently the language I do general purpose programming in, and pywin32 works quite well for COM scripting.

The problem: I want to take molfiles from multiple sources and normalize them so that they can be rendered with the same style settings by chemdoodle web components. While I'm at it, I'd like to generate SMILES strings, InChI strings, and InChI key strings (I'd also like to generate IUPAC names, but I gave up on that part) for the molecules in these molfiles.

Thursday, January 30, 2014

Only listening to music in the right ear while working

I used to have a lot of trouble listening to music and doing homework or programming at the same time. It was distracting and I had trouble thinking while the music was going. Sometimes I'd have it on for tedious parts of a task and then when I got to a part that took a lot of careful thinking, I'd turn it down until I got to another boring part. I probably wasted a lot of time just flipping the music on and off. I also noticed that music with words was much more distracting than music without words, so sometimes I'd just listen to light orchestral music instead of the rock and folk I usually listen to.

In any case, what I noticed eventually is that if I listen to music through a headphone on my right ear only, I find it easier to tune out, and less distracting than when I use both ears, or just my left ear. In fact, I find having music in only the left ear to be rather obnoxious.

Why the right ear? It's hard to know, and with a sample size of one, and an investigation that is hardly double blind (or even single blind), it's not at all likely that I'll ever figure it out for sure. But it strikes me as an interesting phenomenon and there's no harm in speculating so here are some ideas:

It could be that the particular ear is not relevant, and the reason I favor one ear over the other is random. I don't remember quite when this habit started (sometime in the last 3 years I think), or why I originally chose to use only my right ear and not the left. It's possible that it was random, that I thought the music was too loud or distracting so I took one headphone off and it seemed better, so the next time I took the same one off even though it wouldn't have made a difference. However, I vaguely remember that even at the beginning the reason I chose the right ear is that the music was only unpleasant in my left ear, hence there was negative feedback encouraging me to remove the headphone from my left ear, but not from the right.

It may be that my right ear just happens to be slightly less sensitive than my right ear. This isn't at all obvious in everyday life, but perhaps there is some 5% or 20% difference in sensitivity peculiar to me.

My favorite, hypothesis, however is that it has something to do with the division of labor in the brain (and hopefully I don't fall victim to too many pop-neuroscience misconceptions here). I'm right handed, so when I type, use the mouse, or write or draw, as I would while working, my left hemisphere has to work harder than my right hemisphere. The left hemisphere contains the center for language, and it was the words in songs that I found most distracting, so maybe the one level of indirection is enough to prevent the music from unduly interfering with my internal dialog. Stretching a bit more, a lot of what I do is highly analytical (like computer programming, or math and science homework), so if the left brain is the center of logic then I may be relying on it more than on the right brain (when doing so called right-brain centric activities, especially drawing, but also writing poetry, I often listen to music from speakers or with both headphones, so there may be some connection there too).

Google turns up a few other reports of things like this on this, but it's all anecdotal (although I haven't yet tried to search the scientific literature, maybe there is something there, not sure how much of it I'd understand though).

What about you, oh vast teeming readership, do you think this is a real phenomenon? Or is it just stochastic noise (pun intended!) and confirmation bias?