Rusty Bioinformatics

Back to the basics of bioinformatics.

Getting Started

Other than a good text editor (please don’t email me about some other editor) and *nix terminal, you will need a few items, not the least of which is Rust. Since I am on a Mac, I use the excellent Homebrew to install Rust:


$ brew install rust

Rust includes the Cargo tool that helps out with creating the proper package layout, and helps in testing and compiling code. Let’s use it to create a simple command line that will take a DNA sequence as input and give the reverse complement.


$ cargo new revcomp --bin

This creates the following structure:


$ tree  -p  revcomp
revcomp
├── [-rw-r--r--]  Cargo.toml
└── [drwxr-xr-x]  src
    └── [-rw-r--r--]  main.rs

I won’t go repeating the excellent content of the Rust book but you should read the sections on Cargo, the Guessing Game and testing in Rust. Here we will use the more simple testing pattern.

Requirements

  • [ ] The program must take in an argument consisting of DNA sequence via STDIN
  • [ ] If the input is not DNA (consists only of “ATGC” characters), then throw an error
  • [ ] Else output the reverese complement sequence as STDOUT

In the next post I will go through this program in detail.