[BioPython] gui + pickling

Brad Chapman chapmanb@arches.uga.edu
Mon, 15 May 2000 01:22:01 -0400


>  Maybe, Brad and I should coordinate our experiments, because I 
started a
> gui prototype and I was thinking of how to add persistence. 

Sure, as long as I don't have to do any GUI programming :-). 
    Using the pickle and shelve modules for implementing python 
persistance is very nice and simple. I would be happy to work with you 
on adding this kind of persistance for your gui classes.
    All I'm doing right now is much more straightforward than your 
design. I just have a list of sequences and I just pickle it to a 
file, ie.

seq1 = Seq(blah, blah)
....
seq_list = [seq1, seq2, seq3]

file = open(SEQ_FILE, 'w')
cPickle.dump(seq_list, file)
file.close()

And this dumps the whole python data structure to the file SEQ_FILE. 
Then next time you start up a program you can load it right back up:

file = open(SEQ_FILE, 'r')
seq_list = cPickle.load(file)
file.close()

and use the seq_list like it was never pickled (oh, except of course 
that it will fail translation assertions :-).
    The shelve module is similar, but works in a dictionary type 
manner so that you can shelve different things to a file with specific 
keys and then reload them in any order using the keys.
    But, I would definately be happy to work with you on your 
persistance ideas. I think it would be quite possible, you'd just need 
a class with the different objects, and then create an instance of the 
class, assign the objects, and then pickle the instance like I did 
above with the seq_lists I was working with. It should be very 
possible :-)

> The prototype
> gui is at bio.perl.org/pub/katel/biopython/Bio/ on ftp.  The gui is a
> first cut.  A first cut is all I can do at this time:), but  I just
> received a Tkinter manual in the mail.  Hopefully, this summer, I 
can curl
> up with the Tkinter book, while I'm camping on weekend.

Looks nice :-) Also, if you are interested in GUI programming, we are 
also working on GUI type stuff for bioinformatics on the Loci project 
at The Open Lab (http://theopenlab.uml.edu/loci/), but we are using 
the pyGTK and pyGNOME user interfaces and not Tk. Jeff Bizzaro, the 
head honcho on that project, has some really broad ideas for 
encompassing lots of different bioinformatics (and non-bioinformatics) 
programs and allowing them to work together through a common user 
interface. Anyways, just thought I would make a plug since you are 
interested in that kind of stuff :-)

Brad