Compsci 100, Fall 2009, DNA Howto

Benchmarking the Code

open run dialog
The code in the class DNABenchMark can be used to benchmark all the split/join-create recombinant methods. The code given to you will pop-up a file-dialog box --- when run you can use this to navigate to either ecolimed.dat which is a smaller strand of DNA data or to ecoli.dat which is larger (both are in the src directory you download/snarf with Eclipse), or to a file you create, e.g., with a text-editor or by writing a program to create the file. You can comment out different calls in main to methods you don't want to test, be sure you document how you're testing in the README you create to submit.

The benchmarking instructions say to increase the Java runtime heap size using the command-line argument -Xmx512M to start. This sets the amount of memory available for allocating objects from the Java heap, which is the name used for the storage from which memory is allocated when your program runs.

To specify initial heap size you must use the Eclipse Run Configurations ... menu chosen from the Eclipse Run menu. A screen shot is shown on the left.

When this dialog opens, use the second tab of the dialog, labeled (x)=Arguments and then specify VM arguments in the second text box as shown in the screen shot on the right.

run dialog arg specification
In using the dialogs shown, be sure to specify Apply and then Run to run with the designated heap size.

If you can't run with 512M because you don't have enough memory, try 256M, just be sure to document your runs in your README file. You'll need to run with several sizes, so if you can only support a max of 256M you might try another machine or go lower, e.g., to 128M.






LinkStrand Development

Using JUnit

junit run as
To test your LinkStrand class you're given testing code. This code tests individual methods in your class, these tests are called unit tests and so you need to use the standard JUnit unit-testing library with the TestStrand.java file to test your Strand classes.

To choose Run as JUnit test first use the Run As option in the Run menu as shown on the left. You have to select the JUnit option as shown on the right below. Most of you will have that as the only option---older versions of Eclipse have two "run as" options.

There are several tests in the TestStrand.java including tests of the strand's length, toString, append and cutWith methods.

If the JUnit tests pass, you'll get all green as shown on the left below. That screenshot was taken using the provided SimpleStrand class

Otherwise you'll get red -- on the right below -- and an indication of the first test to fail. Fix that, go on to more tests. The red was obtained from a LinkStrand that had nothing but code-stubs generated by Eclipse (with a constructor added).

green junit   red junit