[BioRuby] BioRuby's Bio::FlatFileIndex compatibility with BioPerl's Bio::DB::Flat
Aidan Findlater
aidanfindlater at gmail.com
Fri Jul 20 18:54:43 UTC 2007
*Summary:* Attached is a diff that allows Bio::FlatFileIndex to access BDB
flatfile databases created by BioPerl. I have not changed the way BioRuby
creates its databases, so this likely breaks access to BioRuby-created
flatfiles.
*Description:* I have some flatfile databases that were created with
BioPerl, but it seems that BioRuby does things a little differently.
Specifically, BioRuby tries to get config and fileid information from BDB
databases; BioPerl stores this information in config.dat.
As well, it returns sequences shifted one character to the right (the '>'
from my FASTA file was at the end of the returned sequence, and none was at
the beginning).
I've hacked it up so that it works for me. If anyone else is having this
problem, the diff from my changes is attached below. Sample usage:
Bio::FlatFileIndex.open('/path/to/the/database/directory') do |db|
p db.search("SPAC11H11.06") # My favourite pombe gene!
end
Now I just have to figure out what to do with
the Bio::FlatFileIndex::Results mess that is returned...
Aidan Findlater
Index: bioruby/lib/bio/io/flatfile/index.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/io/flatfile/index.rb,v
retrieving revision 1.19
diff -r1.19 index.rb
561c561
< seek(pos, IO::SEEK_SET)
---
> seek(pos-1, IO::SEEK_SET)
1147,1148c1147,1148
< @config = BDBwrapper.new(@dbname, 'config')
< @bdb_fileids = BDBwrapper.new(@dbname, 'fileids')
---
> @config = hash.reject{|k,v| k.include?("fileid_") }
> @bdb_fileids = hash.reject{|k,v| !k.include?("fileid_") }
1196,1199d1195
< @config.close
< @config.open(*bdbarg)
< @bdb_fileids.close
< @bdb_fileids.open(*bdbarg)
1229,1232d1224
< if @bdb then
< @config.close
< @bdb_fileids.close
< end
1287c1279
< @fileids = FileIDs.new('', @bdb_fileids)
---
> @fileids = FileIDs.new('fileid_', @bdb_fileids)
More information about the BioRuby
mailing list