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

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

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

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