source: orange-bioinformatics/server_update/updateSTRING.py @ 1721:921b3780c6cc

Revision 1721:921b3780c6cc, 1.5 KB checked in by markotoplak, 20 months ago (diff)

Moved common functionality of the server files update scripts to a separate file.

Line 
1##!interval=7
2##!contact=ales.erjavec@fri.uni-lj.si
3
4from Orange.bio import obiPPI
5import urllib2, gzip
6
7from common import *
8
9filename = sf_local.localpath("PPI", obiPPI.STRING.FILENAME)
10
11if False:
12    if os.path.exists(filename):
13        os.remove(filename)
14
15    obiPPI.STRING.download_data("v9.0")
16
17    gzfile = gzip.GzipFile(filename + ".gz", "wb")
18    shutil.copyfileobj(open(filename, "rb"), gzfile)
19
20    sf_server.upload("PPI", obiPPI.STRING.FILENAME, filename + ".gz", 
21                       "STRING Protein interactions (Creative Commons Attribution 3.0 License)",
22                       tags=["protein interaction", "STRING", 
23                             "#compression:gz", "#version:%s" % obiPPI.STRING.VERSION]
24                       )
25    sf_server.unprotect("PPI", obiPPI.STRING.FILENAME)
26
27# The second part
28filename = sf_local.localpath("PPI", obiPPI.STRINGDetailed.FILENAME_DETAILED)
29
30if os.path.exists(filename):
31    os.remove(filename)
32
33obiPPI.STRINGDetailed.download_data("v9.0")
34
35gzfile = gzip.GzipFile(filename + ".gz", "wb")
36shutil.copyfileobj(open(filename, "rb"), gzfile)
37
38sf_server.upload("PPI", obiPPI.STRINGDetailed.FILENAME_DETAILED, filename + ".gz", 
39                   "STRING Protein interactions (Creative Commons Attribution-Noncommercial-Share Alike 3.0 License)" ,
40                   tags=["protein interaction", "STRING",
41                         "#compression:gz", "#version:%s" % obiPPI.STRINGDetailed.VERSION]
42                   )
43sf_server.unprotect("PPI", obiPPI.STRINGDetailed.FILENAME_DETAILED)
44   
Note: See TracBrowser for help on using the repository browser.