source: orange-bioinformatics/server_update/updateDictyBase.py @ 1781:764dc2b10839

Revision 1781:764dc2b10839, 1.8 KB checked in by Flashpoint <vid.flashpoint@…>, 12 months ago (diff)

First attempt at configuring Orange server update

Line 
1##interval:7
2from common import *
3
4import sys, os
5from gzip import GzipFile
6import tempfile
7from Orange.bio.obiDicty import DictyBase
8import Orange.bio.obiDictyMutants as DictyMutants
9
10tmpdir = tempfile.mkdtemp("dictybase")
11base = DictyBase.pickle_data()
12filename = os.path.join(tmpdir, "tf")
13
14f = open(filename, 'wb')
15f.write(base)
16f.close()
17
18dom = DictyBase.domain
19fn = DictyBase.filename
20
21try:
22    sf_server.create_domain('dictybase')
23except:
24    pass
25
26print filename
27
28sf_server.upload(dom, fn, filename, title="dictyBase gene aliases",
29    tags=DictyBase.tags)
30sf_server.unprotect(dom, fn)
31
32shutil.rmtree(tmpdir)
33
34
35"""
36Orange server upload for DictyMutants
37"""
38
39tmpdir_mutants = tempfile.mkdtemp("dictymutants")
40base_mutants = DictyMutants.download_mutants()
41file_mutants = os.path.join(tmpdir_mutants, "tempMut")
42
43fm = open(file_mutants, "wb")
44fm.write(base_mutants)
45fm.close()
46
47fm_dom = DictyMutants.domain
48fm_name = DictyMutants.pickle_file
49
50print file_mutants
51
52sf_server.upload(fm_dom, fm_name, file_mutants, title="dictyBase mutant collection",
53    tags=DictyMutants.tags)
54sf_server.unprotect(fm_dom, fm_name)
55
56shutil.rmtree(tmpdir_mutants)
57
58"""
59Orange server upload for Dicty mutant gene sets
60"""
61from Orange.bio.obiGeneSets import dictyMutantSets, update_server_list
62import cPickle as pickle
63
64mutant_sets = dictyMutantSets()
65
66tmpdir_sets = tempfile.mkdtemp("dictygenesets")
67file_mutants = os.path.join(tmpdir_sets, "tempSets")
68
69with open(file_mutants, "wb") as f:
70    pickle.dump(mutant_sets, f, -1)
71
72fm_dom = "gene_sets"
73fm_name = "DictyMutant phenotypes"
74set_tags = ["Mutant", "phenotype", "dicty"]
75
76print file_mutants
77
78sf_server.upload(fm_dom, fm_name, file_mutants, title="Dictyostelium discoideum mutant phenotypes",
79    tags=set_tags)
80sf_server.unprotect(fm_dom, fm_name)
81update_server_list(sf_server)
82
83shutil.rmtree(tmpdir_sets)
84
Note: See TracBrowser for help on using the repository browser.