source: orange-bioinformatics/server_update/updateSTRING.py @ 1720:354d91b1af9f

Revision 1720:354d91b1af9f, 1.8 KB checked in by markotoplak, 20 months ago (diff)

Fixed update scripts for STRING and Taxonomy.

Line 
1##!interval=7
2##!contact=ales.erjavec@fri.uni-lj.si
3
4from Orange.bio import obiPPI
5import Orange.utils.serverfiles as orngServerFiles
6import os, sys, shutil, urllib2, gzip
7from getopt import getopt
8
9opt = dict(getopt(sys.argv[1:], "u:p:", ["user=", "password="])[0])
10
11username = opt.get("-u", opt.get("--user", "username"))
12password = opt.get("-p", opt.get("--password", "password"))
13
14serverFiles = orngServerFiles.ServerFiles(username, password)
15
16filename = orngServerFiles.localpath("PPI", obiPPI.STRING.FILENAME)
17
18if False:
19    if os.path.exists(filename):
20        os.remove(filename)
21
22    obiPPI.STRING.download_data("v9.0")
23
24    gzfile = gzip.GzipFile(filename + ".gz", "wb")
25    shutil.copyfileobj(open(filename, "rb"), gzfile)
26
27    serverFiles.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                       )
32    serverFiles.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.