reverse-complement Python 3 #4 program
source code
# The Computer Language Benchmarks Game # http://benchmarksgame.alioth.debian.org/ # # contributed by Jacob Lee, Steven Bethard, et al # 2to3, fixed by Daniele Varrazzo # modified by Daniel Nanz import sys def show(seq, table=bytes.maketrans(b'ACBDGHKMNSRUTWVYacbdghkmnsrutwvy', b'TGVHCDMKNSYAAWBRTGVHCDMKNSYAAWBR'), write=sys.stdout.buffer.write, nl=b'\n'): [header, s] = seq.split(nl, 1) s = s.translate(table, nl)[: : -1] write(b'>' + header + nl) for i in range(0, len(s), 60): write(s[i : i + 60] + nl) def main(): sys.stdin = sys.stdin.detach() seqs = b''.join([line for line in sys.stdin]).split(b'>')[1 : ] for seq in seqs: show(seq) main()
notes, command-line, and program output
NOTES: 64-bit Ubuntu quad core Python 3.6.3 Mon, 26 Mar 2018 21:55:39 GMT MAKE: mv revcomp.python3-4.python3 revcomp.python3-4.py 0.31s to complete and log all make actions COMMAND LINE: /usr/bin/python3 -OO revcomp.python3-4.py 0 < revcomp-input100000000.txt (TRUNCATED) PROGRAM OUTPUT: >ONE Homo sapiens alu GGGATTACAGGCGTGAGCCACCGCGCCCGGCCTTTTTGAGACGGAGTCTCGCTCTGTCGC CCAGGCTGGAGTGCAGTGGCGCGATCTCGGCTCACTGCAACCTCCGCCTCCCGGGTTCAA GCGATTCTCCTGCCTCAGCCTCCCGAGTAGCTGGGATTACAGGCGCGCGCCACCACGCCC GGCTAATTTTTGTATTTTTAGTAGAGACGGGGTTTCACCATGTTGGCCAGGCTGGTCTCG AACTCCTGACCTCAGGTGATCCGCCCGCCTCGGCCTCCCAAAGTGCTGGGATTACAGGCG TGAGCCACCGCGCCCGGCCTTTTTGAGACGGAGTCTCGCTCTGTCGCCCAGGCTGGAGTG CAGTGGCGCGATCTCGGCTCACTGCAACCTCCGCCTCCCGGGTTCAAGCGATTCTCCTGC CTCAGCCTCCCGAGTAGCTGGGATTACAGGCGCGCGCCACCACGCCCGGCTAATTTTTGT ATTTTTAGTAGAGACGGG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