Changeset 1778:a94aec22f398 in orange-bioinformatics for _bioinformatics/obiDictyMutants.py


Ignore:
Timestamp:
05/07/13 09:58:15 (12 months ago)
Author:
Flashpoint <vid.flashpoint@…>
Branch:
default
Message:

Added pickling to obiDictyMutants.py, changed the URL in obiGeneSets.py's omimGeneSets()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • _bioinformatics/obiDictyMutants.py

    r1776 r1778  
    22import urllib2 
    33import shutil 
     4import cPickle as pickle 
    45 
    56from collections import defaultdict 
     
    2728    def __init__(self, local_database_path=None): 
    2829        self.local_database_path = local_database_path if local_database_path is not None else self.DEFAULT_DATABASE_PATH 
     30        self.local_pickle_path = os.path.join(self.local_database_path, "Mutants.pkl") 
    2931 
    3032        if not os.path.exists(self.local_database_path): 
    3133            os.mkdir(self.local_database_path) 
    3234             
    33         _mutants = self.prepare_mutants() 
     35        if not os.path.exists(self.local_pickle_path): 
     36            self.prepare_mutants() 
     37        else: 
     38            self._mutants = pickle.load(open(self.local_pickle_path, "rb")) 
    3439  
    3540    def update_file(self, name): 
     
    7580        
    7681        self._mutants = {x: x for x in _mutants} 
     82        pickle.dump(self._mutants, open(self.local_pickle_path, "wb"), -1) 
    7783 
    7884    @classmethod 
Note: See TracChangeset for help on using the changeset viewer.