orange-bioinformatics / server_update / updateDictyBase.py

##interval:7
from common import *

import sys, os
from gzip import GzipFile
import tempfile
from Orange.bio.obiDicty import DictyBase
import Orange.bio.obiDictyMutants as DictyMutants

tmpdir = tempfile.mkdtemp("dictybase")
base = DictyBase.pickle_data()
filename = os.path.join(tmpdir, "tf")

f = open(filename, 'wb')
f.write(base)
f.close()

dom = DictyBase.domain
fn = DictyBase.filename

try:
    sf_server.create_domain('dictybase')
except:
    pass

print filename

sf_server.upload(dom, fn, filename, title="dictyBase gene aliases",
    tags=DictyBase.tags)
sf_server.unprotect(dom, fn)

shutil.rmtree(tmpdir)


"""
Orange server upload for DictyMutants 
"""

tmpdir_mutants = tempfile.mkdtemp("dictymutants")
base_mutants = DictyMutants.download_mutants()
file_mutants = os.path.join(tmpdir_mutants, "tempMut")

fm = open(file_mutants, "wb")
fm.write(base_mutants)
fm.close()

fm_dom = DictyMutants.domain
fm_name = DictyMutants.pickle_file

print file_mutants

sf_server.upload(fm_dom, fm_name, file_mutants, title="dictyBase mutant collection",
    tags=DictyMutants.tags)
sf_server.unprotect(fm_dom, fm_name)

shutil.rmtree(tmpdir_mutants)

"""
Orange server upload for Dicty mutant gene sets
"""
from Orange.bio.obiGeneSets import dictyMutantSets, update_server_list, register

mutant_sets_split = dictyMutantSets().split_by_hierarchy()
for mutant_sets in mutant_sets_split:
    register(mutant_sets, sf_server)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.