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

Revision 1717:b9f395780e75, 1.4 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, tarfile
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
15try:
16    os.mkdir(orngServerFiles.localpath("PPI"))
17except OSError:
18    pass
19
20obiPPI.MIPS.download()
21
22try:
23    serverFiles.create_domain("PPI")
24except Exception, ex:
25    print ex
26filename = orngServerFiles.localpath("PPI", "mppi.gz")
27serverFiles.upload("PPI", "allppis.xml", filename, "MIPS Protein interactions",
28                   tags=["protein interaction", "MIPS", "#compression:gz", "#version:%i" % obiPPI.MIPS.VERSION]
29                   )
30serverFiles.unprotect("PPI", "allppis.xml") 
31
32if False: ## download BIOGRID-ALL manually
33    import gzip
34    filename = orngServerFiles.localpath("PPI", "BIOGRID-ALL.tab")
35    gz = gzip.GzipFile(filename + ".gz", "wb")
36    gz.write(open(filename, "rb").read())
37    gz.close()
38    serverFiles.upload("PPI", "BIOGRID-ALL.tab", filename + ".gz", title="BioGRID Protein interactions", 
39                       tags=["protein interaction", "BioGrid", "#compression:gz", "#version:%i" % obiPPI.BioGRID.VERSION]
40                       )
41    serverFiles.unprotect("PPI", "BIOGRID-ALL.tab")
42
Note: See TracBrowser for help on using the repository browser.