Changeset 1721:921b3780c6cc in orange-bioinformatics for server_update/updatePPI.py


Ignore:
Timestamp:
09/14/12 12:20:53 (19 months ago)
Author:
markotoplak
Branch:
default
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • server_update/updatePPI.py

    r1719 r1721  
    33 
    44from Orange.bio import obiPPI 
    5 import Orange.utils.serverfiles as orngServerFiles 
    6 import os, sys, shutil, urllib2, tarfile 
    7 from getopt import getopt 
     5import urllib2, tarfile 
    86 
    9 opt = dict(getopt(sys.argv[1:], "u:p:", ["user=", "password="])[0]) 
    10  
    11 username = opt.get("-u", opt.get("--user", "username")) 
    12 password = opt.get("-p", opt.get("--password", "password")) 
    13  
    14 serverFiles = orngServerFiles.ServerFiles(username, password) 
     7from common import * 
    158 
    169try: 
    17     os.mkdir(orngServerFiles.localpath("PPI")) 
     10    os.mkdir(sf_local.localpath("PPI")) 
    1811except OSError: 
    1912    pass 
    2013 
    2114try: 
    22     serverFiles.create_domain("PPI") 
     15    sf_server.create_domain("PPI") 
    2316except Exception, ex: 
    2417    print ex 
     
    2720    obiPPI.MIPS.download() 
    2821 
    29     filename = orngServerFiles.localpath("PPI", "mppi.gz") 
    30     serverFiles.upload("PPI", "allppis.xml", filename, "MIPS Protein interactions", 
     22    filename = sf_local.localpath("PPI", "mppi.gz") 
     23    sf_server.upload("PPI", "allppis.xml", filename, "MIPS Protein interactions", 
    3124                       tags=["protein interaction", "MIPS", "#compression:gz", "#version:%i" % obiPPI.MIPS.VERSION] 
    3225                       ) 
    33     serverFiles.unprotect("PPI", "allppis.xml")  
     26    sf_server.unprotect("PPI", "allppis.xml")  
    3427 
    3528if True: 
     
    3831    sfn = obiPPI.BioGRID.SERVER_FILE 
    3932 
    40     filename = orngServerFiles.localpath("PPI", sfn) 
     33    filename = sf_local.localpath("PPI", sfn) 
    4134 
    4235    import gzip 
     
    4538    gz.close() 
    4639 
    47     serverFiles.upload("PPI", sfn, filename + ".gz",  
     40    sf_server.upload("PPI", sfn, filename + ".gz",  
    4841        title="BioGRID Protein interactions",  
    4942        tags=["protein interaction", "BioGrid", "#compression:gz", "#version:%s" % obiPPI.BioGRID.VERSION] 
    5043        ) 
    51     serverFiles.unprotect("PPI", sfn) 
     44    sf_server.unprotect("PPI", sfn) 
    5245 
Note: See TracChangeset for help on using the changeset viewer.