def join(*args): flags.assert_flag('sabmark-dir') flags.assert_flag('sabmark-set') if flags.config.sabmark_set == 'twilight': return os.path.join(flags.config.sabmark_dir, __TWILIGHT, *args) else: return os.path.join(flags.config.sabmark_dir, __SUPERFAMILY, *args)
def search_bowdb_pdb(prot_files, bow_db=None, chain='', limit=100, min=0.0, max=1.0): flags.assert_flag('bow-db') if bow_db is None: bow_db = flags.config.bow_db else: bow_db = ejoin(bow_db) if isinstance(prot_files, basestring): prot_files = [prot_files] file_hash = hashlib.md5(''.join(prot_files)).hexdigest() outname = 'bowsearch_limit-%d_min-%f_max-%f_chain-%s_%s' \ % (limit, min, max, chain, file_hash) outname = ejoin(outname) def runsearch(): print >> open(outname, 'w+'), \ cmd('bowsearch', '-output', 'csv', '-limit', '%d' % limit, '-min', '%f' % min, '-max', '%f' % max, '--chain', chain, bow_db, *prot_files) cached([outname], runsearch) print outname rows = [] for row in csv.DictReader(open(outname), delimiter='\t'): row['Cosine'] = float(row['Cosine']) row['Euclid'] = float(row['Euclid']) rows.append(row) return rows