Differences between revisions 12 and 13
Revision 12 as of 2008-11-15 09:16:02
Size: 1950
Editor: localhost
Comment: converted to 1.6 markup
Revision 13 as of 2009-09-15 21:44:35
Size: 2673
Editor: ljvpn
Comment: Adding BioJava in Jython Example
Deletions are marked like this. Additions are marked like this.
Line 46: Line 46:


=== BioJava ===
Bioinformatic analysis using [[http://biojava.org|BioJava]] can be simplified using Jython.
A Genebank file, like the once used to describe the Chromosome in the Human Genome, can be open and parsed with a few lines of Jython.
{{{
#!/usr/bin/env jython

import sys
from java.io import *
from java.util import *
from org.biojava.bio import *
from org.biojava.bio.seq.db import *
from org.biojava.bio.seq.io import *
from org.biojava.bio.symbol import *

if __name__ == "__main__":
    br = BufferedReader( FileReader( sys.argv[1] ) )
    sequences = SeqIOTools.readGenbank(br)
    while sequences.hasNext():
        seq = sequences.nextSequence()
        print seq.seqString()
}}}

Other Examples in Jython

DocumentationAndEducation


Log4j

  • This is a simple Log4jExample that show how to use this excellent logger with Jython. Yes, Python provides a logger but log4j can be used for debugging apache stuff. What ever you use loggers use its better then using print statements. You can get log4j from http://logging.apache.org/log4j/1.2/download.html

Apache Poi

  • No this isn't really bad Hawaiian food but a really slick way to write out Excel xls and other Microsoft Office format files with out have to have any microsoft software installed. Poi is really slick Java API and pretty easy to use. Take a look at the PoiExample and to download it and get more information on Poi and visit http://poi.apache.org/

PyServlet

See Sean McGrath's PyServlet Turorial for an introduction. Below are a couple of examples:

Simple:

   1 from javax.servlet.http import HttpServlet
   2 
   3 class Simple(HttpServlet):
   4     def doGet(self, request, response):
   5         response.setContentType("text/plain")
   6         response.getWriter().println("Veni, vidi, vici!")

Using servlet context:

   1 from javax.servlet.http import HttpServlet
   2 
   3 class Simple(HttpServlet):     
   4     def doGet(self, request, response):
   5         response.setContentType("text/plain")
   6         response.getWriter().println(self.getServletContext().getServerInfo() +
   7                                      " Veni, vidi, vici!")

Apache Derby

ApacheDerby Example(s)

Apache Derby is a Java relational database management system that can be embedded in Java programs and used for online transaction processing. for more information on Apache Durby see http://db.apache.org/derby/index.html or http://en.wikipedia.org/wiki/Apache_Derby

BioJava

Bioinformatic analysis using BioJava can be simplified using Jython. A Genebank file, like the once used to describe the Chromosome in the Human Genome, can be open and parsed with a few lines of Jython.

import sys
from java.io import *
from java.util import *
from org.biojava.bio import *
from org.biojava.bio.seq.db import *
from org.biojava.bio.seq.io import *
from org.biojava.bio.symbol import *

if __name__ == "__main__":
    br = BufferedReader( FileReader( sys.argv[1] ) )
    sequences = SeqIOTools.readGenbank(br)
    while sequences.hasNext():
        seq = sequences.nextSequence()
        print seq.seqString()

OtherExamples (last edited 2011-04-04 18:53:37 by c73-102)