CIRCexplorer2_path = sys.argv[1] file_name = sys.argv[2] f = open(file_name, 'w+')
circ_list = [] for i in next(os.walk(CIRCexplorer2_path))[1]: for file in glob.glob(os.path.join(CIRCexplorer2_path, i, '*known.txt')): with open(file, 'r') as filereader: for line in filereader: l = line.strip('\n').split() if len(l) <>10: continue if int(l[12]) <>2: continue circ_id = '%s_%s_%s'%(l[0], l[1], l[2]) if circ_id in circ_list: continue else: circ_list.append(circ_id) f.write('%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' % (l[0], l[1], l[2], circ_id, l[4], l[5], l[6], l[7], l[8], l[9], l[10], l[11]))
f = open(output_file, 'w+') f.write('Seq1\tSeq2\tTot Score\tTot Energy\tMax Score\tMax Energy\tStrand\tLen1\tLen2\tPositions\n')
with open(input_file, 'r') as filereader: for line in filereader: if line.startswith('>>'): line = line.strip('>>') l = line.split('\t') binding_sites = l[9].strip().split() if len(binding_sites) > int(num_site): f.write(line)