Commits

Flashpoint committed a94aec2

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

  • Participants
  • Parent commits ab15a6b

Comments (0)

Files changed (2)

File _bioinformatics/obiDictyMutants.py

 import os
 import urllib2
 import shutil
+import cPickle as pickle
 
 from collections import defaultdict
 
 
     def __init__(self, local_database_path=None):
         self.local_database_path = local_database_path if local_database_path is not None else self.DEFAULT_DATABASE_PATH
+        self.local_pickle_path = os.path.join(self.local_database_path, "Mutants.pkl")
 
         if not os.path.exists(self.local_database_path):
             os.mkdir(self.local_database_path)
             
-        _mutants = self.prepare_mutants()
+        if not os.path.exists(self.local_pickle_path):
+            self.prepare_mutants()
+        else:
+            self._mutants = pickle.load(open(self.local_pickle_path, "rb"))
  
     def update_file(self, name):
         url = "http://dictybase.org/db/cgi-bin/dictyBase/download/download.pl?area=mutant_phenotypes&ID="
             if mutant.name in the_others: mutant.other = True
        
         self._mutants = {x: x for x in _mutants}
+        pickle.dump(self._mutants, open(self.local_pickle_path, "wb"), -1)
 
     @classmethod
     def get_instance(cls):

File _bioinformatics/obiGeneSets.py

     """
     Return gene sets from OMIM (Online Mendelian Inheritance in Man) diseses
     """
-    from . import obiOMIM    # The link here leads to a redirection... should replace it with the new URL
+    from . import obiOMIM    
     genesets = [GeneSet(id=disease.id, name=disease.name, genes=obiOMIM.disease_genes(disease), hierarchy=("OMIM",), organism="9606",
-                    link=("http://www.ncbi.nlm.nih.gov/entrez/dispomim.cgi?id=" % disease.id if disease.id else None)) \
+                    link=("http://www.omim.org/entry/%s" % disease.id if disease.id else None)) \
                     for disease in obiOMIM.diseases()]
     return GeneSets(genesets)