[Bioperl-l] storing/retrieving a large hash on file system?

Chris Fields cjfields at illinois.edu
Tue May 18 16:22:09 UTC 2010


On May 18, 2010, at 10:28 AM, Ben Bimber wrote:

> this question is more of a general perl one than bioperl specific, so
> I hope it is appropriate for this list:
> 
> I am writing code that has two steps.  the first generates a large,
> complex hash describing mutations.  it takes a fair amount of time to
> run this step.  the second step uses this data to perform downstream
> calculations.  for the purposes of writing/debugging this downstream
> code, it would save me a lot of time if i could run the first step
> once, then store this hash in something like the file system.  this
> way I could quickly load it, when debugging the downstream code
> without waiting for the hash to be recreated.
> 
> is there a 'best practice' way to do something like this?  I could
> save a tab-delimited file, which is human readable, but does not
> represent the structure of the hash, so I would need code to re-parse
> it.  I assume I could probably do something along the lines of dumping
> a JSON string, then read/decode it.  this is easy, but not so
> human-readable.  is there another option i'm not thinking of?  what do
> others do in this sort of situation?
> 
> thanks in advance.
> 
> -Ben

Would a simple DB_File tied hash work?

chris




More information about the Bioperl-l mailing list