A lot of my work has used the Java Ensembl API for reasons that have more to do with inherited code than anything else. I’m not attached to Java itself, as it’s the 30th+ language I’ve used in my life. But, since it’s here, and since it’s been broken by the hg19 versions of the database, apparently, I need to delve in and fix the ensj API to get things back on track.
It’s a daunting project, and I have no idea if I can make it work, but I said I’d give it a try, and spend 2 hours on it.
So, here are the steps it takes to get it working, as best as I can figure out.
[Edit: just after posting this, I found a bunch of the jar files on the web, as used by the ensj project: http://cvs.sanger.ac.uk/cgi-bin/viewvc.cgi/ensj-web/lib/?root=ensembl) Hopefully that might save someone else some time.]
1. download the sourcecode.
I found it here: A Zipfile archive. I had to click on download to get the zip file. You can then use unzip to inflate it back to original size. I chose to open it in Eclipse, as it is the environment I’m most familiar with. I did notice it is missing a build.xml file, however. I’ll ignore that for now.
2. download Colt
Once you do an initial compile in Eclipse, you can see a whole lot of errors from missing libraries. The first one I noticed was the “colt library”, a set of utilities for high performance java. I found it at the lbl.gov site on page of releases for the colt library.
I downloaded it, un-tarred it (untar xzvf colt-1.2.0.tar.gz), and then built it by using the “ant build” command in the colt directory. I was then able to add the colt.jar library as an external library in the eclipse IDE. (It threw a lot of warnings for un-mappable characters, but I believe it was just a fancy non UTF8 copyright sign in the comments – I ignored the warnings.)
3. Gnu Getopt is missing
Next step is to download the GNU Getopt library ported to java. I found that on a rather obscure download page, but it seems to fix the problem. Again, the jar file was added as an external library in eclipse.
Ok, this one doesn’t make a lot of sense to me, but I was able to track down the Jgoodies look and feel library… I haven’t gotten this working yet…. I’ll come back to it below.
Why java needs a python interpreter? No clue.
I had to download an installer (http://www.jython.org/downloads.html), which can then be used on the command line (java -jar jython_installer-2.5.2.jar –console) to download a single jar file (option 9). Beware, tho, if you tell it to install to the directory in which you’ve currently run the jar installer, it actually deletes itself then halts. Not a brilliant piece of software engineering. in the end, you do get a jar file, however. Again, added as an external jar in eclipse.
This seems to come from something called JavaMail. Again, I’m totally clueless as to why ensj needs this package, but I did find a download on the Javamail page. Again, it can be compiled with “ant build”, and again it can be added as an external jar in eclipse.
This one was easy, I just added the mysql jdbc driver from my VSRAP project.
8. missing methods for ConnectionWrapper.
I cheated on this one. I used Ensemble’s help to solve the problem. By right clicking on the error in ConnectionWrapper.java, and picking “add missing methods”, the missing bits were filled in for me. I did have to delete a duplicated setTypeMap() function, but that was just a minor stumbling block.
At this point, I’m down to 16 errors remaining.
9. jgoodies (revisited)
I decided to cheat on this one too. Instead of compiling from source, I found a jar version of it (http://www.java2s.com/Code/Jar/JKL/Downloadjgoodiesplasticjar.htm). unzipping and adding this does seem to fix the problem.
11. More missing methods.
Again, I cheated to solve these – ConnectionPoolDataSource was missing methods, which eclipse solved for me. right clicking on it and adding in the missing methods solved the problem.
11. Deprecated methods.
I always use eclipse with strict compile settings, so these all came up as errors. However, that can be changed. Under properties, go to Java Compiler, Errors/Warnings, and change the “dprecated and restricted API” from error to warning, and these will all dissapear.
TADA! I now have an ensembl 39 ensj instance that builds! 1 hour and 28 minutes later.