Hi everyone,
I'am searching for a fast and convenient way to store and retrieve biological data from large data files (>2GB) but
I can't use any RDBMS etc, just flat files.
First I stored the complete file in XML format. To fetch particular datasets I had to read in the file completely (in worst case).
Then I read about DB_File/BerkeleyDB and figured that it might be useful. I tried it with a smaller description file (~50MB)
and everything seemed to work quite nice and search time was significantly improved.
But then I tried one of the bigger files (1.2GB) and had to stop my script after 15 minutes because the resulting database file
was already >6GB!
My questions are:
1. Is it my code that's going wrong for large files(see code below)?
OR
2. Is it a typical behavior of File_DB and huge datafiles, i.e. normal that the output file is more than 6 times bigger than the datafile?
AND IF SO
3. Is there a better solution? (I read something about File::Tie instead of DB_File tie...)
I appreciate any help.
Cheers,
Lowry
# Takes the output directory name $annotationDirName
# and a hash-ref of all attribtues of a sequence and
# adds it to database '$annotationDirName/annotation.dat'.
# Given attribute hash is stored as hash-dump.
sub _printAnnotation{
my ($annotationDirName,$h) = @_;
# create new Berkeley_DB
my %database;
tie %database, 'DB_File', "$annotationDirName/annotation.dat" or d
+ie "Can't initialize database: $!\n";
my $dump = Data::Dumper->new([$h],[qw($annotation)])->Purity(1)->D
+ump();
$database{$h->{'id'}} = $dump;
untie %database;
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.