[BioRuby] using Bio::FlatFileIndex

Schwach Frank Dr (CMP) F.Schwach at uea.ac.uk
Mon Dec 10 17:21:31 UTC 2007


Hi,

I need to retrieve sequences from fasta files. In Perl I used to do this with Bio::DB:fasta but at first I couldn't find an equivalent in Bioruby and was almost about to give up and use Perl for this purpose when I found Bio::FlatFileIndex. 
Unfortunately, this class is not very well documented (unless I missed something). I think I can more or less figure out most of it from the code and the comments in the rdoc (http://bioruby.org/rdoc/classes/Bio/FlatFileIndex.html) but it would really be great to have some examples from people who are more familiar with this class, especially since I am relatively new to Ruby still.

What I want to do is simply:

1) Build an index for a directory containing a few fasta files
2) In a Rails App (or any other Ruby script): retrieve sequences by their accessions and update the index if the fasta db is updated by the user.

Some of the questions I have are:
What are the options that I can pass to the makeindex method?
In Bioperl it is possible to retrieve a subsequence straight away like this:

 my $seq_db_obj = Bio::DB::Fasta->new($path_to_db); 
 my $seq = $seq_db_obj->seq($accession, $start, $end) ; # retrieve (sub)sequence from the database

Can I do this in Ruby too or would I retrieve the entire sequence and then get the subsequence from that?

Any help and examples welcome!
Thanks a lot!




More information about the BioRuby mailing list