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

    r1719 r1721  
    22##!contact=ales.erjavec@fri.uni-lj.si 
    33 
     4from common import * 
    45from urllib import urlopen 
    5 import Orange.utils.serverfiles as orngServerFiles 
    6 import os, sys 
    7  
    8 from getopt import getopt 
    9  
    10 opt = dict(getopt(sys.argv[1:], "u:p:", ["user=", "password="])[0]) 
    11  
    12 username = opt.get("-u", opt.get("--user", "username")) 
    13 password = opt.get("-p", opt.get("--password", "password")) 
    14  
    156 
    167ontology = urlopen("ftp://nlmpubs.nlm.nih.gov/online/mesh/.asciimesh/d2012.bin") 
     
    5243print "Ontology downloaded." 
    5344 
    54  
    55  
    56  
    57 ordinary = orngServerFiles.ServerFiles() 
    58 authenticated = orngServerFiles.ServerFiles(username, password) 
    59  
    60 authenticated.upload('MeSH', 'mesh-ontology.dat', 'mesh-ontology.dat', title="MeSH ontology", tags=['MeSH', 'ontology', 'orngMeSH']) 
     45sf_server.upload('MeSH', 'mesh-ontology.dat', 'mesh-ontology.dat', title="MeSH ontology", tags=['MeSH', 'ontology', 'orngMeSH']) 
    6146#authenticated.upload('MeSH', 'cid-annotation.dat', 'cid-annotation.dat', title="Annotation for chemicals (CIDs)", tags =['CID','MeSH','orngMeSH','annotation']) 
    6247 
    63 authenticated.unprotect('MeSH', 'mesh-ontology.dat') 
     48sf_server.unprotect('MeSH', 'mesh-ontology.dat') 
    6449os.remove('mesh-ontology.dat') 
    6550print "Ontology uploaded to server." 
Note: See TracChangeset for help on using the changeset viewer.