Install BioShell
Do you have JAVA?
|
To use any BioShell tool you need to have JAVA installed. So open a terminal (or DOS command prompt in Windows) and type: java. If you see a documentation for command-line options of JAVA executable, than you can go directly to the next section. Otherwise go to JAVA installation page on Sun website and download Java Runtime Environment - at least in version 1.5. If you have access to root account on your machine, you can install JRE for all users, e.g. in |
In brief |
/usr/java/jdk1.5.0_06/jre
. If not, you can do it on your account, e.g. in
/home/john/bin/jre
. Remember to edit your
.bashrc
or
.bash_profile
script and add JAVA
bin
directory to your PATH shell variable:
PATH=$PATH:/usr/java/jdk1.5.0_06/jre/bin
or:
PATH=$PATH:/home/john/bin/jdk1.5.0_06/jre/bin
depending on where you have installed JRE.
Installing BioShell toolkit
Download BioShell distribution:
| file name | version | description | deposition date |
|---|---|---|---|
| jbcl-2.1.jar | 2.1 | Contains java classes for 2.1 version of the BioShell package. | 20 XII 2008 |
| monomers-2.1.jar | 2.1 | Provides library of monomers' geometry | 20 XII 2008 |
| jbcl-API-doc-2.1.tar.gz | 2.1 | API documentation | 20 XII 2008 |
then simply copy the downloaded files to the directory of your choice, e.g. to /home/john/bin/BioShell:
When the destination directory contains jbcl and monomers libraries, you have also to set up CLASSPATH shell variable, by adding the following line to your startup script. For example, if your shell is bash, add them to .bashrc. The file names added to CLASSPATH must be of course as the files in your local directory.
CLASSPATH=$CLASSPATH:/home/john/bin/BioShell/jbcl-2.1.jar: \ /home/john/bin/BioShell/monomers-2.1.jarexport CLASSPATH
Now you can use all BioShell command-line tools: Strc, StrCalc, Seq, Clust, RmsCalc or Trac. Just type: java RmsCalc to see command-line help for a given program (in this case RmsCalc)).
BioShell scripting library
Jython
With the new BioShell distribution it is possible to access all its objects from a (more or less) Python level. What does it mean? Well, it can be python, although implemented in java. This tool is called Jython and can be obtained from its website. Download an installer class (currently the newest version is jython_installer-2.2.1.jar) and launch it - usually double click should work. If not try:
java -jar jython_installer-2.2.1.jar
(Click on the screenshots below to enlarge)
To make you life easier you may add Jython to your PATH variable. Now you can type jython to get a console that behaves as a regular Python would. At first run, Jython will look for all jar files on your classpath which may take a while. Finally you can try to type some Python commands at Jython prompt:
>>> print 'hello world',1+1*(3-1) hello world 3
BioShell scripts
In your scripts run by Jython you can use Python syntax and BioShell packages as Python modules. For a test, put the following code in a bioshell_info.py file:
from jbcl.util import JBCLInfo info = JBCLInfo.getInfo() print "This BioShell installation is based on", info.getSVNVersion() ," SVN snapshot" print "Last compilation on:", info.getSVNTime()
Once you execute the script by typing jython bioshell_info.py you should get an output similar to the following:
This BioShell installation is based on 497 SVN snapshot Last compilation on: 2007-10-30 23:18:42 -0400 (Tue, 30 Oct 2007)
It is also a good idea to start a Jython script from the following line:
#!/bin/env jython
for example:
#!/bin/env jython from jbcl.util import JBCLInfo info = JBCLInfo.getInfo() print "This BioShell installation is based on", \ info.getSVNVersion() ," SVN snapshot" print "Last compilation on:", \ info.getSVNTime()
Then, if you make your script executable, you won't need to invoke Jyton. Just to type:
./bioshell_info.py
OutOfMemoryError in JAVA
Sometimes your command (either execution of BioShell application or a jython script) may end up with the following message:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
This is because all java applications (in particular Jython, which is a Python interpreter written in JAVA) are executed in a sandbox, called JAVA virtual machine (JVM). For security reasons, JVM limits the amount of RAM that any application may allocate. If your program exceeds this limit, it will be killed. You can however adjust the limit by yourself. In the case of command-line BioShell programs, simply start typing your Trac command with:
java -Xmx1000m Trac
where -Xmx1024m sets up one gigabyte (1024Mb) memory limit for Trac application
In the case of Jython scritps the solution is more tricky. First, you have to find your jython executable. This is a quite short text file that looks more or less as below:
#!/bin/sh # This file was generated by the Jython installer # Created on Wed Nov 07 11:52:40 EST 2007 by john CP="/home/john/bin/jython/jython.jar" if [ ! -z "$CLASSPATH" ] then CP=$CP:$CLASSPATH fi "/home/john/bin/jdk1.6.0_02/jre/bin/java" -Dpython.home="/home/john/bin/jython" \ -classpath "$CP" org.python.util.jython "$@"
The only thing you must change is to add -Xmx1024m in the last line of this script. After that the whole script should look as follows:
#!/bin/sh # This file was generated by the Jython installer # Created on Wed Nov 07 11:52:40 EST 2007 by john CP="/home/john/bin/jython/jython.jar" if [ ! -z "$CLASSPATH" ] then CP=$CP:$CLASSPATH fi "/home/john/bin/jdk1.6.0_02/jre/bin/java" \ -Xmx1500m -Dpython.home="/home/john/bin/jython" \ -classpath "$CP" org.python.util.jython "$@"
Useful links
The following sites may be useful in learning python:
- Python official site: www.python.org
- Jython official site: www.jython.org
- Dave Kuhlman's Jython tutorial is available here
- "Dive Into Python" - excellent free book introducing into Python programming, available also in Polish from here.
- "Python 2.4 Quick Reference".
- BioShell API documentation and example scripts





