当前位置: 首页>>代码示例>>Python>>正文


Python UI.importDefaultFileLocations方法代码示例

本文整理汇总了Python中UI.importDefaultFileLocations方法的典型用法代码示例。如果您正苦于以下问题:Python UI.importDefaultFileLocations方法的具体用法?Python UI.importDefaultFileLocations怎么用?Python UI.importDefaultFileLocations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UI的用法示例。


在下文中一共展示了UI.importDefaultFileLocations方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: downloadCurrentVersion

# 需要导入模块: import UI [as 别名]
# 或者: from UI import importDefaultFileLocations [as 别名]
def downloadCurrentVersion(filename,secondary_dir,file_type):
    import UI
    file_location_defaults = UI.importDefaultFileLocations()

    ud = file_location_defaults['url'] ### Get the location of the download site from Config/default-files.csv
    url_dir = ud.Location() ### Only one entry
    
    dir = export.findParentDir(filename)
    dir = string.replace(dir,'hGlue','')  ### Used since the hGlue data is in a sub-directory
    filename = export.findFilename(filename)
    url = url_dir+secondary_dir+'/'+filename
    print url
    file,status = download(url,dir,file_type); continue_analysis = 'yes'
    if 'Internet' in status and 'nnot' not in filename: ### Exclude for Affymetrix annotation files
        print_out = "File:\n"+url+"\ncould not be found on the server or an internet connection is unavailable."
        if len(sys.argv)<2:
            try:
                UI.WarningWindow(print_out,'WARNING!!!')
                continue_analysis = 'no'
            except Exception:
                print 'cannot be downloaded';force_error
        else: print 'cannot be downloaded';force_error
    elif status == 'remove' and ('.zip' in file or '.tar' in file or '.gz' in file):
        try: os.remove(file) ### Not sure why this works now and not before
        except Exception: status = status
    return continue_analysis
开发者ID:venkatmi,项目名称:altanalyze,代码行数:28,代码来源:update.py

示例2: getFileLocations

# 需要导入模块: import UI [as 别名]
# 或者: from UI import importDefaultFileLocations [as 别名]
def getFileLocations(species_code,search_term):
    ### The three supplied variables determine the type of data to obtain from default-files.csv
    import UI
    file_location_defaults = UI.importDefaultFileLocations()
    sfl = file_location_defaults[search_term]
    
    for sf in sfl:
        if species_code in sf.Species(): filename = sf.Location()
    return filename
开发者ID:venkatmi,项目名称:altanalyze,代码行数:11,代码来源:update.py

示例3: buildUniProtFunctAnnotations

# 需要导入模块: import UI [as 别名]
# 或者: from UI import importDefaultFileLocations [as 别名]
def buildUniProtFunctAnnotations(species,force):
    import UI
    file_location_defaults = UI.importDefaultFileLocations()
    """Identify the appropriate download location for the UniProt database for the selected species"""
    uis = file_location_defaults['UniProt']
    trembl_filename_url=''
    
    for ui in uis:
        if species in ui.Species(): uniprot_filename_url = ui.Location()
    species_codes = importSpeciesInfo(); species_full = species_codes[species].SpeciesName()
    
    import ExtractUniProtFunctAnnot; reload(ExtractUniProtFunctAnnot)
    ExtractUniProtFunctAnnot.runExtractUniProt(species,species_full,uniprot_filename_url,trembl_filename_url,force)
开发者ID:venkatmi,项目名称:altanalyze,代码行数:15,代码来源:update.py

示例4: getUniProtURLsForAllSupportedSpecies

# 需要导入模块: import UI [as 别名]
# 或者: from UI import importDefaultFileLocations [as 别名]
def getUniProtURLsForAllSupportedSpecies():
    ### Import all UniProt supproted species and URLs
    species_uniprot_db={}
    fn=filepath('Config/uniprot-species-file.txt')
    for line in open(fn,'r').xreadlines():
        data = cleanUpLine(line)
        species_full,taxid,url = string.split(data,'\t')
        if 'Homo sapiens' not in species_full: ### There's a separate file for us humans (so egotistical!!!)
            species_uniprot_db[species_full] = taxid,url
        
    import AltAnalyze
    ###Get species annotations from the GO-Elite config
    species_annot_db=AltAnalyze.importGOEliteSpeciesInfo()
        
    ### Export all urls for currently supported species
    import UI
    file_location_defaults = UI.importDefaultFileLocations()
    
    location_db={}; species_added=[]
    for species_full in species_annot_db:
        if species_full in species_uniprot_db:
            taxid,url = species_uniprot_db[species_full]
            species_code = species_annot_db[species_full].SpeciesCode()
            try: location_db[url].append(species_code)
            except Exception: location_db[url] = [species_code]
            species_added.append(species_full)
            
    for species_full in species_annot_db:
        taxid = species_annot_db[species_full].TaxID()
        species_code = species_annot_db[species_full].SpeciesCode()
        if species_full not in species_added:
            for species_name in species_uniprot_db:
                tax,url = species_uniprot_db[species_name]
                if tax == taxid:
                    location_db[url].append(species_code)
                    print species_code
                
    for url in location_db:
        species = string.join(location_db[url],'|')
        fl = UI.FileLocationData('ftp', url, species)
        try: file_location_defaults['UniProt'].append(fl)
        except KeyError: file_location_defaults['UniProt'] = [fl]
    UI.exportDefaultFileLocations(file_location_defaults)
