Changeset 1721:921b3780c6cc in orange-bioinformatics for server_update/updateSTRING.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/updateSTRING.py

    r1720 r1721  
    33 
    44from Orange.bio import obiPPI 
    5 import Orange.utils.serverfiles as orngServerFiles 
    6 import os, sys, shutil, urllib2, gzip 
    7 from getopt import getopt 
     5import urllib2, gzip 
    86 
    9 opt = dict(getopt(sys.argv[1:], "u:p:", ["user=", "password="])[0]) 
     7from common import * 
    108 
    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) 
    15  
    16 filename = orngServerFiles.localpath("PPI", obiPPI.STRING.FILENAME) 
     9filename = sf_local.localpath("PPI", obiPPI.STRING.FILENAME) 
    1710 
    1811if False: 
     
    2518    shutil.copyfileobj(open(filename, "rb"), gzfile) 
    2619 
    27     serverFiles.upload("PPI", obiPPI.STRING.FILENAME, filename + ".gz",  
     20    sf_server.upload("PPI", obiPPI.STRING.FILENAME, filename + ".gz",  
    2821                       "STRING Protein interactions (Creative Commons Attribution 3.0 License)", 
    2922                       tags=["protein interaction", "STRING",  
    3023                             "#compression:gz", "#version:%s" % obiPPI.STRING.VERSION] 
    3124                       ) 
    32     serverFiles.unprotect("PPI", obiPPI.STRING.FILENAME) 
     25    sf_server.unprotect("PPI", obiPPI.STRING.FILENAME) 
    3326 
    3427# The second part 
    35 filename = orngServerFiles.localpath("PPI", obiPPI.STRINGDetailed.FILENAME_DETAILED) 
     28filename = sf_local.localpath("PPI", obiPPI.STRINGDetailed.FILENAME_DETAILED) 
    3629 
    3730if os.path.exists(filename): 
     
    4336shutil.copyfileobj(open(filename, "rb"), gzfile) 
    4437 
    45 serverFiles.upload("PPI", obiPPI.STRINGDetailed.FILENAME_DETAILED, filename + ".gz",  
     38sf_server.upload("PPI", obiPPI.STRINGDetailed.FILENAME_DETAILED, filename + ".gz",  
    4639                   "STRING Protein interactions (Creative Commons Attribution-Noncommercial-Share Alike 3.0 License)" , 
    4740                   tags=["protein interaction", "STRING", 
    4841                         "#compression:gz", "#version:%s" % obiPPI.STRINGDetailed.VERSION] 
    4942                   ) 
    50 serverFiles.unprotect("PPI", obiPPI.STRINGDetailed.FILENAME_DETAILED) 
     43sf_server.unprotect("PPI", obiPPI.STRINGDetailed.FILENAME_DETAILED) 
    5144     
Note: See TracChangeset for help on using the changeset viewer.