def create_command(module_type): cmd_dict = get_cmd_spec(module_type) vars, inner_cmd = cmd_dict['vars'], cmd_dict['inner_cmd'] cmd_opts = dictzip(vars, map(getvar, vars)) if module_type != None: whole_cmd = wrap_cmd(module_type, inner_cmd) return whole_cmd.format(**cmd_opts) else: return inner_cmd
def _create_dict(obj_func, columns, getters, validator, dictgetters): obj = apply(obj_func) pre_dict = obj_to_dict(obj, dictzip(columns, getters)) #optional intermediate schema here if dictgetters: extra_dict = obj_to_dict(pre_dict, dictgetters) full_dict = merge_dicts(pre_dict, extra_dict) else: full_dict = pre_dict return validator.validate(full_dict)
def make_ovrlp_graph(kmers): N = len(kmers) ov = len(kmers[0]) - 1 M = np.zeros((N, N)) D = dictzip(kmers, xrange(N)) def update(M, pre, suff): sfx, suffg = suff nbrs = imap(X[0], ifilter(X[1]==sfx, pre)) nbr_idxs = map(D.__getitem__, nbrs) s_idxs = map(D.__getitem__, suffg) M[ s_idxs, nbr_idxs] = 1 pre, suff = groupby(kmers, X[:ov]), groupby(kmers, X[-ov:]) pre = izip(kmers, imap(X[:ov], kmers)) Mupdate = F(update, M, pre) #NOTE: starmap drains itertools.groupby map(Mupdate, suff) return D, M
def make_job_dict(): modules = get_available_modules() + ['Other'] module_type = select_interactive_menu(modules) pbs_opts = dictzip(opts, map(option_with_default, opts)) pbs_opts['command'] = create_command(module_type) return pbs_opts