def action(args): # Ignore SIGPIPE, for head support utils.exit_on_sigpipe() utils.exit_on_sigint() rledict = {seqname: rle for seqname, rle in csv.reader(args.rle)} seqs = ((s, from_ascii(rledict[s.id])) for s in args.seqs) pool = Pool(processes=args.threads) seqs = pool.imap(seq_and_homodecode, seqs, chunksize=140) for seq, decoded in seqs: args.outfile.write('>{}\n{}\n'.format(seq.description, decoded))
def action(args): # Ignore SIGPIPE, for head support utils.exit_on_sigpipe() utils.exit_on_sigint() pool = Pool(processes=args.threads) seqs = imap(fastalite, args.infiles) seqs = chain.from_iterable(seqs) seqs = pool.imap(seq_and_homoencode, seqs, chunksize=40) for seq, (seqstr, count) in seqs: assert len(seqstr) == len(count) args.outfile.write('>{}\n{}\n'.format(seq.description, seqstr)) if args.rlefile: args.rlefile.writerow(dict(name=seq.id, rle=to_ascii(count)))