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

Chris Fields cjfields at illinois.edu
Tue May 18 16:25:11 UTC 2010


On May 18, 2010, at 10:57 AM, Adam Sjøgren wrote:

> On Tue, 18 May 2010 10:28:06 -0500, Ben wrote:
> 
>> is there a 'best practice' way to do something like this?
> 
> The only one I can think of is "Don't make up your own format unless you
> really, really have to".
> 
>> 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?
> 
> I would use YAML or JSON if I had to look at it "by hand" or if it had
> to be somehow portable. I would prefer those over CSV, which hasn't
> necessarily got well-defined handling of special chars, whitespace etc.
> 
> If speed is more important, I think the Storable module is quite a bit
> quicker, but the format is "binary".
> 
> 
>  Best regards,
> 
>    Adam
> 
> -- 
>                                                          Adam Sjøgren
>                                                    adsj at novozymes.com

Yes, that in combination with a AnyDBM tied hash would work (essentially what Bio::SeqFeature::Collection is under the hood).

chris



More information about the Bioperl-l mailing list