[BioRuby] Beautiful code for Bioinformatics

Mic mictadlo at gmail.com
Fri Feb 17 01:22:03 EST 2012


Hi all
D currently has some problems, because many projects
http://www.dsource.org/projects/ are no any more in active developed. The
other problem is that Tango has also stooped. On other hand it sounds good,
because you can access C, C++ and it is native language. Therefore it
should uses less memory compare to Java eg.
http://biostar.stackexchange.com/questions/10376/how-to-efficiently-parse-a-huge-fastq-file
.

The Qt people think that they have removed all pitfalls in C++. Whether is
true or not and how efficient the code with Qt is I do not know.

I worked with Scala for a while, but I have found the language quite
difficult to learn and also other people complain about it too. The other
problem with Scala is that it is not possible to copy a little Java code in
to Scala.

Then I discover Groovy a very similar language to Ruby and easier to learn
compare to Scala. The advantage of Groovy is that it is possible to copy
Java code without to modefing it to Groovy. I have not tried out Groovy++
which is as fast as Java. Unfortunately, I run few month back with Groovy
in to problems see http://jira.codehaus.org/browse/GROOVY-4851.

Other Ruby like static language which I discover is
http://www.mirah.org/wiki/MirahFeatures .

Cheers,

On Tue, Feb 14, 2012 at 6:24 PM, Pjotr Prins <pjotr.public14 at thebird.nl>wrote:

> On Mon, Feb 13, 2012 at 11:46:26AM +0100, Raoul Bonnal wrote:
> > in this ML I found that the quality of code and its beauty increase
> > only if you chat/talk with people and you are available to accept
> > critics and contributes.
>
> I feel we can keep the momentum going if we use this list as a more
> general outlet of our personal development. It may be a metamorphosis
> of the old style of ML. Bio* is no longer about specialized libraries,
> it is mainly about the problem of software development in biology. I
> feel Ruby attracts the right type of people - that is why we have
> 'beautiful code' in the subject ;).
>
> The ML is the first place to share information. This is what new
> potential recruits may find interesting. Have them find us.
>
> In that vein I am presenting another piece of beautiful code, the
> omnipresent FlatFile handler of BioRuby. See
>
>  https://github.com/bioruby/bioruby/blob/master/sample/any2fasta.rb
>
> e.g.
>
>  ARGV.each do | fn |
>    ff = Bio::FlatFile.auto(fn)
>    ff.each_entry do |entry|
>      if regex != nil
>        next if eval("entry.seq !~ #{regex}")
>      end
>      print entry.seq.to_fasta(entry.definition,70)
>    end
>  end
>
> which does a lot of work in a few lines, with remarkable flexibility!
> Including automatic data format checking and a runtime defined regex
> search.
>
> Nowadays we would probably do it a little different. The eval can be
> taken out of the loop and the regex compiled (in a Pythonesque way).
> Also both each_entry and the Sequence objects should be lazy (it is
> not underneath) and properly iterate to avoid loading everything in
> RAM and parsing too much. But hey, it is still a great example what
> what we can do with Ruby anyway!
>
> I wrote this simple example any2fasta.rb 6 years ago, but the FlatFile
> and Sequence code is not mine. It is mostly by Toshiaka and Naohisa
> going all the way back to 2002. So the beautiful code is really by
> those two geniuses who are at the heart of the BioRuby project.
>
> Pj.
> _______________________________________________
> BioRuby Project - http://www.bioruby.org/
> BioRuby mailing list
> BioRuby at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioruby
>


More information about the BioRuby mailing list