Week 5 of 48 in 24! This time around we’re doing Protein Translation. Basically, take a sequence of amino acids and translate that into a list of proteins. Each triple of amino acids – a codon – gets mapped to a protein. Or rather, some codons are valid proteins, some represent a “stop” signal, and others are garbage and should throw an error.
Bash The first language I thought I’d try this week is bash. I use bash shell most days, but I very rarely do anything beyond simple commands. (Maybe a little grep, some modest piping…) It would, however, be kind of useful to know a little more about how to write simple scripts. Often if I need to do something like that, I’d reach for python which I know better than I do bash, but sometimes that seems like overkill. And I did run into a situation at work recently where a little bash script was useful. The container I was troubleshooting didn’t have python installed, indeed, it didn’t have lsof installed, but I needed a way to get an overview of what was eating all the file descriptors. I cobbled together something where I looped over ls /proc/[0-9]* and pulled out all the cmdlines. It sort of worked but it was painful and it made me realise a better handle on bash (and unix tools more generally) would be a good investment. So here is my prosaic, straightforward solution to the exercise in bash.
Read more