Commits

Marko Toplak committed 7113883

Fixes for obiGeneSets. Compatible files were generated and uploaded to SF.

Comments (0)

Files changed (3)

_bioinformatics/obiGeneSets.py

     """
     Return gene sets from miRNA targets
     """
-    from . import obimiRNA, obiKEGG
-    org_code = obiKEGG.from_taxid(org)
+    from . import obimiRNA, obiKEGG2
+    org_code = obiKEGG2.from_taxid(org)
     link_fmt = "http://www.mirbase.org/cgi-bin/mirna_entry.pl?acc=%s"
     mirnas = [(id, obimiRNA.get_info(id)) for id in obimiRNA.ids(org_code)]
     genesets = [GeneSet(id=mirna.matACC, name=mirna.matID, genes=mirna.targets.split(","), hierarchy=("miRNA", "Targets"),
     for collection in args:
         try:
             result.update(collection)
-        except ValueError:
+        except (ValueError, TypeError):
             if issequencens(collection): #have a hierarchy, organism specification
                 new = load(*collection)
                 result.update(new)
 
     from . import obiKEGG2 as obiKEGG
 
-    #genesetsfn = [ keggGeneSets, goGeneSets, miRNAGeneSets]
-    genesetsfn = [ goGeneSets, miRNAGeneSets]
+    genesetsfn = [ keggGeneSets, goGeneSets, miRNAGeneSets]
     organisms = obiTaxonomy.common_taxids()
     for fn in genesetsfn:
         for org in organisms:
                 genesets = fn(org).split_by_hierarchy()
                 for gs in genesets:
                     print "registering", gs.common_hierarchy()
-                    #register(gs, rsf) #server files
-                    register(gs)
+                    register(gs, rsf) #server files
+                    #register(gs)
                     print "successful", gs.common_hierarchy()
             except (obiKEGG.OrganismNotFoundError, GenesetRegException):
                 print "organism not found", org
 
-
 if __name__ == "__main__":
     rsf = orngServerFiles.ServerFiles(username=sys.argv[1], password=sys.argv[2])
     upload_genesets(rsf)

_bioinformatics/obiKEGG2/__init__.py

 def from_taxid(taxid):
     genome = KEGGGenome()
     res = genome.search(taxid)
-    print taxid, res
     for r in res:
         e = genome[r]
         

_bioinformatics/obimiRNA.py

             return [e for e in IDs if e.split('-')[0]==taxid]
                 
         else:
-            raise miRNAException("ids() Error: Check the input value.")
-
-            
+            from . import obiKEGG2
+            raise obiKEGG2.OrganismNotFoundError(taxid)
         
 class mat_miRNA:
     pass