source: orange-bioinformatics/server_update/updateSTRING.py @ 1717:b9f395780e75

Revision 1717:b9f395780e75, 1.8 KB checked in by markotoplak, 20 months ago (diff)

Copied server update scripts from Orange source.

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