Skip to content

Python reverse-complement Ruben Vorderman

Attach your source code file

reverse_complement.py

Provide an example build command-line

python reverse_complement.py < fasta1000000001.txt > /dev/null

Performance

I am a bioinformatician. I program a lot in Python and this problem is right in my domain. So I thought I'd give it a shot.

Benchmarks performed using fasta1000000001.txt as highlighted in #520 (closed). Times measured by hyperfine. (cputime == usertime + systime). Memory usage measured using /usr/bin/time

program walltime (s) cputime (s) memory (MB)
This entry 2.523 2.523 496
#517 (closed) 2.079 3.847 1467
Python no6 3.986 5.902 2430
Python no2 5.817 5.817 1750

Conclusion

Python can compete with the top-tier solutions on the memory usage front as long as the programming techniques are right. I hope to illustrate that with this entry. Also the cputime got quite a bit better, so this should push Python up quite a bit on the ranking page on both cputime and memory. It is quite a useful and fast scripting language when the proper techniques are used.

I added a huge swat of comments on the bottom of the entry to explain the techniques, for educational purposes.