Difference between revisions of "Nucleobase Counting"
Line 12: | Line 12: | ||
You will find the starting point for this assignment is in the count folder. In the count.assignment package you will find [[http://www.cse.wustl.edu/~cosgroved/courses/cse231/f17/apidocs/count/assignment/NucleobaseCounting.html NucleobaseCounting.java]]. | You will find the starting point for this assignment is in the count folder. In the count.assignment package you will find [[http://www.cse.wustl.edu/~cosgroved/courses/cse231/f17/apidocs/count/assignment/NucleobaseCounting.html NucleobaseCounting.java]]. | ||
− | |||
− | |||
==calculateMidpoint== | ==calculateMidpoint== | ||
Line 40: | Line 38: | ||
=== CountTestSuite === | === CountTestSuite === | ||
Launch CountTestSuite.java as a JUnit Test to run all of the tests. CountTestSuite.java is located in src/test/java count.assignment package. You can initiate this via right clicking on CountTestSuite.java and selecting "Run As..." -> "JUnit Test". | Launch CountTestSuite.java as a JUnit Test to run all of the tests. CountTestSuite.java is located in src/test/java count.assignment package. You can initiate this via right clicking on CountTestSuite.java and selecting "Run As..." -> "JUnit Test". | ||
+ | |||
+ | {{TestSuite|CountTestSuite|count.assignment}} | ||
=== VM Argument === | === VM Argument === |
Revision as of 20:06, 22 December 2017
Contents
Background
For this assignment, you will be writing sequential and parallel code to count nucleobases in a human X chromosome.
DNA is made up of four nucleobases: cytosine, guanine, adenine, and thymine. A strand of DNA can thus be represented as a string of letters representing these nucleobases, for example: “ACCGCATAAAGTCC.” However, DNA sequencing is typically not 100% accurate, so some of the nucleobases are not read with high certainty. These bases can be represented as an “N.” A sequence then might look something like “NCCGCATNAAGTCC.” Your goal is to write code that counts the number of unknown nucleobases.
We will be using actual data pulled from the US National Library of Medicine, a database maintained by the National Institute of Health. We have already provided you the code that you need to access the chromosome from the database and check your work. You must implement a sequential solution and two parallel solutions to count the given bases in these sequences.
For some more optional background on DNA and nucleotide bases, please refer to the links under Optional Reading.
Where to Start
You will find the starting point for this assignment is in the count folder. In the count.assignment package you will find [NucleobaseCounting.java].
calculateMidpoint
In this method, you will need to calculate the midpoint between two numbers. This is as simple as finding the average between the two numbers. There is no need to worry about rounding correctly, just drop everything after the decimal point if the midpoint is not automatically an int.
Sequential Solution
We recommend implementing a sequential solution before moving on to parallel solutions. In order to do this, please modify the countSequential
method. When you’re ready to begin, delete the return statement and begin implementing your solution! Please refer to your notes from lecture for help, as we tackled a very similar problem in class.
Hint: maybe some loops might be best for counting things?
Parallel Solution
You need to implement two different parallel solutions to this problem. The first will involve splitting the array into two equal halves, then going through each half of the array in parallel. The second will involve splitting the array into n different pieces, then going through each of those pieces of the array in parallel.
In order to start with then two equal halves solution, please modify the countParallelUpperLowerSplit
method. When you’re ready to begin, delete the return statement and begin implementing your solution! Again, please refer to your notes from lecture for help, as we tackled a very similar problem in class.
Hint: don’t forget the finish block! The format will be very similar to the examples.
After you’re finished with that, please modify the countParallelNWaySplit
method for the n different pieces solution. As before, when you’re ready to begin, delete the return statement and begin implementing your solution! Again, please refer to your notes from lecture for help, as we tackled a very similar problem in class.
Hint: make an array to store the results of each task. Split the array into n different chunks, each of which contains 1/n elements. Once each task has summed up the results from its chunk, add the results from each chunk to get your final answer.
Running Your Solution
CountTestSuite
Launch CountTestSuite.java as a JUnit Test to run all of the tests. CountTestSuite.java is located in src/test/java count.assignment package. You can initiate this via right clicking on CountTestSuite.java and selecting "Run As..." -> "JUnit Test".
class: | CountTestSuite.java | |
package: | count.assignment | |
source folder: | testing/src/test/java |
VM Argument
Habanero requires a special VM argument. Running your solution the first time will result in the text below being printed to the Console:
You need to add Habanero-Java to your VM arguments. Exiting.
The text below has been put in your copy buffer. Paste it into VM Arguments.
-javaagent:"~/.m2/repository/edu/rice/hjlib-cooperative/0.1.14-SNAPSHOT/hjlib-cooperative-0.1.14-SNAPSHOT.jar"
NOTE: do NOT copy and paste the line above. The "~" will be your home directory when you run it on your machine.
The text you need paste into the VM Arguments for the run configuration will automatically be placed into the copy buffer already. Follow these steps to give Habanero what it wants.
Be sure to preserve the -ea and add a space after it when pasting the VM arg.
If you need any further help or clarification, please don’t hesitate to post to piazza and/or reach out to one of the instructors.
Line Of Red Text On The Mac
In computer science (and life in general) you should not make a habit of ignoring red text.
However, there is a benign bug on the Mac which reports:
"objc[6477]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined."
Reportedly, this has finally been fixed and will be released soon:
https://stackoverflow.com/questions/43003012/class-javalaunchhelper-is-implemented-in-two-places
For now, you should ignore this.
Rubric
As always, please make sure to cite your work appropriately.
Total points: 100
- Correct calculateMidpoint (10)
- Correct countSequential (20)
- Correct countParallelUpperLowerSplit (20)
- Correct countParallelNWaySplit (40)
- Clarity and efficiency (10)
Optional Reading
Related Videos
LoopingAndFinal: https://wustl.box.com/s/wix18u57v7x1rdx1d1dgfedf6ibr0n92
SliceArrayDemo: https://wustl.box.com/s/p3ooceekguiaygg4hggw76rbpt28kf6o
AddingParallelism: https://wustl.box.com/s/smckzu78cvg8seocgluuo1afydgd0gmt