Project 1. DNA fragment analyzer translation to Ocaml

Introduction

This assignment builds on the DNA fragment analyzer from Winter 2003. The following discussion assumes that you have read and understood that project's definitions, assignment, examples, hints, and solution.

Your company Frenetic Genetics Lab (FGL) is using some DNA sequence analysis software that is written in Scheme. Unfortunately, FGL is having continuing problems with software reliability. FGL's software engineers like the flexibility and power of Scheme, but the lack of run-time checking is making it difficult for FGL to write large, reliable DNA analysis software.

Your boss is considering translating FGL's software to another programming language that will support greater reliability while not giving up Scheme's advantages. She assigns to you the job of investigating the feasibility of rewriting FGL's software in Ocaml. She suggests that you start by rewriting the solution to the Winter 2003 assignment in Ocaml, and seeing how well it works.

Assignment

Translate the solution to the Winter 2003 project from Scheme to Ocaml. Write Ocaml code that is as idiomatic as possible: your goal is to have a clear, clean translation that uses Ocaml well; it is not to generate a literal translation. For example, you don't need to translate all instances of Scheme #f to Ocaml false if there is a more natural translation in some cases.

Also, translate all ten test cases into Ocaml as well. Each test case is labeled with ===> in the Winter 2003 assignment. Call the test cases test1, test2, etc. You may add extra test cases after test10 if you like.

An important part of this assignment is to come up with a proper set of types for fragments, acceptors, patterns, etc. This will help you determine whether Ocaml's type system is helping to make the code more reliable and/or getting in the way of writing flexible code.

Submitting your work

Submit a file named pr1.tgz. It should be a gzipped tar file containing all the source files that are needed to build and run your project. These files must consist of at least the following files, and perhaps other files if you find them useful (however do not submit byte code or executables):

README
A plain text file (80 columns per line maximum, please) that starts with your name and student ID, followed by your assessment of the utility of using Ocaml instead of Scheme for this kind of application. Your assessment should be in the form of a report suitable for technical managers like your FGL boss. The report should not be fancy or lengthy, but it should cover the important issues.
dnafa.ml
The source code to your Ocaml translation of the DNA fragment analyzer.
dnafatest.ml
The source code to your Ocaml translation of the test cases.
runtest.sh
A shell script that compiles your Ocaml code and test cases, and starts an Ocaml session suitable for testing your code. For example, it might look like this:
#! /bin/sh
ocamlc -c dnafa.mli
ocamlc -c dnafa.ml
ocamlc -c dnafatest.ml
ocaml dnafa.cmo dnafatest.cmo
You can test the script by executing the shell command sh runtest.sh.

For example, you might use the following shell command to create pr1.tgz:

tar cf - README runtest.sh dnafa.ml dnafa.mli dnafatest.ml | gzip -9 >pr1.tgz

Use the shell command gunzip <pr1.tgz | tar tvf - to list the table of contents of your pr1.tgz file.


© 2004 Paul Eggert. See copying rules.
$Id: pr1.html,v 1.21 2004/05/03 20:38:40 eggert Exp $