orange-bioinformatics / server_update /


from import obiPPI
import urllib2, gzip

from common import *
import re

def get_version():
    from urllib2 import build_opener
    html = build_opener().open('').read().decode()
    ver = re.findall("protein\.links\.(v.*?)\.txt\.gz", html, re.DOTALL)[0]
    return ver

version = get_version()
version_id = "#dbversion:%s" % version

force = False # force update

for cl,desc,sfn in [ (obiPPI.STRING, 
                    "STRING Protein interactions (Creative Commons Attribution 3.0 License)", 
                    "STRING Protein interactions (Creative Commons Attribution-Noncommercial-Share Alike 3.0 License)", 
                    obiPPI.STRINGDetailed.FILENAME_DETAILED) ]:

    print cl
    print "current info","PPI", sfn)

    if force or version_id not in"PPI", sfn)["tags"]:

        filename = sf_local.localpath("PPI",  sfn)

        if os.path.exists(filename): #remvoe prebuilt sqlite database


        gzfile = gzip.GzipFile(filename + ".gz", "wb") #gzip the database
        shutil.copyfileobj(open(filename, "rb"), gzfile)

        sf_server.upload("PPI", sfn, filename + ".gz", 
                       tags=["protein interaction", "STRING", 
                             "#compression:gz", "#version:%s" % cl.VERSION, version_id]
        sf_server.unprotect("PPI", sfn)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.