开发者ID:wuxue,项目名称:altanalyze,代码行数:45,代码来源:ExtractUniProtFunctAnnot.py

示例5: downloadFile

# 需要导入模块: import UI [as 别名]
# 或者: from UI import importDefaultFileLocations [as 别名]
def downloadFile(file_type):
    import UI
    file_location_defaults = UI.importDefaultFileLocations()
    try:
        fld = file_location_defaults[file_type]
        url = fld.Location()
    except Exception:
        for fl in fld:
            if species in fl.Species(): url = fl.Location()
    if 'Target' in file_type: output_dir = 'AltDatabase/miRBS/'
    else: output_dir = 'AltDatabase/miRBS/'+species + '/'
    gz_filepath, status = update.download(url,output_dir,'')
    if status == 'not-removed':
        try: os.remove(gz_filepath) ### Not sure why this works now and not before
        except Exception: status = status
    
    filename = string.replace(gz_filepath,'.zip','.txt')
    filename = string.replace(filename,'.gz','.txt')
    filename = string.replace(filename,'.txt.txt','.txt')
    
    return filename
开发者ID:venkatmi,项目名称:altanalyze,代码行数:23,代码来源:MatchMiRTargetPredictions.py

示例6: verifyExternalDownload

# 需要导入模块: import UI [as 别名]
# 或者: from UI import importDefaultFileLocations [as 别名]
def verifyExternalDownload(file_type):
    ### Adapted from the download function - downloadFile()
    import UI
    file_location_defaults = UI.importDefaultFileLocations()
    try:
        fld = file_location_defaults[file_type]
        url = fld.Location()
    except Exception:
        for fl in fld:
            if species in fl.Species(): url = fl.Location()
    if 'Target' in file_type: output_dir = 'AltDatabase/miRBS/'
    else: output_dir = 'AltDatabase/miRBS/'+species + '/'

    filename = url.split('/')[-1]
    output_filepath = filepath(output_dir+filename)
    
    filename = string.replace(output_filepath,'.zip','.txt')
    filename = string.replace(filename,'.gz','.txt')
    filename = string.replace(filename,'.txt.txt','.txt')
    counts = verifyFile(filename,'counts')
    if counts < 9: validated = 'no'
    else: validated = 'yes'
    return validated, filename
开发者ID:venkatmi,项目名称:altanalyze,代码行数:25,代码来源:MatchMiRTargetPredictions.py

示例7: downloadCurrentVersion

# 需要导入模块: import UI [as 别名]
# 或者: from UI import importDefaultFileLocations [as 别名]
def downloadCurrentVersion(filename,secondary_dir,file_type):
    import UI
    file_location_defaults = UI.importDefaultFileLocations()

    uds = file_location_defaults['url'] ### Get the location of the download site from Config/default-files.csv
    for ud in uds: url_dir = ud.Location() ### Only one entry
    
    dir = export.findParentDir(filename)  
    filename = export.findFilename(filename)
    url = url_dir+secondary_dir+'/'+filename
    
    file,status = download(url,dir,file_type); continue_analysis = 'yes'
    if 'Internet' in status:
        print_out = "File:\n"+url+"\ncould not be found on server or internet connection is unavailable."
        try:
            UI.WarningWindow(print_out,'WARNING!!!')
            continue_analysis = 'no'
        except Exception:
            print url
            print 'cannot be downloaded';die
    elif status == 'remove':
        try: os.remove(file) ### Not sure why this works now and not before
        except Exception: status = status
    return continue_analysis
开发者ID:wuxue,项目名称:altanalyze,代码行数:26,代码来源:download.py


注:本文中的UI.importDefaultFileLocations方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。