Solving problems from using Go
Charles Reid 9092f98bf6
Add solution to BA2F (#17)
2 months ago
chapter1 Add code for Chapter 2 (#6) 5 months ago
chapter2 Add solution to BA2F (#17) 2 months ago
chapter3 add chapter3 module, and rosalind functions for BA3a thru BA3c (#9) 5 months ago
rosalind Add solution to BA2F (#17) 2 months ago
scripts Continue work on Chapter 2 problems (#7) 5 months ago
stronghold Add Stronghold module (#8) 5 months ago
.gitignore Chapter1 part2 (#2) 5 months ago
.travis.yml add chapter3 module, and rosalind functions for BA3a thru BA3c (#9) 5 months ago
LICENSE clean up chapter 1, consolidate tests (#5) 5 months ago add chapter3 module, and rosalind functions for BA3a thru BA3c (#9) 5 months ago


rosalind is a Go (golang) package for solving bioinformatics problems.

travis golang license godoc


This repo contains a Go (golang) library, rosalind, that implements functionality for solving bioinformatics problems. This is mainly useful for problems on but is for general use as well.

Rosalind problems are grouped by chapter. Each problem has its own function and is implemented in a library called chapter1, chapter2, etc.

For example, Chapter 1 question A is implemented in package chapter1 as the function BA1a( <input-file-name> ). This (specific) functionality wraps the (general purpose) rosalind library.

Quick Start


The rosalind library can be installed using go get:

go get

The library can now be imported and its functions called directly. Here is a brief example:

package main

import (

func main() {
    k := 4
    result, _ := rosalind.MostFrequentKmers(input, k)

Problem Sets

Each set of problems is grouped into its own package. These packages import the rosalind package, so it should be available.

You can install the Chapter 1 problem set, for example, like so:

go get

This can now be imported and used in any Go program.

Try creating a main.go file in a temporary directory, and run it with go run main.go:

package main

import (
    rch1 ""

func main() {
    filename := "rosalind_ba1a.txt"

Assuming an input file rosalind_ba1a.txt is available, you should see a problem description and the output of the problem, which can be copied and pasted into

$ go run main.go

Rosalind: Problem BA1a:
Most Frequest k-mers

Given an input string and a length k,
report the k-mer or k-mers that occur
most frequently.


Computed result from input file: for_real/rosalind_ba1a.txt

Command Line Interface



The repo contains the following directories:

  • rosalind/ - code and functions for the Rosalind library

  • chapter1/ - solutions to chapter 1 questions (utilizes rosalind library)

  • chapter2/ - solutions to chapter 2 questions

  • chapter3/ - solutions to chapter 3 questions

  • stronghold/ - solutions to questions from the stronghold section of

See the Readme file in each respective directory for more info.