run_module.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:firecloud_developer_toolkit 作者: broadinstitute 项目源码 文件源码
def parse_argv_module_id(argv):    
    #baseline_args = ['module_name','lsid','cache_path','execution_id','cwd']
    arg_names = [arg_name[2:]+'=' for arg_name in argv if arg_name[:2]=='--']

    (param_value_pairs,remnants)=getopt.gnu_getopt(argv,"",arg_names)

    #Set defaults
    module_name = ''
    lsid = ''
    cache_path = common.cache_path
    execution_id = '0'
    module_libdir = None
    cwd = os.getcwd()
    sg_prepare_template = ''

    args_used = set()
    for arg_pair in param_value_pairs:
        param_name = arg_pair[0][2:] #strip off '--' at start
        param_value = arg_pair[1]
        if param_name in args_used:
            raise Exception ('duplicated parameter: %s'%param_name)
        else:
            args_used.add(param_name)
        if param_name == 'module_name': 
            module_name = param_value
        elif param_name == 'lsid':
            lsid = param_value
        elif param_name == 'cache_path':
            cache_path = param_value
        elif param_name == 'execution_id':
            execution_id = param_value
        elif param_name == 'sg_prepare_template':
            sg_prepare_template = param_value
        elif param_name == 'module_libdir':
            module_libdir = param_value
            module_name = os.path.basename(module_libdir)
        elif param_name == 'cwd':
            cwd = param_value


    # test harness
    #module_name = "CancerBirdseedSNPsToGeli"
    #lsid = "urn_lsid_broadinstitute_org_cancer_genome_analysis_00038_12"
    #cache_path = common.cache_path
    #execution_id = "0"
    #cwd = "/xchip/tcga_scratch/gsaksena/test_run_gp_module"

    return (module_name,lsid,cache_path,execution_id,module_libdir,cwd,sg_prepare_template)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号